k2-fsa / k2

FSA/FST algorithms, differentiable, with PyTorch compatibility.
https://k2-fsa.github.io/k2
Apache License 2.0
1.13k stars 214 forks source link

compile k2 dev1.22 failed with torch 1.12, but success on k2 dev 1.21(1.21.dev20221031+cuda11.6.torch1.12.0) #1107

Closed kobenaxie closed 1 year ago

kobenaxie commented 1 year ago

python3 -m torch.utils.collect_env outputs

Collecting environment information...
PyTorch version: 1.12.0+cu116
Is debug build: False
CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.5 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Clang version: Could not collect
CMake version: version 3.16.3
Libc version: glibc-2.31

Python version: 3.8.13 (default, Oct 21 2022, 23:50:54)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-4.15.0-112-generic-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 11.2.152
GPU models and configuration:
GPU 0: A100-SXM4-40GB
GPU 1: A100-SXM4-40GB
GPU 2: A100-SXM4-40GB
GPU 3: A100-SXM4-40GB
GPU 4: A100-SXM4-40GB
GPU 5: A100-SXM4-40GB
GPU 6: A100-SXM4-40GB
GPU 7: A100-SXM4-40GB

Nvidia driver version: 460.91.03
cuDNN version: Probably one of the following:
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn.so.8
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] k2==1.21.dev20221031+cuda11.6.torch1.12.0
[pip3] numpy==1.22.4
[pip3] torch==1.12.0+cu116
[pip3] torchaudio==0.12.0+cu116
[conda] k2                        1.21.dev20221031+cuda11.6.torch1.12.0          pypi_0    pypi
[conda] numpy                     1.22.4                   pypi_0    pypi
[conda] torch                     1.12.0+cu116             pypi_0    pypi
[conda] torchaudio                0.12.0+cu116             pypi_0    pypi

When building wheel with commond python3 setup.py bdist_wheel, get error

CMake Warning at /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:22 (message):
   static library kineto_LIBRARY-NOTFOUND not found.
 Call Stack (most recent call first):
   /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:127 (append_torchlib_if_found)
   cmake/torch.cmake:11 (find_package)
   CMakeLists.txt:292 (include)

 CMake Warning at /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:22 (message):
   static library kineto_LIBRARY-NOTFOUND not found.
 Call Stack (most recent call first):
   /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:127 (append_torchlib_if_found)
   cmake/torch.cmake:11 (find_package)
   build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/CMakeLists.txt:55 (include)

 CMake Warning at k2/csrc/CMakeLists.txt:101 (add_library):
   Cannot generate a safe runtime search path for target context because files
   in some directories may conflict with libraries in implicit directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 CMake Warning at build/temp.linux-x86_64-cpython-38/_deps/pybind11-src/tools/pybind11Tools.cmake:177 (add_library):
   Cannot generate a safe runtime search path for target _k2 because files in
   some directories may conflict with libraries in implicit directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.
 Call Stack (most recent call first):
   k2/python/csrc/CMakeLists.txt:32 (pybind11_add_module)

 CMake Warning at k2/torch/csrc/CMakeLists.txt:73 (add_library):
   Cannot generate a safe runtime search path for target k2_torch_api because
   files in some directories may conflict with libraries in implicit
   directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
      /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 CMake Warning at k2/torch/csrc/CMakeLists.txt:24 (add_library):
   Cannot generate a safe runtime search path for target k2_torch because
   files in some directories may conflict with libraries in implicit
   directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 CMake Warning at k2/torch/bin/CMakeLists.txt:87 (add_executable):
   Cannot generate a safe runtime search path for target
   pruned_stateless_transducer because files in some directories may conflict
   with libraries in implicit directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 CMake Warning at k2/torch/bin/CMakeLists.txt:75 (add_executable):
   Cannot generate a safe runtime search path for target rnnt_demo because
   files in some directories may conflict with libraries in implicit
   directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 CMake Warning at k2/torch/bin/CMakeLists.txt:63 (add_executable):
   Cannot generate a safe runtime search path for target online_decode because
   files in some directories may conflict with libraries in implicit
   directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 CMake Warning at k2/torch/bin/CMakeLists.txt:50 (add_executable):
   Cannot generate a safe runtime search path for target attention_rescore
   because files in some directories may conflict with libraries in implicit
   directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 CMake Warning at k2/torch/bin/CMakeLists.txt:28 (add_executable):
   Cannot generate a safe runtime search path for target hlg_decode because
   files in some directories may conflict with libraries in implicit
   directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 CMake Warning at k2/torch/bin/CMakeLists.txt:39 (add_executable):
   Cannot generate a safe runtime search path for target ngram_lm_rescore
   because files in some directories may conflict with libraries in implicit
   directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

