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

Ubuntu/Debian pip install kaldifeat: cannot find CUDNN #12

Closed
pzelasko opened this issue Oct 19, 2021 · 4 comments
Closed

Ubuntu/Debian pip install kaldifeat: cannot find CUDNN #12

pzelasko opened this issue Oct 19, 2021 · 4 comments

Comments

@pzelasko
Copy link

either doing pip install kaldifeat, or cloning source and doing python setup.py install, yields the following message:

...
-- Found CUDA: /usr/local/cuda (found version "10.2")
-- Caffe2: CUDA detected: 10.2
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 10.2
-- Could NOT find CUDNN (missing: CUDNN_LIBRARY_PATH CUDNN_INCLUDE_PATH)
CMake Warning at /home/pzelasko/miniconda3/envs/lhotse/lib/python3.7/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:109 (message):
  Caffe2: Cannot find cuDNN library.  Turning the option off
Call Stack (most recent call first):
  /home/pzelasko/miniconda3/envs/lhotse/lib/python3.7/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
  /home/pzelasko/miniconda3/envs/lhotse/lib/python3.7/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  cmake/torch.cmake:13 (find_package)
  CMakeLists.txt:41 (include)

I am able to build it by doing this:

<inside sources root>
mkdir build
cd build
cmake .. -DCUDNN_LIBRARY_PATH="/home/pzelasko/miniconda3/envs/lhotse/lib" -DCUDNN_INCLUDE_PATH="/home/pzelasko/miniconda3/envs/lhotse/include"

But there seems to be no way to pass these values through env vars when doing pip install kaldifeat.

@csukuangfj
Copy link
Owner

But there seems to be no way to pass these values through env vars when doing pip install kaldifeat.

There are some ways to pass these env vars to it, either using pip install or using python3 setup.py install.

Will propose a fix.

@csukuangfj
Copy link
Owner

csukuangfj commented Oct 20, 2021

I just realized the current master supports that.

You need to do

$ export KALDIFEAT_CMAKE_ARGS='-DCMAKE_BUILD_TYPE=Release -DCUDNN_LIBRARY_PATH="/home/pzelasko/miniconda3/envs/lhotse/lib" -DCUDNN_INCLUDE_PATH="/home/pzelasko/miniconda3/envs/lhotse/include"'

$ echo $KALDIFEAT_CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release -DCUDNN_LIBRARY_PATH="/home/pzelasko/miniconda3/envs/lhotse/lib" -DCUDNN_INCLUDE_PATH="/home/pzelasko/miniconda3/envs/lhotse/include"

And then you can run either python3 setup.py install or pip install kaldifeat.
It should use the CMake args you specified in KALDIFEAT_CMAKE_ARGS.


EDITED:

It should be

-DCUDNN_LIBRARY_PATH="/home/pzelasko/miniconda3/envs/lhotse/lib/libcudnn.so"

See k2-fsa/icefall#120 (comment)

@csukuangfj
Copy link
Owner

The code is in

cmake_args = os.environ.get("KALDIFEAT_CMAKE_ARGS", "")

if cmake_args == "":
cmake_args = "-DCMAKE_BUILD_TYPE=Release"

cmake {cmake_args} {kaldifeat_dir}

@WangHelin1997
Copy link

The same error and solved with it. Thanks!

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

3 participants