mirror of
https://github.com/csukuangfj/kaldifeat.git
synced 2025-08-11 11:02:27 +00:00
Merge pull request #34 from csukuangfj/fix-windows
Fix build on windows
This commit is contained in:
commit
0348fda69f
8
.github/workflows/build_windows.yml
vendored
8
.github/workflows/build_windows.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: build
|
name: build-windows-cpu
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -16,8 +16,10 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-2019]
|
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"]
|
# 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]
|
# python-version: [3.6, 3.7, 3.8, 3.9]
|
||||||
|
torch: ["1.10.0", "1.11.0"]
|
||||||
|
python-version: [3.8]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -57,5 +57,17 @@ configure_file(
|
|||||||
${CMAKE_SOURCE_DIR}/kaldifeat/python/kaldifeat/torch_version.py @ONLY
|
${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})
|
include_directories(${CMAKE_SOURCE_DIR})
|
||||||
add_subdirectory(kaldifeat)
|
add_subdirectory(kaldifeat)
|
||||||
|
@ -128,3 +128,11 @@ class BuildExtension(build_ext):
|
|||||||
for so in lib_so:
|
for so in lib_so:
|
||||||
print(f"Copying {so} to {self.build_lib}/")
|
print(f"Copying {so} to {self.build_lib}/")
|
||||||
shutil.copy(f"{so}", f"{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",
|
||||||
|
)
|
||||||
|
@ -31,9 +31,15 @@ function(kaldifeat_add_test source)
|
|||||||
gtest_main
|
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}"
|
add_test(NAME "Test.${name}"
|
||||||
COMMAND
|
COMMAND
|
||||||
$<TARGET_FILE:${name}>
|
$<TARGET_FILE:${name}>
|
||||||
|
WORKING_DIRECTORY ${TORCH_DIR}/lib
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -47,4 +53,5 @@ if(kaldifeat_BUILD_TESTS)
|
|||||||
foreach(source IN LISTS test_srcs)
|
foreach(source IN LISTS test_srcs)
|
||||||
kaldifeat_add_test(${source})
|
kaldifeat_add_test(${source})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -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.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
|
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"
|
echo "Unknown cuda version: $cuda"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -17,42 +17,43 @@
|
|||||||
case $cuda in
|
case $cuda in
|
||||||
10.0)
|
10.0)
|
||||||
filename=cudnn-10.0-linux-x64-v7.6.5.32.tgz
|
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)
|
10.1)
|
||||||
filename=cudnn-10.1-linux-x64-v8.0.2.39.tgz
|
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)
|
10.2)
|
||||||
filename=cudnn-10.2-linux-x64-v8.0.2.39.tgz
|
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)
|
11.0)
|
||||||
filename=cudnn-11.0-linux-x64-v8.0.5.39.tgz
|
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)
|
11.1)
|
||||||
filename=cudnn-11.1-linux-x64-v8.0.5.39.tgz
|
filename=cudnn-11.1-linux-x64-v8.0.4.30.tgz
|
||||||
url=https://www.mediafire.com/file/qx55zd65773xonv/cudnn-11.1-linux-x64-v8.0.5.39.tgz/file
|
|
||||||
;;
|
;;
|
||||||
|
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"
|
echo "Unsupported cuda version: $cuda"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
function retry() {
|
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nPlease install 'git-lfs' first."; exit 2; }
|
||||||
$* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)
|
|
||||||
}
|
|
||||||
|
|
||||||
# It is forked from https://github.com/Juvenal-Yescas/mediafire-dl
|
git clone https://huggingface.co/csukuangfj/cudnn
|
||||||
# https://github.com/Juvenal-Yescas/mediafire-dl/pull/2 changes the filename and breaks the CI.
|
cd cudnn
|
||||||
# We use a separate fork to keep the link fixed.
|
git lfs pull --include="$filename"
|
||||||
retry wget https://raw.githubusercontent.com/csukuangfj/mediafire-dl/master/mediafire_dl.py
|
|
||||||
|
|
||||||
sed -i 's/quiet=False/quiet=True/' mediafire_dl.py
|
sudo tar xf ./$filename --strip-components=1 -C /usr/local/cuda
|
||||||
retry python3 mediafire_dl.py "$url"
|
|
||||||
sudo tar xf ./$filename -C /usr/local
|
# save disk space
|
||||||
rm -v ./$filename
|
git lfs prune && cd .. && rm -rf cudnn
|
||||||
|
|
||||||
sudo sed -i '59i#define CUDNN_MAJOR 8' /usr/local/cuda/include/cudnn.h
|
sudo sed -i '59i#define CUDNN_MAJOR 8' /usr/local/cuda/include/cudnn.h
|
||||||
|
@ -78,7 +78,7 @@ case ${torch} in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
1.9.0)
|
1.9.*)
|
||||||
case ${cuda} in
|
case ${cuda} in
|
||||||
10.2)
|
10.2)
|
||||||
package="torch==${torch}"
|
package="torch==${torch}"
|
||||||
@ -91,6 +91,40 @@ case ${torch} in
|
|||||||
;;
|
;;
|
||||||
esac
|
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}"
|
echo "Unsupported PyTorch version: ${torch}"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user