CMake Warning at k2/torch/bin/CMakeLists.txt:17 (add_executable):
   Cannot generate a safe runtime search path for target ctc_decode because
   files in some directories may conflict with libraries in implicit
   directories:

     runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib
     runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in:
       /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

   Some of these libraries may not be found correctly.

 /tools2/k2_dev/k2/csrc/algorithms.h: In member function ‘k2::FsaVec k2::MultiGraphDenseIntersect::FormatOutput(k2::Array1<int>*, k2::Array1<int>*)’:
 /tools2/k2_dev/k2/csrc/algorithms.h:33:7: warning: ‘<anonymous>.k2::Renumbering::num_new_elems_’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    33 | class Renumbering {
       |       ^~~~~~~~~~~
 /tools2/k2_dev/k2/csrc/ragged_ops_inl.h: In function ‘k2::Renumbering k2::PruneRaggedAxis1(k2::Ragged<U>&, T, int32_t) [with T = double]’:
 /tools2/k2_dev/k2/csrc/ragged_ops_inl.h:844:16: warning: ‘order_map_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   844 |   const int32_t *order_map_data;
       |                ^~~~~~~~~~~~~~
 /tools2/k2_dev/k2/torch/csrc/beam_search.cu: In function ‘std::vector<std::vector<int>, std::allocator<std::vector<int> > > k2::ModifiedBeamSearch(const torch::jit::Module&, const at::Tensor&, const at::      Tensor&, int32_t)’:
 /tools2/k2_dev/k2/torch/csrc/beam_search.cu:272:20: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::vector<k2::Hypotheses>::size_type’ {aka ‘long unsigned   int’} [-Wsign-compare]
   272 |     if (cur_batch_size < cur.size()) {
       |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~
 /tools2/k2_dev/k2/torch/csrc/beam_search.cu:298:23: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::vector<k2::Hypothesis>::size_type’ {aka ‘long unsigned   int’} [-Wsign-compare]
   298 |     for (int32_t k = 0; k != prev.size(); ++k) {
       |                     ~~^~~~~~~~~~~~~~
 /tools2/k2_dev/k2/torch/csrc/deserialization.cu: In function ‘void k2::_GLOBAL__N__50_tmpxft_00186015_00000000_7_deserialization_cpp1_ii_4aae5ec1::restoreAccurateTypeTags(const c10::IValue&, const TypePtr&)’: /tools2/k2_dev/k2/torch/csrc/deserialization.cu:101:8: warning: enumeration value ‘StorageType’ not handled in switch [-Wswitch]
   101 |     switch (w.static_type->kind()) {
       |        ^
 /tools2/k2_dev/k2/torch/csrc/deserialization.cu:101:8: warning: enumeration value ‘ComplexType’ not handled in switch [-Wswitch]
 /tools2/k2_dev/k2/torch/csrc/deserialization.cu:101:8: warning: enumeration value ‘StreamObjType’ not handled in switch [-Wswitch]
 /tools2/k2_dev/k2/torch/csrc/deserialization.cu:101:8: warning: enumeration value ‘MemoryFormatType’ not handled in switch [-Wswitch]
 /tools2/k2_dev/k2/torch/csrc/deserialization.cu:101:8: warning: enumeration value ‘SymIntType’ not handled in switch [-Wswitch]
 /tools2/k2_dev/k2/torch/csrc/deserialization.cu:101:8: warning: enumeration value ‘UnionType’ not handled in switch [-Wswitch]
 /tools2/k2_dev/k2/torch/csrc/deserialization.cu:101:8: warning: enumeration value ‘DynamicType’ not handled in switch [-Wswitch]
 /tools2/k2_dev/k2/torch/csrc/parse_options.cu: In member function ‘int32_t k2::ParseOptions::ToInt(const string&) const’:
 /tools2/k2_dev/k2/torch/csrc/parse_options.cu:705:8: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   705 |   return ret;
       |        ^~~
 /tools2/k2_dev/k2/torch/csrc/parse_options.cu: In member function ‘uint32_t k2::ParseOptions::ToUint(const string&) const’:
 /tools2/k2_dev/k2/torch/csrc/parse_options.cu:712:8: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   712 |   return ret;
/usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaGraphRetainUserObject@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaUserObjectCreate@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaStreamUpdateCaptureDependencies@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaStreamGetCaptureInfo_v2@libcudart.so.11.0'
 collect2: error: ld returned 1 exit status
 make[2]: *** [k2/torch/bin/CMakeFiles/pruned_stateless_transducer.dir/build.make:109: bin/pruned_stateless_transducer] Error 1
 make[1]: *** [CMakeFiles/Makefile2:688: k2/torch/bin/CMakeFiles/pruned_stateless_transducer.dir/all] Error 2
 make[1]: *** Waiting for unfinished jobs....
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaGraphRetainUserObject@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaUserObjectCreate@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaStreamUpdateCaptureDependencies@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaStreamGetCaptureInfo_v2@libcudart.so.11.0'
 collect2: error: ld returned 1 exit status
 make[2]: *** [k2/torch/bin/CMakeFiles/rnnt_demo.dir/build.make:109: bin/rnnt_demo] Error 1
 make[1]: *** [CMakeFiles/Makefile2:720: k2/torch/bin/CMakeFiles/rnnt_demo.dir/all] Error 2
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaGraphRetainUserObject@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaUserObjectCreate@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaStreamUpdateCaptureDependencies@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaStreamGetCaptureInfo_v2@libcudart.so.11.0'
 collect2: error: ld returned 1 exit status
 make[2]: *** [k2/torch/bin/CMakeFiles/online_decode.dir/build.make:109: bin/online_decode] Error 1
 make[1]: *** [CMakeFiles/Makefile2:752: k2/torch/bin/CMakeFiles/online_decode.dir/all] Error 2
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaGraphRetainUserObject@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaUserObjectCreate@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaStreamUpdateCaptureDependencies@libcudart.so.11.0'
 /usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaStreamGetCaptureInfo_v2@libcudart.so.11.0'
 collect2: error: ld returned 1 exit status
 make[2]: *** [k2/torch/bin/CMakeFiles/attention_rescore.dir/build.make:109: bin/attention_rescore] Error 1
 make[1]: *** [CMakeFiles/Makefile2:784: k2/torch/bin/CMakeFiles/attention_rescore.dir/all] Error 2
 make: *** [Makefile:130: all] Error 2
 Traceback (most recent call last):
   File "setup.py", line 233, in <module>
     setuptools.setup(
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
     return distutils.core.setup(**attrs)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
     return run_commands(dist)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
     dist.run_commands()
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
     self.run_command(cmd)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command
     super().run_command(command)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
     cmd_obj.run()
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
     self.run_command('build')
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
     self.distribution.run_command(command)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command
     super().run_command(command)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
     cmd_obj.run()
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 132, in run
     self.run_command(cmd_name)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
     self.distribution.run_command(command)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command
     super().run_command(command)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
     cmd_obj.run()
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 84, in run
     _build_ext.run(self)
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
     self.build_extensions()
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions
     self._build_extensions_serial()
   File "/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial
     self.build_extension(ext)
   File "setup.py", line 206, in build_extension
     raise Exception("Failed to build k2")
 Exception: Failed to build k2
kobenaxie commented 1 year ago

log outputs

Fix https://github.com/pytorch/pytorch/issues/88290
/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch
Skip
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/online_dense_intersecter.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/mutual_information.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/ctc_loss.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/nbest.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/fsa_algo.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/rnnt_decode.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/decode.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/symbol_table.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/autograd.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/dense_fsa_vec.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/__init__.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/fsa_properties.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/rnnt_loss.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/utils.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/fsa.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/ops.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/autograd_utils.py -> build/lib.linux-x86_64-cpython-38/k2
copying k2/python/k2/mwer_loss.py -> build/lib.linux-x86_64-cpython-38/k2
creating build/lib.linux-x86_64-cpython-38/k2/ragged
copying k2/python/k2/ragged/__init__.py -> build/lib.linux-x86_64-cpython-38/k2/ragged
creating build/lib.linux-x86_64-cpython-38/k2/sparse
copying k2/python/k2/sparse/autograd.py -> build/lib.linux-x86_64-cpython-38/k2/sparse
copying k2/python/k2/sparse/__init__.py -> build/lib.linux-x86_64-cpython-38/k2/sparse
creating build/lib.linux-x86_64-cpython-38/k2/version
copying k2/python/k2/version/__init__.py -> build/lib.linux-x86_64-cpython-38/k2/version
copying k2/python/k2/version/__main__.py -> build/lib.linux-x86_64-cpython-38/k2/version
copying k2/python/k2/version/version.py -> build/lib.linux-x86_64-cpython-38/k2/version
running build_ext
-- CMAKE_VERSION: 3.16.3
-- Enabled languages: CXX;CUDA
-- The CXX compiler identification is GNU 9.4.0
-- The CUDA compiler identification is NVIDIA 11.2.152
-- 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
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- K2_OS: Ubuntu 18.04.5 LTS
-- Found Git: /usr/bin/git (found version "2.17.1") 
-- Looking for C++ include cxxabi.h
-- Looking for C++ include cxxabi.h - found
-- Looking for C++ include execinfo.h
-- Looking for C++ include execinfo.h - found
-- Performing Test K2_COMPILER_SUPPORTS_CXX14
-- Performing Test K2_COMPILER_SUPPORTS_CXX14 - Success
-- C++ Standard version: 14
-- Autodetected CUDA architecture(s):  8.0 8.0 8.0 8.0 8.0 8.0 8.0 8.0
-- K2_COMPUTE_ARCH_FLAGS: -gencode;arch=compute_80,code=sm_80
-- K2_COMPUTE_ARCH_CANDIDATES 35;50;60;61;70;75;80;86
-- Skipping arch 35
-- Skipping arch 50
-- Skipping arch 60
-- Skipping arch 61
-- Skipping arch 70
-- Skipping arch 75
-- Adding arch 80
-- Skipping arch 86
-- K2_COMPUTE_ARCHS: 80
-- Could NOT find Valgrind (missing: Valgrind_INCLUDE_DIR Valgrind_EXECUTABLE) 
-- Downloading pybind11 from https://github.com/pybind/pybind11/archive/5bc0943ed96836f46489f53961f6c438d2935357.zip
-- pybind11 is downloaded to /tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/pybind11-src
-- pybind11 v2.11.0 dev1
-- Found PythonInterp: /anaconda3/envs/k2-cu102/bin/python3 (found suitable version "3.8.13", minimum required is "3.6") 
-- Found PythonLibs: /anaconda3/envs/k2-cu102/lib/libpython3.8.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Python executable: /anaconda3/envs/k2-cu102/bin/python3
-- Looking for C++ include pthread.h
-- Looking for C++ include 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 (found version "11.2") 
-- Caffe2: CUDA detected: 11.2
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 11.2
-- Found CUDNN: /usr/local/cuda/lib64/libcudnn.so  
-- Found cuDNN: v8.1.1  (include: /usr/local/cuda/include, library: /usr/local/cuda/lib64/libcudnn.so)
-- /usr/local/cuda/lib64/libnvrtc.so shorthash is 369df368
-- Autodetected CUDA architecture(s):  8.0 8.0 8.0 8.0 8.0 8.0 8.0 8.0
-- Added CUDA NVCC flags for: -gencode;arch=compute_80,code=sm_80
-- Found Torch: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch.so  
-- K2_TORCH_VERSION: 1.12
-- PyTorch version: 1.12.0+cu116
-- PyTorch cuda version: 11.6
-- Generated /tools2/k2_dev/build/temp.linux-x86_64-cpython-38/torch_version.py
-- Downloading moderngpu from https://github.com/moderngpu/moderngpu/archive/8ec9ac0de8672de7217d014917eedec5317f75f3.zip
-- moderngpu is downloaded to /tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/moderngpu-src
-- CMAKE_CUDA_FLAGS:  -Wno-deprecated-gpu-targets   -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w  --expt-extended-lambda -gencode arch=compute_80,code=sm_80 -DONNX_NAMESPACE=onnx_c2 -gencode arch=compute_80,code=sm_80 -Xcudafe --diag_suppress=cc_clobber_ignored,--diag_suppress=integer_sign_change,--diag_suppress=useless_using_declaration,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=implicit_return_from_non_void_function,--diag_suppress=unsigned_compare_with_zero,--diag_suppress=declared_but_not_referenced,--diag_suppress=bad_friend_decl --expt-relaxed-constexpr --expt-extended-lambda -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options -Wall  --compiler-options -Wno-strict-overflow  --compiler-options -Wno-unknown-pragmas 
-- CMAKE_CXX_FLAGS:  -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-unused-variable  -Wno-strict-overflow 
-- CMAKE_CUDA_FLAGS:  -Wno-deprecated-gpu-targets   -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w  --expt-extended-lambda -gencode arch=compute_80,code=sm_80 -DONNX_NAMESPACE=onnx_c2 -gencode arch=compute_80,code=sm_80 -Xcudafe --diag_suppress=cc_clobber_ignored,--diag_suppress=integer_sign_change,--diag_suppress=useless_using_declaration,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=implicit_return_from_non_void_function,--diag_suppress=unsigned_compare_with_zero,--diag_suppress=declared_but_not_referenced,--diag_suppress=bad_friend_decl --expt-relaxed-constexpr --expt-extended-lambda -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options -Wall  --compiler-options -Wno-strict-overflow  --compiler-options -Wno-unknown-pragmas 
-- Generated /tools2/k2_dev/build/temp.linux-x86_64-cpython-38/k2/csrc/version.h
-- PYTHON_LIBRARY: /anaconda3/envs/k2-cu102/lib/libpython3.8.so
-- Including k2/torch. K2_TORCH_VERSION is 1.12
-- Downloading kaldifeat from https://github.com/csukuangfj/kaldifeat/archive/refs/tags/v1.20.tar.gz
-- kaldifeat is downloaded to /tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src
-- kaldifeat's binary dir is /tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-build
-- The C 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
-- C++ Standard version: 14
-- Python executable: /anaconda3/envs/k2-cu102/bin/python3
-- K2_TORCH_VERSION: 1.12
-- PyTorch version: 1.12.0+cu116
-- PyTorch cuda version: 11.6
-- CMAKE_CXX_FLAGS:  -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-unused-variable  -Wno-strict-overflow  -D_GLIBCXX_USE_CXX11_ABI=0
-- CMAKE_INSTALL_PREFIX: /tools2/k2_dev/build/lib.linux-x86_64-cpython-38/k2
-- All headers: /tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/feature-common-inl.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/feature-common.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/feature-fbank.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/feature-functions.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/feature-mfcc.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/feature-plp.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/feature-spectrogram.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/feature-window.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/log.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/matrix-functions.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/mel-computations.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/online-feature-itf.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/online-feature.h;/tools2/k2_dev/build/temp.linux-x86_64-cpython-38/_deps/kaldifeat-src/kaldifeat/csrc/pitch-functions.h
-- Configuring done
-- Generating done
-- Build files have been written to: /tools2/k2_dev/build/temp.linux-x86_64-cpython-38
/**
 * @brief
 * This file contains information for building k2, which is helpful
 * for describing the environment in which k2 is used when creating
 * an issue on GitHub.
 *
 * @copyright
 * Copyright (c)  2020  Mobvoi Inc.        (authors: Fangjun Kuang)
 *
 * @copyright
 * See LICENSE for clarification regarding multiple authors
 *
 * @caution
 * This file is auto-generated by CMake. Do NOT edit!
 * You can find it at build_dir/k2/csrc/version.h
 */

#ifndef K2_CSRC_VERSION_H_
#define K2_CSRC_VERSION_H_

namespace k2 {

// Version of k2 in "major.minor.patch" format
static constexpr const char *kVersion = "1.22";

// The commit used to build k2
static constexpr const char *kGitSha1 = "0a6cf0b7b5e4f58a3444cac85800f397f7f317f0";

// Date of the commit used to build k2
static constexpr const char *kGitDate = "Wed Nov 16 08:09:40 2022";

// Version of CUDA used to build k2.
// Its format is "major.minor", e.g., 10.1
static constexpr const char *kCudaVersion = "11.2";

// cuDNN version, e.g., 8.0.2
static constexpr const char *kCudnnVersion = "8.1.1";

// clang-format off
// Version of Python used to build k2 Python bindings.
static constexpr const char *kPythonVersion = "3.8";

// clang-format on

// CMake build type, e.g., Release or Debug.
static constexpr const char *kBuildType = "Release";

// The operating system that is used to build k2, e.g., Ubuntu 16.04 LTS
static constexpr const char *kOS = R"os(Ubuntu 18.04.5 LTS)os";

// e.g., 3.18.0
static constexpr const char *kCMakeVersion = "3.16.3";

// Version of the compiler, e.g., 5.4.0
static constexpr const char *kGCCVersion = "9.4.0";

// CUDA flags used to compile k2
static constexpr const char *kCMakeCudaFlags = R"cuda_flags( -Wno-deprecated-gpu-targets   -lineinfo --expt-extended-lambda -use_fast_math -Xptxas=-w  --expt-extended-lambda -gencode arch=compute_80,code=sm_80 -DONNX_NAMESPACE=onnx_c2 -gencode arch=compute_80,code=sm_80 -Xcudafe --diag_suppress=cc_clobber_ignored,--diag_suppress=integer_sign_change,--diag_suppress=useless_using_declaration,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=implicit_return_from_non_void_function,--diag_suppress=unsigned_compare_with_zero,--diag_suppress=declared_but_not_referenced,--diag_suppress=bad_friend_decl --expt-relaxed-constexpr --expt-extended-lambda -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options -Wall  --compiler-options -Wno-strict-overflow  --compiler-options -Wno-unknown-pragmas )cuda_flags";

// CXX flags used to compile k2
static constexpr const char *kCMakeCxxFlags = R"cxx_flags( -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-unused-variable  -Wno-strict-overflow )cxx_flags";

// Which PyTorch version k2 is using, e.g., 1.6.0+cu101
static constexpr const char *kTorchVersion = "1.12.0+cu116";

// Which CUDA version PyTorch is using, e.g., 10.1
static constexpr const char *kTorchCudaVersion = "11.6";

#ifndef K2_WITH_CUDA
#define K2_WITH_CUDA
#endif

#ifdef K2_WITH_CUDA
  static constexpr bool kWithCuda = true;
#else
  static constexpr bool kWithCuda = false;
#endif

// Indicate whether NVTX is enabled or not
#ifndef K2_ENABLE_NVTX
#define K2_ENABLE_NVTX
#endif

#ifdef K2_ENABLE_NVTX
static constexpr bool kEnableNvtx = true;
#else
static constexpr bool kEnableNvtx = false;
#endif
}  // namespace k2

#endif  //  K2_CSRC_VERSION_H_
Scanning dependencies of target k2_log
[  1%] Building CUDA object k2/csrc/CMakeFiles/k2_log.dir/log.cu.o
[  1%] Linking CUDA shared library ../../lib/libk2_log.so
[  1%] Built target k2_log
Scanning dependencies of target fsa
[  3%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/arcsort.cc.o
[  5%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/aux_labels.cc.o
[  5%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/determinize.cc.o
[  6%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/connect.cc.o
[  8%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/determinize_pruned.cc.o
[ 10%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/fsa.cc.o
[ 11%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/fsa_equivalent.cc.o
[ 13%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/fsa_renderer.cc.o
[ 13%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/fsa_util.cc.o
[ 15%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/intersect.cc.o
[ 16%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/properties.cc.o
[ 18%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/rmepsilon_pruned.cc.o
[ 18%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/topsort.cc.o
[ 20%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/util.cc.o
[ 22%] Building CXX object k2/csrc/host/CMakeFiles/fsa.dir/weights.cc.o
[ 23%] Linking CXX shared library ../../../lib/libk2fsa.so
[ 23%] Built target fsa
Scanning dependencies of target context
[ 25%] Building CUDA object k2/csrc/CMakeFiles/context.dir/array_ops.cu.o
[ 28%] Building CUDA object k2/csrc/CMakeFiles/context.dir/array_of_ragged.cu.o
[ 28%] Building CUDA object k2/csrc/CMakeFiles/context.dir/algorithms.cu.o
[ 28%] Building CUDA object k2/csrc/CMakeFiles/context.dir/connect.cu.o
[ 30%] Building CUDA object k2/csrc/CMakeFiles/context.dir/context.cu.o
[ 32%] Building CUDA object k2/csrc/CMakeFiles/context.dir/dtype.cu.o
[ 32%] Building CUDA object k2/csrc/CMakeFiles/context.dir/fsa.cu.o
[ 33%] Building CUDA object k2/csrc/CMakeFiles/context.dir/fsa_algo.cu.o
[ 35%] Building CUDA object k2/csrc/CMakeFiles/context.dir/fsa_utils.cu.o
[ 37%] Building CUDA object k2/csrc/CMakeFiles/context.dir/hash.cu.o
[ 37%] Building CUDA object k2/csrc/CMakeFiles/context.dir/host_shim.cu.o
[ 38%] Building CUDA object k2/csrc/CMakeFiles/context.dir/intersect.cu.o
[ 40%] Building CUDA object k2/csrc/CMakeFiles/context.dir/intersect_dense.cu.o
[ 42%] Building CUDA object k2/csrc/CMakeFiles/context.dir/intersect_dense_pruned.cu.o
[ 42%] Building CUDA object k2/csrc/CMakeFiles/context.dir/math.cu.o
[ 44%] Building CUDA object k2/csrc/CMakeFiles/context.dir/moderngpu_allocator.cu.o
[ 45%] Building CUDA object k2/csrc/CMakeFiles/context.dir/pinned_context.cu.o
[ 47%] Building CUDA object k2/csrc/CMakeFiles/context.dir/ragged.cu.o
[ 49%] Building CUDA object k2/csrc/CMakeFiles/context.dir/ragged_ops.cu.o
[ 49%] Building CUDA object k2/csrc/CMakeFiles/context.dir/ragged_utils.cu.o
[ 50%] Building CUDA object k2/csrc/CMakeFiles/context.dir/rand.cu.o
[ 52%] Building CUDA object k2/csrc/CMakeFiles/context.dir/reverse.cu.o
[ 54%] Building CUDA object k2/csrc/CMakeFiles/context.dir/rm_epsilon.cu.o
[ 54%] Building CUDA object k2/csrc/CMakeFiles/context.dir/rnnt_decode.cu.o
[ 55%] Building CUDA object k2/csrc/CMakeFiles/context.dir/tensor.cu.o
[ 57%] Building CUDA object k2/csrc/CMakeFiles/context.dir/tensor_ops.cu.o
[ 59%] Building CUDA object k2/csrc/CMakeFiles/context.dir/thread_pool.cu.o
[ 61%] Building CUDA object k2/csrc/CMakeFiles/context.dir/timer.cu.o
[ 61%] Building CUDA object k2/csrc/CMakeFiles/context.dir/top_sort.cu.o
[ 62%] Building CUDA object k2/csrc/CMakeFiles/context.dir/torch_util.cu.o
[ 64%] Building CUDA object k2/csrc/CMakeFiles/context.dir/utils.cu.o
[ 66%] Building CUDA object k2/csrc/CMakeFiles/context.dir/nbest.cu.o
[ 66%] Building CUDA object k2/csrc/CMakeFiles/context.dir/pytorch_context.cu.o
[ 67%] Building CUDA object k2/csrc/CMakeFiles/context.dir/cudpp/cudpp.cu.o
[ 69%] Linking CUDA device code CMakeFiles/context.dir/cmake_device_link.o
[ 71%] Linking CUDA shared library ../../lib/libk2context.so
[ 71%] Built target context
Scanning dependencies of target _k2
[ 71%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/k2.cu.o
[ 72%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch.cu.o
[ 74%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/version.cu.o
[ 76%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/arc.cu.o
[ 76%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/fsa.cu.o
[ 77%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/fsa_algo.cu.o
[ 79%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/index_add.cu.o
[ 81%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/index_select.cu.o
[ 81%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/mutual_information.cu.o
[ 83%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/mutual_information_cpu.cu.o
[ 84%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/nbest.cu.o
[ 86%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/ragged.cu.o
[ 88%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/ragged_ops.cu.o
[ 88%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/rnnt_decode.cu.o
[ 89%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/v2/any.cu.o
[ 91%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/v2/doc/doc.cu.o
[ 93%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/v2/k2.cu.o
[ 93%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/v2/ragged_any.cu.o
[ 94%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/v2/ragged_shape.cu.o
[ 96%] Building CUDA object k2/python/csrc/CMakeFiles/_k2.dir/torch/mutual_information_cuda.cu.o
[ 98%] Linking CUDA device code CMakeFiles/_k2.dir/cmake_device_link.o
[100%] Linking CUDA shared module ../../../lib/_k2.cpython-38-x86_64-linux-gnu.so
[100%] Built target _k2
[  1%] Built target k2_log
[ 25%] Built target fsa
[ 77%] Built target context
Scanning dependencies of target k2_torch
[ 79%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/beam_search.cu.o
[ 81%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/decode.cu.o
[ 83%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/dense_fsa_vec.cu.o
[ 83%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/deserialization.cu.o
[ 85%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/fsa_algo.cu.o
[ 87%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/fsa_class.cu.o
[ 88%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/hypothesis.cu.o
[ 90%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/nbest.cu.o
[ 90%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/parse_options.cu.o
[ 92%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/symbol_table.cu.o
[ 94%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/utils.cu.o
[ 96%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/wave_reader.cu.o
[ 96%] Linking CUDA shared library ../../../lib/libk2_torch.so
[ 96%] Built target k2_torch
Scanning dependencies of target k2_torch_api
[ 98%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch_api.dir/torch_api.cu.o
[100%] Linking CUDA shared library ../../../lib/libk2_torch_api.so
[100%] Built target k2_torch_api
[  1%] Built target k2_log
[ 15%] Built target fsa
[ 46%] Built target context
Scanning dependencies of target kaldifeat_core
[ 47%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-fbank.cc.o
[ 48%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-functions.cc.o
[ 59%] Built target k2_torch
[ 59%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-mfcc.cc.o
[ 78%] Built target _k2
[ 80%] Built target k2_torch_api
[ 81%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-plp.cc.o
[ 82%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-spectrogram.cc.o
[ 83%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/feature-window.cc.o
[ 83%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/matrix-functions.cc.o
[ 84%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/mel-computations.cc.o
[ 85%] Building CXX object _deps/kaldifeat-build/kaldifeat/csrc/CMakeFiles/kaldifeat_core.dir/online-feature.cc.o
[ 86%] Linking CXX shared library ../../../../lib/libkaldifeat_core.so
[ 86%] Built target kaldifeat_core
Scanning dependencies of target k2_fbank
[ 87%] Building CXX object k2/torch/csrc/CMakeFiles/k2_fbank.dir/features.cc.o
[ 89%] Linking CXX shared library ../../../lib/libk2_fbank.so
[ 89%] Built target k2_fbank
Scanning dependencies of target pruned_stateless_transducer
Scanning dependencies of target attention_rescore
Scanning dependencies of target online_decode
Scanning dependencies of target rnnt_demo
[ 90%] Building CUDA object k2/torch/bin/CMakeFiles/online_decode.dir/online_decode.cu.o
[ 91%] Building CUDA object k2/torch/bin/CMakeFiles/rnnt_demo.dir/rnnt_demo.cu.o
[ 92%] Building CUDA object k2/torch/bin/CMakeFiles/pruned_stateless_transducer.dir/pruned_stateless_transducer.cu.o
[ 93%] Building CUDA object k2/torch/bin/CMakeFiles/attention_rescore.dir/attention_rescore.cu.o
[ 93%] Linking CUDA executable ../../../bin/pruned_stateless_transducer
[ 94%] Linking CUDA executable ../../../bin/rnnt_demo
[ 95%] Linking CUDA executable ../../../bin/online_decode
[ 96%] Linking CUDA executable ../../../bin/attention_rescore
cmake_path: /usr/bin/cmake
For fast compilation, run:
export K2_MAKE_ARGS="-j"; python setup.py install
Setting make_args to '-j4'
Setting PYTHON_EXECUTABLE to /anaconda3/envs/k2-cu102/bin/python3
build command is:

                cd build/temp.linux-x86_64-cpython-38

                cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/anaconda3/envs/k2-cu102/bin/python3 -DK2_ENABLE_BENCHMARK=OFF  -DK2_ENABLE_TESTS=OFF  -DCMAKE_INSTALL_PREFIX=/tools2/k2_dev/build/lib.linux-x86_64-cpython-38/k2  /tools2/k2_dev

                cat k2/csrc/version.h

                make  -j4  _k2 k2_torch_api install
csukuangfj commented 1 year ago

Versions of relevant libraries: [pip3] k2==1.21.dev20221031+cuda11.6.torch1.12.0 [pip3] numpy==1.22.4 [pip3] torch==1.12.0+cu116

/usr/bin/ld: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib/libtorch_cuda_cpp.so: undefined reference to `cudaGraphRetainUserObject@libcudart.so.11.0'

 runtime library [libcublas.so.11] in /usr/local/cuda/lib64 may be hidden by files in:

/anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib runtime library [libcudnn.so.8] in /usr/local/cuda/lib64 may be hidden by files in: /anaconda3/envs/k2-cu102/lib/python3.8/site-packages/torch/lib

Do you have both cuda 11.6 and cuda 11.0 installed in your system?

kobenaxie commented 1 year ago

cuda 11.2 installed.

csukuangfj commented 1 year ago

cuda 11.2 installed.

I think cuda 11.2 is not supported by any released versions of PyTorch. Could you use the same version of cuda used by your installed PyTorch?

kobenaxie commented 1 year ago

Than I need to upgrade driver and cuda. But with the same config, I complied k2-1.21 successfully.

csukuangfj commented 1 year ago

If you can use cuda 11.2, then any versions below cuda 11.2 can also be used on your computer without changing your driver.

From your error logs, they show that you have multiple versions of cuda on your computer and the linker cannot find the correct one to link with.

kobenaxie commented 1 year ago

If you can use cuda 11.2, then any versions below cuda 11.2 can also be used on your computer without changing your driver.

From your error logs, they show that you have multiple versions of cuda on your computer and the linker cannot find the correct one to link with.

quit strange, Actually only cuda-11.2 installed on our sever.

kobenaxie commented 1 year ago

cuda 11.2 installed.

I think cuda 11.2 is not supported by any released versions of PyTorch. Could you use the same version of cuda used by your installed PyTorch?

Try on another sever with cuda 11.6 and torch-1.12.0-cuda11.6, but get error:

[ 81%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/fsa_class.cu.o
[ 83%] Building CUDA object k2/torch/csrc/CMakeFiles/k2_torch.dir/hypothesis.cu.o
In file included from /anaconda3/lib/python3.8/site-packages/torch/include/torch/csrc/jit/serialization/export.h:6,
                 from /anaconda3/lib/python3.8/site-packages/torch/include/torch/csrc/jit/serialization/import_source.h:12,
                 from /drive/A100-cuda-510.47.03/k2/k2/torch/csrc/deserialization.cu:31:
/anaconda3/lib/python3.8/site-packages/torch/include/torch/csrc/jit/serialization/export_bytecode.h:11:10: fatal error: torch/csrc/jit/mobile/function.h: No such file or directory
   11 | #include <torch/csrc/jit/mobile/function.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [k2/torch/csrc/CMakeFiles/k2_torch.dir/build.make:102: k2/torch/csrc/CMakeFiles/k2_torch.dir/deserialization.cu.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/Makefile2:656: k2/torch/csrc/CMakeFiles/k2_torch.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:607: k2/torch/csrc/CMakeFiles/k2_torch_api.dir/rule] Error 2
make: *** [Makefile:255: k2_torch_api] Error 2
Traceback (most recent call last):
  File "setup.py", line 233, in <module>
    setuptools.setup(
  File "/anaconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/anaconda3/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/anaconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/anaconda3/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 290, in run
    self.run_command('build')
  File "/anaconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/anaconda3/lib/python3.8/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/anaconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/anaconda3/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/anaconda3/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/anaconda3/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "setup.py", line 206, in build_extension
    raise Exception("Failed to build k2")
Exception: Failed to build k2
csukuangfj commented 1 year ago

Please run

cd /path/to/k2
python3 ./scripts/github_actions/fix_torch.py

That is a known issue for torch 1.12.x (https://github.com/pytorch/pytorch/issues/88290)

It happens only when you use mkdir build; cd build cmake ..; make. We will invoke the above fix automatically when you use python3 setup.py install.

kobenaxie commented 1 year ago

Ok, get skip , it seems in my installation, mobile_dir already exists, but empty. I will try to copy files manually

kobenaxie commented 1 year ago

Than I need to upgrade driver and cuda. But with the same config, I complied k2-1.21 successfully.

Under dirver:510.47.03, cuda:11.6, torch:1.12.0-cuda11.6, compile k2-dev1.22 successfully. Thanks @csukuangfj driver & cuda download from driver & cuda&cudnn.