Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link error compiling example #13

Closed
QingLicsaggie opened this issue Apr 18, 2019 · 2 comments
Closed

Link error compiling example #13

QingLicsaggie opened this issue Apr 18, 2019 · 2 comments

Comments

@QingLicsaggie
Copy link

Hi,

I am using the following make file to compile example/src/mnist_ae.cpp.

DLL_HOME = /home/tcn/Downloads/dll/
2 CUDA_HOME = /usr/local/cuda
3
4 CLANG = g++
5 CXXFLAGS += -std=c++14
6 LDFLAGS += -lpthread
7
8 ##########################################################
9 #DLL
10 ##########################################################
11 CPPFLAGS += -I${DLL_HOME}/include
12 CPPFLAGS += -I${DLL_HOME}/Catch/include
13 CPPFLAGS += -I${DLL_HOME}/etl/include
14 CPPFLAGS += -I${DLL_HOME}/etl/lib/include
15 CPPFLAGS += -I${DLL_HOME}/mnist/include
16 CPPFLAGS += -I${DLL_HOME}/cifar-10/include
17 CPPFLAGS += -I${DLL_HOME}/nice-svm/include
18
19 DLLFLAGS += -DETL_PARALLEL
20 DLLFLAGS += -DETL_VECTORIZE_FULL
21 ##DLLFLAGS += -DETL_BLAS_MODE
22 DLLFLAGS += -DETL_CUBLAS_MODE
23 DLLFLAGS += -DETL_CUDNN_MODE
24 #DLLFLAGS += -DETL_EGBLAS_MODE
25
26 ##########################################################
27 #CUDA
28 ##########################################################
29 CPPFLAGS += -I${CUDA_HOME}/include
30 LDFLAGS += -L${CUDA_HOME}/lib64 -lcublas -lcudart
31
32 ##########################################################
33 #MAKE
34 ##########################################################
35 all:
36
37 main:
38 ${CLANG} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} ${DLLFLAGS} mnist_ae.cpp

However, it has the following the link error:mnist_ae.cpp:(.text.ZN3etl4impl5cudnn18create_tensor_flatIRKNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT[ZN3etl4impl5cudnn18create_tensor_flatIRKNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT]+0x45): undefined reference to cudnnGetErrorString' mnist_ae.cpp:(.text._ZN3etl4impl5cudnn18create_tensor_flatIRKNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT_[_ZN3etl4impl5cudnn18create_tensor_flatIRKNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT_]+0xec): undefined reference to cudnnSetTensor4dDescriptor'
mnist_ae.cpp:(.text.ZN3etl4impl5cudnn18create_tensor_flatIRKNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT[ZN3etl4impl5cudnn18create_tensor_flatIRKNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT]+0x119): undefined reference to cudnnGetErrorString' /tmp/ccwc5ErW.o: In function cudnnTensorStruct* etl::impl::cudnn::create_tensor_flat<etl::dyn_matrix_impl<float, (etl::order)0, 2ul>&>(etl::dyn_matrix_impl<float, (etl::order)0, 2ul>&)':
mnist_ae.cpp:(.text.ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT[ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT]+0x1c): undefined reference to cudnnCreateTensorDescriptor' mnist_ae.cpp:(.text._ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT_[_ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT_]+0x45): undefined reference to cudnnGetErrorString'
mnist_ae.cpp:(.text.ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT[ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT]+0xec): undefined reference to cudnnSetTensor4dDescriptor' mnist_ae.cpp:(.text._ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT_[_ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT_]+0x119): undefined reference to cudnnGetErrorString'

Seems that it cannot link to cuda. However, my cuda is located at /usr/local/cuda. And my machine has a tensorflow, and it can link to cuda and run.

Can you help me rule out the problem?

Thanks.

@wichtounet wichtounet changed the title mnist_ae.cpp:(.text._ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT_[_ZN3etl4impl5cudnn18create_tensor_flatIRNS_15dyn_matrix_implIfLNS_5orderE0ELm2EEEEEP17cudnnTensorStructOT_]+0x119): undefined reference to `cudnnGetErrorString' Link error compiling example Apr 18, 2019
@wichtounet
Copy link
Owner

Hi,

You are missing link flags for CUDNN.

If you add -DETL_CUDNN_MODE that means you want to compile with CUDNN. Therefore, you need to add at least -lcudnn to the link flags. And you probably need to add the include path to the compilation flags. If you do not want to use CUDNN, you can remove the flag. But the performance are really best with CUDNN if you intend to work on GPU.

I hope that helps

Baptiste

@QingLicsaggie
Copy link
Author

Thanks. That helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants