Closed farmer21cn closed 2 months ago
How did you install CUDA ?
Are you able to save the following content to test.cu
and compile it with
nvcc test.cu -o test
./test
#include <cuda.h>
#include <cstdio>
int main() {
printf("%d.%d", CUDA_VERSION / 1000, (CUDA_VERSION / 10) % 100);
return 0;
}
We have pre-compiled conda packages for kaldifeat, see https://csukuangfj.github.io/kaldifeat/installation.html#install-kaldifeat-from-conda-only-for-linux if you don't want to configure the environment to compile kaldifeat from source.
Yes, I installed CUDA,
cd egs/librispeech/ASR export CUDA_VISIBLE_DEVICES="0" ./conformer_ctc/train.py --world-size 1
these three commands worked good.
i want to use Pre-trained Model.
conda install -c kaldifeat -c pytorch -c conda-forge kaldifeat python=3.9.12 cudatoolkit=11.3.1 pytorch=1.12.1 the command is too slowly.
so i want to use python3 setup.py install.
Yes, I installed CUDA,
How did you install CUDA? What are the steps/commands you use?
Did you configure any environment variables after installing CUDA?
(base) root@78e6e1f24a2a:~/kaldidata# ./test 11.3(base) root@78e6e1f24a2a:~/kaldidata#
export CUDA_HOME=/usr/local/cuda-11.3 export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 export PATH=${CUDA_HOME}/bin:${PATH}
install cuda:
apt update
apt install libxml2
apt install build-essential
sh cuda_10.2.89_440.33.01_linux.run
export CUDA_HOME=/usr/local/cuda-11.3 export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 export PATH=${CUDA_HOME}/bin:${PATH}
install cudnn: tar -zxvf cudnn-11.3-linux-x64-v8.2.1.32.tgz cp cuda/lib64/ /usr/local/cuda-11.3.0/lib64/ cp cuda/include/ /usr/local/cuda-11.3.0/include/
install pytorch: conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
From the above log:
-- Caffe2: CUDA toolkit directory: /usr/local/cuda-11.3
From your posted commands:
cp cuda/lib64/* /usr/local/cuda-11.3.0/lib64/
I am not sure wether it is a typo or you don't recall what is the exact command you used.
Also from
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
You can see that you installed cuda in 2 different places. Please don't do this.
Please either install pytorch from pip (don't use conda as it installs too many things for you)
or uninstall the cuda in /usr/local
.
root@74c59ae9881e:~/kaldifeat# python3 setup.py install running install running bdist_egg running egg_info writing kaldifeat.egg-info/PKG-INFO writing dependency_links to kaldifeat.egg-info/dependency_links.txt writing top-level names to kaldifeat.egg-info/top_level.txt reading manifest file 'kaldifeat.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'kaldifeat.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py copying kaldifeat/python/kaldifeat/init.py -> build/lib.linux-x86_64-3.9/kaldifeat running build_ext Setting PYTHON_EXECUTABLE to /usr/bin/python3 For fast compilation, run: export KALDIFEAT_MAKE_ARGS="-j"; python setup.py install build command is:
cd build/temp.linux-x86_64-3.9
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 -Dkaldifeat_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/root/kaldifeat/build/lib.linux-x86_64-3.9/kaldifeat /root/kaldifeat
make _kaldifeat install
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- C++ Standard version: 14
-- Downloading pybind11
-- pybind11 is downloaded to /root/kaldifeat/build/temp.linux-x86_64-3.9/_deps/pybind11-src
-- pybind11 v2.9.2
-- Found PythonInterp: /usr/bin/python3 (found version "3.9")
-- Found PythonLibs: /usr/local/python3/lib/libpython3.9.a
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Python executable: /usr/bin/python3
-- TORCH_DIR: /usr/local/python3/lib/python3.9/site-packages/torch
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda-11.3 (found version "11.3")
-- The CUDA compiler identification is NVIDIA 11.3.109
-- Check for working CUDA compiler: /usr/local/cuda-11.3/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda-11.3/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Caffe2: CUDA detected: 11.3
-- Caffe2: CUDA nvcc is: /usr/local/cuda-11.3/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda-11.3
-- Caffe2: Header version is: 11.3
-- Found CUDNN: /usr/local/cuda-11.3/lib64/libcudnn.so
-- Found cuDNN: v8.2.1 (include: /usr/local/cuda-11.3/include, library: /usr/local/cuda-11.3/lib64/libcudnn.so)
-- /usr/local/cuda-11.3/lib64/libnvrtc.so shorthash is 1ea278b5
-- Autodetected CUDA architecture(s): 6.0 6.0 6.0
-- Added CUDA NVCC flags for: -gencode;arch=compute_60,code=sm_60
CMake Warning at /usr/local/python3/lib/python3.9/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:22 (message):
static library kineto_LIBRARY-NOTFOUND not found.
Call Stack (most recent call first):
/usr/local/python3/lib/python3.9/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:127 (append_torchlib_if_found)
cmake/torch.cmake:14 (find_package)
CMakeLists.txt:55 (include)
-- Found Torch: /usr/local/python3/lib/python3.9/site-packages/torch/lib/libtorch.so
-- PyTorch version: 1.12.1+cu113
-- CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0
-- CMAKE_INSTALL_PREFIX: /root/kaldifeat/build/lib.linux-x86_64-3.9/kaldifeat
-- All headers: /root/kaldifeat/kaldifeat/csrc/feature-common-inl.h;/root/kaldifeat/kaldifeat/csrc/feature-common.h;/root/kaldifeat/kaldifeat/csrc/feature-fbank.h;/root/kaldifeat/kaldifeat/csrc/feature-functions.h;/root/kaldifeat/kaldifeat/csrc/feature-mfcc.h;/root/kaldifeat/kaldifeat/csrc/feature-plp.h;/root/kaldifeat/kaldifeat/csrc/feature-spectrogram.h;/root/kaldifeat/kaldifeat/csrc/feature-window.h;/root/kaldifeat/kaldifeat/csrc/log.h;/root/kaldifeat/kaldifeat/csrc/matrix-functions.h;/root/kaldifeat/kaldifeat/csrc/mel-computations.h;/root/kaldifeat/kaldifeat/csrc/online-feature-itf.h;/root/kaldifeat/kaldifeat/csrc/online-feature.h;/root/kaldifeat/kaldifeat/csrc/pitch-functions.h
-- Configuring done
-- Generating done
-- Build files have been written to: /root/kaldifeat/build/temp.linux-x86_64-3.9
Scanning dependencies of target kaldifeat_core
[ 5%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-fbank.cc.o
[ 10%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-functions.cc.o
[ 15%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-mfcc.cc.o
[ 20%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-plp.cc.o
[ 25%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-spectrogram.cc.o
[ 30%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-window.cc.o
[ 35%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/matrix-functions.cc.o
[ 40%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/mel-computations.cc.o
[ 45%] Building CXX object kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/online-feature.cc.o
[ 50%] Linking CXX shared library ../../lib/libkaldifeat_core.so
[ 50%] Built target kaldifeat_core
Scanning dependencies of target _kaldifeat
[ 55%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/feature-fbank.cc.o
[ 60%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/feature-mfcc.cc.o
[ 65%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/feature-plp.cc.o
[ 70%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/feature-spectrogram.cc.o
[ 75%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/feature-window.cc.o
[ 80%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/kaldifeat.cc.o
[ 85%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/mel-computations.cc.o
[ 90%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/online-feature.cc.o
[ 95%] Building CXX object kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/utils.cc.o
[100%] Linking CXX shared module ../../../lib/_kaldifeat.cpython-39-x86_64-linux-gnu.so
/usr/bin/ld: /usr/local/python3/lib/libpython3.9.a(bytearrayobject.o): relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[3]: [kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/build.make:220: lib/_kaldifeat.cpython-39-x86_64-linux-gnu.so] Error 1
make[2]: [CMakeFiles/Makefile2:226: kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/all] Error 2
make[1]: [CMakeFiles/Makefile2:233: kaldifeat/python/csrc/CMakeFiles/_kaldifeat.dir/rule] Error 2
make: [Makefile:190: _kaldifeat] Error 2
Traceback (most recent call last):
File "/root/kaldifeat/setup.py", line 32, in
How did you install Python?
Could you install a shared library version of Python?
/usr/bin/ld: /usr/local/python3/lib/libpython3.9.a(bytearrayobject.o): relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
That is, you are using libpython3.9.a
. Could you install a python that uses libpython3.9.so
?
You can use https://github.com/pyenv/pyenv to install a shared library version of Python without the need of sudo permission.
You need to export PYTHON_CONFIGURE_OPTS="--enable-shared"
if you want to use pyenv
to install python.
wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz
tar -zxvf Python-3.9.13.tgz
./configure --prefix=/usr/local/python3 make make install
ln -s /usr/local/python3/bin/python3.9 /usr/bin/python3 ln -s /usr/local/python3/bin/python3.9 /usr/bin/python ln -s /usr/local/python3/bin/pip3.9 /usr/bin/pip3 ln -s /usr/local/python3/bin/pip3.9 /usr/bin/pip
Please change
./configure --prefix=/usr/local/python3
to
./configure --enable-shared --prefix=/usr/local/python3
and re-install it.
OK
running install /root/anaconda3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /root/anaconda3/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( running bdist_egg running egg_info writing kaldifeat.egg-info/PKG-INFO writing dependency_links to kaldifeat.egg-info/dependency_links.txt writing top-level names to kaldifeat.egg-info/top_level.txt reading manifest file 'kaldifeat.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE' writing manifest file 'kaldifeat.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py copying kaldifeat/python/kaldifeat/torch_version.py -> build/lib.linux-x86_64-3.9/kaldifeat copying kaldifeat/python/kaldifeat/init.py -> build/lib.linux-x86_64-3.9/kaldifeat running build_ext Setting PYTHON_EXECUTABLE to /root/anaconda3/bin/python3 For fast compilation, run: export KALDIFEAT_MAKE_ARGS="-j"; python setup.py install build command is:
-- C++ Standard version: 14 -- Downloading pybind11 -- pybind11 is downloaded to /root/kaldifeat/build/temp.linux-x86_64-3.9/_deps/pybind11-src -- pybind11 v2.9.2 -- Python executable: /root/anaconda3/bin/python3 -- TORCH_DIR: /root/anaconda3/lib/python3.9/site-packages/torch -- Caffe2: CUDA detected: 11.3 -- Caffe2: CUDA nvcc is: /usr/local/cuda-11.3/bin/nvcc -- Caffe2: CUDA toolkit directory: /usr/local/cuda-11.3 -- Caffe2: Header version is: 11.3 -- Found cuDNN: v8.2.1 (include: /usr/local/cuda-11.3/include, library: /usr/local/cuda-11.3/lib64/libcudnn.so) -- /usr/local/cuda-11.3/lib64/libnvrtc.so shorthash is 8aa72235 -- Autodetected CUDA architecture(s): 6.0 6.0 6.0 -- Added CUDA NVCC flags for: -gencode;arch=compute_60,code=sm_60 CMake Warning at /root/anaconda3/lib/python3.9/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:22 (message): static library kineto_LIBRARY-NOTFOUND not found. Call Stack (most recent call first): /root/anaconda3/lib/python3.9/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:127 (append_torchlib_if_found) cmake/torch.cmake:14 (find_package) CMakeLists.txt:55 (include)
-- PyTorch version: 1.12.1 -- CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 -- CMAKE_INSTALL_PREFIX: /root/kaldifeat/build/lib.linux-x86_64-3.9/kaldifeat -- All headers: /root/kaldifeat/kaldifeat/csrc/feature-common-inl.h;/root/kaldifeat/kaldifeat/csrc/feature-common.h;/root/kaldifeat/kaldifeat/csrc/feature-fbank.h;/root/kaldifeat/kaldifeat/csrc/feature-functions.h;/root/kaldifeat/kaldifeat/csrc/feature-mfcc.h;/root/kaldifeat/kaldifeat/csrc/feature-plp.h;/root/kaldifeat/kaldifeat/csrc/feature-spectrogram.h;/root/kaldifeat/kaldifeat/csrc/feature-window.h;/root/kaldifeat/kaldifeat/csrc/log.h;/root/kaldifeat/kaldifeat/csrc/matrix-functions.h;/root/kaldifeat/kaldifeat/csrc/mel-computations.h;/root/kaldifeat/kaldifeat/csrc/online-feature-itf.h;/root/kaldifeat/kaldifeat/csrc/online-feature.h;/root/kaldifeat/kaldifeat/csrc/pitch-functions.h -- Configuring done -- Generating done -- Build files have been written to: /root/kaldifeat/build/temp.linux-x86_64-3.9 [ 50%] Built target kaldifeat_core [100%] Built target _kaldifeat [ 45%] Built target kaldifeat_core [ 50%] Linking CXX executable ../../bin/test_kaldifeat /usr/bin/ld: /root/anaconda3/lib/python3.9/site-packages/torch/lib/libtorch_cuda_cu.so: undefined reference to
setuptools.setup(
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/init.py", line 87, in setup
return distutils.core.setup( attrs)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/command/install.py", line 74, in run
self.do_egg_install()
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/command/install.py", line 123, in do_egg_install
self.run_command('bdist_egg')
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 165, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 151, in call_command
self.run_command(cmdname)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/command/install_lib.py", line 107, in build
self.run_command('build_ext')
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/dist.py", line 1214, in run_command
super().run_command(command)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/root/anaconda3/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/root/anaconda3/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/root/anaconda3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/root/kaldifeat/cmake/cmake_extension.py", line 122, in build_extension
raise Exception(
Exception:
Build kaldifeat failed. Please check the error message.
You can ask for help by creating an issue on GitHub.
cusparseSpSM_createDescr@libcusparse.so.11' /usr/bin/ld: /root/anaconda3/lib/python3.9/site-packages/torch/lib/libtorch_cuda_cu.so: undefined reference to
cusparseSpSM_analysis@libcusparse.so.11' /usr/bin/ld: /root/anaconda3/lib/python3.9/site-packages/torch/lib/libtorch_cuda_cu.so: undefined reference tocusparseSpSM_solve@libcusparse.so.11' /usr/bin/ld: /root/anaconda3/lib/python3.9/site-packages/torch/lib/libtorch_cuda_cu.so: undefined reference to
cusparseSpSM_destroyDescr@libcusparse.so.11' /usr/bin/ld: /root/anaconda3/lib/python3.9/site-packages/torch/lib/libtorch_cuda_cu.so: undefined reference to `cusparseSpSM_bufferSize@libcusparse.so.11' collect2: error: ld returned 1 exit status make[2]: [kaldifeat/csrc/CMakeFiles/test_kaldifeat.dir/build.make:98: bin/test_kaldifeat] Error 1 make[1]: [CMakeFiles/Makefile2:172: kaldifeat/csrc/CMakeFiles/test_kaldifeat.dir/all] Error 2 make: * [Makefile:130: all] Error 2 Traceback (most recent call last): File "/root/kaldifeat/setup.py", line 32, inClick: https://github.com/csukuangfj/kaldifeat/issues/new