spcl / ucudnn

Accelerating DNN Convolutional Layers with Micro-batches
BSD 3-Clause "New" or "Revised" License
64 stars 9 forks source link

can't make files after cmake #1

Closed ZhengyuLin closed 6 years ago

ZhengyuLin commented 6 years ago

After type cmake .. -DCMAKE_INSTALL_PREFIX:PATH="/usr/local/cuda-9.0", I try to build the files. Then I got errors

../libucudnn.so.1.1.0: undefined reference to cudaGetDeviceCount' ../libucudnn.so.1.1.0: undefined reference tocudaFree' ../libucudnn.so.1.1.0: undefined reference to cudaGetDeviceProperties' ../libucudnn.so.1.1.0: undefined reference tocudaEventSynchronize' ../libucudnn.so.1.1.0: undefined reference to cudaGetDevice' ../libucudnn.so.1.1.0: undefined reference tocudaMemset' ../libucudnn.so.1.1.0: undefined reference to cudaEventQuery' ../libucudnn.so.1.1.0: undefined reference tocudaEventRecord' ../libucudnn.so.1.1.0: undefined reference to cudaEventCreate' ../libucudnn.so.1.1.0: undefined reference tocudaEventDestroy' ../libucudnn.so.1.1.0: undefined reference to cudaSetDevice' ../libucudnn.so.1.1.0: undefined reference tocudaMemGetInfo' ../libucudnn.so.1.1.0: undefined reference to cudaStreamSynchronize' ../libucudnn.so.1.1.0: undefined reference tocudaMalloc' ../libucudnn.so.1.1.0: undefined reference to cudaMemcpy' ../libucudnn.so.1.1.0: undefined reference tocudaGetErrorString'

How can I solve this? Thank you.

oyamay commented 6 years ago

This error happens when the compiler failed to link libucudnn.so to libcudart.so which is located in the CUDA toolkit. Please make sure that environment variables such as LIBRARY_PATH, LD_LIBRARY_PATH, and CUDA_PATH are set correctly, like:

export CUDA_PATH=/path/to/cuda
export LIBRARY_PATH=/path/to/cuda/lib64:...
export LD_LIBRARY_PATH=/path/to/cuda/lib64:...
ZhengyuLin commented 6 years ago

Thanks. By the way, I am compiling Tensorflow with ucudnn by bazel. Do you know how to include it into Tensorflow's source code and compile it by bazel?

oyamay commented 6 years ago

To compile u-cuDNN with TensorFlow, you have to apply a patch to the specific version of TensorFlow, and then compile TensorFlow itself. Please follow the instruction of patch/README.md to use the patch. If you are using a newer version of TensorFlow, you may have to check diff between your TensorFlow and the patched version. Details of the build instruction is documented here: https://www.tensorflow.org/install/install_sources

ZhengyuLin commented 6 years ago

Your instruction is to compile TensorFlow by CMake. Can I compile it using Bazel? Thanks.

oyamay commented 6 years ago

In my instruction, u-cuDNN is compiled by CMake, but you still use Bazel to compile TensorFlow. The upper part of the README is about how to compile Caffe by CMake.