[solved] Source compile error

Dear all,
I am building pytorch from source with the following:

System: Ubuntu 16.04
python2.7
cuda 9.0
cuDNN 7.0
installed intel_mkl by hand

not using anaconda for instalation as I cannot use it to install another package.

I am posting the error first, the full build log- I couldnt post as it exceeds the number of characters.
Any suggestion how to

Any help with solving that would be very much appreciated!!
All the best!
Hannes

The error:

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/ -I/home/vasyurhm/Software/pytorch -I/home/vasyurhm/Software/pytorch/torch/csrc -I/home/vasyurhm/Software/pytorch/torch/lib/pybind11/include -I/home/vasyurhm/Software/pytorch/torch/lib/tmp_install/include -I/home/vasyurhm/Software/pytorch/torch/lib/tmp_install/include/TH -I/home/vasyurhm/Software/pytorch/torch/lib/tmp_install/include/THNN -I/home/vasyurhm/Software/pytorch/torch/lib/tmp_install/include/ATen -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/home/vasyurhm/Software/pytorch/torch/lib/tmp_install/include/THD -I/usr/local/cuda/include -I/home/vasyurhm/Software/pytorch/torch/lib/tmp_install/include/THCUNN -I/usr/include/python2.7 -c torch/csrc/cudnn/cuDNN.cpp -o build/temp.linux-x86_64-2.7/torch/csrc/cudnn/cuDNN.o -D_THP_CORE -std=c++11 -Wno-write-strings -fno-strict-aliasing -Wno-missing-braces -DWITH_NUMPY -DWITH_DISTRIBUTED -DWITH_CUDA -DCUDA_LIB_PATH=/usr/local/cuda/lib64 -DWITH_NCCL -DWITH_CUDNN
In file included from /usr/local/cuda/include/channel_descriptor.h:62:0,
from /usr/local/cuda/include/cuda_runtime.h:90,
from /usr/include/cudnn.h:64,
from torch/csrc/cudnn/cudnn-wrapper.h:3,
from torch/csrc/cudnn/cuDNN.cpp:7:
/usr/local/cuda/include/cuda_runtime_api.h:1683:101: error: use of enum ā€˜cudaDeviceP2PAttrā€™ without previous declaration
extern host cudart_builtin cudaError_t CUDARTAPI cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, int srcDevice, int dstDevice);
^
/usr/local/cuda/include/cuda_runtime_api.h:2930:102: error: use of enum ā€˜cudaFuncAttributeā€™ without previous declaration
extern host cudart_builtin cudaError_t CUDARTAPI cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value);
^
In file included from /usr/local/cuda/include/channel_descriptor.h:62:0,
from /usr/local/cuda/include/cuda_runtime.h:90,
from /usr/include/cudnn.h:64,
from torch/csrc/cudnn/cudnn-wrapper.h:3,
from torch/csrc/cudnn/cuDNN.cpp:7:
/usr/local/cuda/include/cuda_runtime_api.h:5770:92: error: use of enum ā€˜cudaMemoryAdviseā€™ without previous declaration
extern host cudaError_t CUDARTAPI cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, int device);
^
/usr/local/cuda/include/cuda_runtime_api.h:5827:98: error: use of enum ā€˜cudaMemRangeAttributeā€™ without previous declaration
extern host cudaError_t CUDARTAPI cudaMemRangeGetAttribute(void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, const void *devPtr, size_t count);
^
/usr/local/cuda/include/cuda_runtime_api.h:5864:102: error: use of enum ā€˜cudaMemRangeAttributeā€™ without previous declaration
extern host cudaError_t CUDARTAPI cudaMemRangeGetAttributes(void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, size_t numAttributes, const void *devPtr, size_t count)
^
error: command ā€˜x86_64-linux-gnu-gccā€™ failed with exit status 1

Full build log: https://gist.github.com/hvasbath/dc00fd3579108bc2efbd6dbf956f1597

Its solved:

open the file:
/usr/include/cudnn.h

And I changed the line 63:
#include ā€œdriver_types.hā€

to:
#include <driver_types.h>

However, I have no clue how such a thing can be wrong in the first place?!!

1 Like