Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Oct 9, 2023
1 parent 1224802 commit 697255c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
./scripts/github_actions/fix_torch.sh
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake -DCUDAToolkit_TARGET_DIR=$CUDA_HOME/targets/x86_64-linux -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cat k2/csrc/version.h
- name: ${{ matrix.build_type }} Build
Expand Down
5 changes: 5 additions & 0 deletions cmake/select_compute_arch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ endif()
# This list is used to filter CUDA archs when autodetecting
set(CUDA_ALL_GPU_ARCHITECTURES "3.5" "5.0")

if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
list(REMOVE_ITEM CUDA_COMMON_GPU_ARCHITECTURES "3.5")
list(REMOVE_ITEM CUDA_ALL_GPU_ARCHITECTURES "3.5")
endif()

if(CUDA_VERSION VERSION_GREATER "6.5")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Kepler+Tegra" "Kepler+Tesla" "Maxwell+Tegra")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2")
Expand Down
15 changes: 15 additions & 0 deletions cmake/torch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,22 @@ find_package(Torch REQUIRED)
# k2 uses the same abi flag as PyTorch
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
if(K2_WITH_CUDA)
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
string(REPLACE " " ";" MY_LIST ${CMAKE_CUDA_FLAGS})
set(TEMP_LIST)
foreach(f IN LISTS MY_LIST)
if(f STREQUAL arch=compute_35,code=sm_35)
list(REMOVE_AT TEMP_LIST -1)
continue()
endif()
list(APPEND TEMP_LIST ${f})
endforeach()

string(REPLACE ";" " " CMAKE_CUDA_FLAGS "${TEMP_LIST}")
endif()

set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${TORCH_CXX_FLAGS}")
message(WARNING " CMAKE_CUDA_FLAGS is ${CMAKE_CUDA_FLAGS}")
endif()


Expand Down
4 changes: 4 additions & 0 deletions docs/source/installation/cuda-cudnn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -661,13 +661,17 @@ and use ``source activate-cuda-12.1.sh`` if you want to activate CUDA 12.1.
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_HOME/extras/CUPTI/lib64:$LD_LIBRARY_PATH
export CUDAToolkit_ROOT_DIR=$CUDA_HOME
export CUDAToolkit_ROOT=$CUDA_HOME
export CUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME
export CUDA_TOOLKIT_ROOT=$CUDA_HOME
export CUDA_BIN_PATH=$CUDA_HOME
export CUDA_PATH=$CUDA_HOME
export CUDA_INC_PATH=$CUDA_HOME/targets/x86_64-linux
export CFLAGS=-I$CUDA_HOME/targets/x86_64-linux/include:$CFLAGS
export CUDAToolkit_TARGET_DIR=$CUDA_HOME/targets/x86_64-linux
To check that you have installed CUDA 12.1 successfully, please run:

Expand Down
2 changes: 1 addition & 1 deletion scripts/github_actions/build-ubuntu-cuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ yum clean all >/dev/null 2>&1
cd /var/www

export CMAKE_CUDA_COMPILER_LAUNCHER=
export K2_CMAKE_ARGS=" -DPYTHON_EXECUTABLE=$PYTHON_INSTALL_DIR/bin/python3 "
export K2_CMAKE_ARGS="-DCUDAToolkit_TARGET_DIR=/usr/local/cuda/targets/x86_64-linux -DPYTHON_EXECUTABLE=$PYTHON_INSTALL_DIR/bin/python3 "
export K2_MAKE_ARGS=" -j2 "

python3 setup.py bdist_wheel
Expand Down

0 comments on commit 697255c

Please sign in to comment.