diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index ea8ae90..6a7402c 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -1,4 +1,4 @@ -name: build +name: build-windows-cpu on: push: @@ -16,8 +16,10 @@ jobs: fail-fast: false matrix: os: [windows-2019] - torch: ["1.6.0", "1.7.0", "1.7.1", "1.8.0", "1.8.1", "1.9.0", "1.10.0", "1.11.0"] - python-version: [3.6, 3.7, 3.8, 3.9] + # torch: ["1.6.0", "1.7.0", "1.7.1", "1.8.0", "1.8.1", "1.9.0", "1.10.0", "1.11.0"] + # python-version: [3.6, 3.7, 3.8, 3.9] + torch: ["1.10.0", "1.11.0"] + python-version: [3.8] steps: - uses: actions/checkout@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index f594460..380338b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,5 +57,17 @@ configure_file( ${CMAKE_SOURCE_DIR}/kaldifeat/python/kaldifeat/torch_version.py @ONLY ) +if(WIN32) + # disable various warnings for MSVC + # 4624: destructor was implicitly defined as deleted because a base class destructor is inaccessible or deleted + set(disabled_warnings + /wd4624 + ) + message(STATUS "Disabled warnings: ${disabled_warnings}") + foreach(w IN LISTS disabled_warnings) + string(APPEND CMAKE_CXX_FLAGS " ${w} ") + endforeach() +endif() + include_directories(${CMAKE_SOURCE_DIR}) add_subdirectory(kaldifeat) diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index 8bd21ca..0d14815 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -128,3 +128,11 @@ class BuildExtension(build_ext): for so in lib_so: print(f"Copying {so} to {self.build_lib}/") shutil.copy(f"{so}", f"{self.build_lib}/") + + print( + f"Copying {kaldifeat_dir}/kaldifeat/python/kaldifeat/torch_version.py to {self.build_lib}/kaldifeat" # noqa + ) + shutil.copy( + f"{kaldifeat_dir}/kaldifeat/python/kaldifeat/torch_version.py", + f"{self.build_lib}/kaldifeat", + ) diff --git a/kaldifeat/csrc/CMakeLists.txt b/kaldifeat/csrc/CMakeLists.txt index 39f2c1c..9900b96 100644 --- a/kaldifeat/csrc/CMakeLists.txt +++ b/kaldifeat/csrc/CMakeLists.txt @@ -31,9 +31,15 @@ function(kaldifeat_add_test source) gtest_main ) + # NOTE: We set the working directory here so that + # it works also on windows. The reason is that + # the required DLLs are inside ${TORCH_DIR}/lib + # and they can be found by the exe if the current + # working directory is ${TORCH_DIR}\lib add_test(NAME "Test.${name}" COMMAND $ + WORKING_DIRECTORY ${TORCH_DIR}/lib ) endfunction() @@ -47,4 +53,5 @@ if(kaldifeat_BUILD_TESTS) foreach(source IN LISTS test_srcs) kaldifeat_add_test(${source}) endforeach() + endif() diff --git a/scripts/github_actions/install_cuda.sh b/scripts/github_actions/install_cuda.sh index 7d023b9..b84de89 100755 --- a/scripts/github_actions/install_cuda.sh +++ b/scripts/github_actions/install_cuda.sh @@ -36,6 +36,13 @@ case "$cuda" in # url=https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run url=https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run ;; + 11.3) + # url=https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux.run + url=https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux.run + ;; + 11.5) + url=https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda_11.5.2_495.29.05_linux.run + ;; *) echo "Unknown cuda version: $cuda" exit 1 diff --git a/scripts/github_actions/install_cudnn.sh b/scripts/github_actions/install_cudnn.sh index 853eba5..8feafbe 100755 --- a/scripts/github_actions/install_cudnn.sh +++ b/scripts/github_actions/install_cudnn.sh @@ -17,42 +17,43 @@ case $cuda in 10.0) filename=cudnn-10.0-linux-x64-v7.6.5.32.tgz - url=http://www.mediafire.com/file/1037lb1vmj9qdtq/cudnn-10.0-linux-x64-v7.6.5.32.tgz/file ;; 10.1) filename=cudnn-10.1-linux-x64-v8.0.2.39.tgz - url=http://www.mediafire.com/file/fnl2wg0h757qhd7/cudnn-10.1-linux-x64-v8.0.2.39.tgz/file ;; 10.2) filename=cudnn-10.2-linux-x64-v8.0.2.39.tgz - url=http://www.mediafire.com/file/sc2nvbtyg0f7ien/cudnn-10.2-linux-x64-v8.0.2.39.tgz/file ;; 11.0) filename=cudnn-11.0-linux-x64-v8.0.5.39.tgz - url=https://www.mediafire.com/file/abyhnls106ko9kp/cudnn-11.0-linux-x64-v8.0.5.39.tgz/file ;; 11.1) - filename=cudnn-11.1-linux-x64-v8.0.5.39.tgz - url=https://www.mediafire.com/file/qx55zd65773xonv/cudnn-11.1-linux-x64-v8.0.5.39.tgz/file + filename=cudnn-11.1-linux-x64-v8.0.4.30.tgz ;; + 11.3) + filename=cudnn-11.3-linux-x64-v8.2.0.53.tgz + ;; + 11.5) + filename=cudnn-11.3-linux-x64-v8.2.0.53.tgz + ;; + # 11.5) + # filename=cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive.tar.xz + # ;; *) echo "Unsupported cuda version: $cuda" exit 1 ;; esac -function retry() { - $* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*) -} +command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nPlease install 'git-lfs' first."; exit 2; } -# It is forked from https://github.com/Juvenal-Yescas/mediafire-dl -# https://github.com/Juvenal-Yescas/mediafire-dl/pull/2 changes the filename and breaks the CI. -# We use a separate fork to keep the link fixed. -retry wget https://raw.githubusercontent.com/csukuangfj/mediafire-dl/master/mediafire_dl.py +git clone https://huggingface.co/csukuangfj/cudnn +cd cudnn +git lfs pull --include="$filename" -sed -i 's/quiet=False/quiet=True/' mediafire_dl.py -retry python3 mediafire_dl.py "$url" -sudo tar xf ./$filename -C /usr/local -rm -v ./$filename +sudo tar xf ./$filename --strip-components=1 -C /usr/local/cuda + +# save disk space +git lfs prune && cd .. && rm -rf cudnn sudo sed -i '59i#define CUDNN_MAJOR 8' /usr/local/cuda/include/cudnn.h diff --git a/scripts/github_actions/install_torch.sh b/scripts/github_actions/install_torch.sh index 3ad1717..ed813c5 100755 --- a/scripts/github_actions/install_torch.sh +++ b/scripts/github_actions/install_torch.sh @@ -78,7 +78,7 @@ case ${torch} in ;; esac ;; - 1.9.0) + 1.9.*) case ${cuda} in 10.2) package="torch==${torch}" @@ -91,6 +91,40 @@ case ${torch} in ;; esac ;; + 1.10.*) + case ${cuda} in + 10.2) + package="torch==${torch}" + # Leave it empty to use PyPI. + url= + ;; + 11.1) + package="torch==${torch}+cu111" + url=https://download.pytorch.org/whl/torch_stable.html + ;; + 11.3) + package="torch==${torch}+cu113" + url=https://download.pytorch.org/whl/torch_stable.html + ;; + esac + ;; + 1.11.*) + case ${cuda} in + 10.2) + package="torch==${torch}" + # Leave it empty to use PyPI. + url= + ;; + 11.3) + package="torch==${torch}+cu113" + url=https://download.pytorch.org/whl/torch_stable.html + ;; + 11.5) + package="torch==${torch}+cu115" + url=https://download.pytorch.org/whl/torch_stable.html + ;; + esac + ;; *) echo "Unsupported PyTorch version: ${torch}" exit 1