diff --git a/windows/build_pytorch.bat b/windows/build_pytorch.bat index cd231d9a6..750d3c5e3 100644 --- a/windows/build_pytorch.bat +++ b/windows/build_pytorch.bat @@ -63,6 +63,11 @@ echo "Failed to create conda env" exit /B 1 :done + +:: Install MKL +rmdir /s /q mkl +del mkl_2020.2.254.7z + :: Download MAGMA Files on CUDA builds set MAGMA_VERSION=2.5.4 @@ -117,7 +122,7 @@ for %%v in (%DESIRED_PYTHON_PREFIX%) do ( ) else ( set "PATH=%CONDA_HOME%\envs\%%v;%CONDA_HOME%\envs\%%v\scripts;%CONDA_HOME%\envs\%%v\Library\bin;%ORIG_PATH%" ) - pip install ninja + pip install ninja mkl-include==2021.4.0 mkl-devel==2021.4.0 @setlocal :: Set Flags if not "%CUDA_VERSION%"=="cpu" ( diff --git a/windows/condaenv.bat b/windows/condaenv.bat index 7fb9c1a02..40e30f644 100644 --- a/windows/condaenv.bat +++ b/windows/condaenv.bat @@ -9,12 +9,12 @@ FOR %%v IN (%DESIRED_PYTHON%) DO ( set PYTHON_VERSION_STR=%%v set PYTHON_VERSION_STR=!PYTHON_VERSION_STR:.=! conda remove -n py!PYTHON_VERSION_STR! --all -y || rmdir %CONDA_HOME%\envs\py!PYTHON_VERSION_STR! /s - if "%%v" == "3.8" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=1.11 pyyaml boto3 cmake ninja typing_extensions python=%%v - if "%%v" == "3.9" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy>=1.11 pyyaml boto3 cmake ninja typing_extensions python=%%v - if "%%v" == "3.10" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.21.3 pyyaml boto3 cmake ninja typing_extensions python=%%v - if "%%v" == "3.11" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.23.4 pyyaml boto3 cmake ninja typing_extensions python=%%v - if "%%v" == "3.12" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.26.0 pyyaml boto3 cmake ninja typing_extensions python=%%v - if "%%v" == "3.13" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.26.0 pyyaml boto3 cmake ninja typing_extensions python=%%v + if "%%v" == "3.8" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=1.11 "mkl=2020.2" pyyaml boto3 cmake ninja typing_extensions python=%%v + if "%%v" == "3.9" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy>=1.11 "mkl=2020.2" pyyaml boto3 cmake ninja typing_extensions python=%%v + if "%%v" == "3.10" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.21.3 "mkl=2020.2" intel-openmp=2023.2.0 pyyaml boto3 "cmake=3.19.6" ninja typing_extensions python=%%v + if "%%v" == "3.11" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.23.4 "mkl=2020.2" intel-openmp=2023.2.0 pyyaml boto3 "cmake=3.19.6" ninja typing_extensions python=%%v + if "%%v" == "3.12" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.26.0 "mkl=2023.1" intel-openmp=2023.2.0 pyyaml boto3 "cmake=3.19.6" ninja typing_extensions python=%%v + if "%%v" == "3.13" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.26.0 "mkl=2023.1" intel-openmp=2023.2.0 pyyaml boto3 "cmake=3.19.6" ninja typing_extensions python=%%v call conda run -n py!PYTHON_VERSION_STR! pip install mkl-include call conda run -n py!PYTHON_VERSION_STR! pip install mkl-static ) diff --git a/windows/internal/check_deps.bat b/windows/internal/check_deps.bat index 72e2bd6e7..5e1f58e35 100755 --- a/windows/internal/check_deps.bat +++ b/windows/internal/check_deps.bat @@ -65,7 +65,7 @@ if %PYVER% LSS 35 ( echo Warning: PyTorch for Python 2 under Windows is experimental. echo Python x64 3.5 or up is recommended to compile PyTorch on Windows echo Maybe you can create a virual environment if you have conda installed: - echo ^> conda create -n test python=3.6 pyyaml numpy + echo ^> conda create -n test python=3.6 pyyaml mkl numpy echo ^> activate test ) diff --git a/windows/internal/copy.bat b/windows/internal/copy.bat index b2d078944..9893fc7c5 100755 --- a/windows/internal/copy.bat +++ b/windows/internal/copy.bat @@ -11,7 +11,10 @@ copy "%CUDA_PATH%\extras\CUPTI\lib64\cupti64_*.dll*" pytorch\torch\lib copy "C:\Program Files\NVIDIA Corporation\NvToolsExt\bin\x64\nvToolsExt64_1.dll*" pytorch\torch\lib copy "%CONDA_LIB_PATH%\libiomp*5md.dll" pytorch\torch\lib - +IF "%PACKAGE_TYPE%"=="libtorch" ( + copy "%CONDA_LIB_PATH%\mkl_intel_thread.1.dll" pytorch\torch\lib + copy "%CONDA_LIB_PATH%\mkl_core.1.dll" pytorch\torch\lib +) :: Should be set in build_pytorch.bat copy "%libuv_ROOT%\bin\uv.dll" pytorch\torch\lib diff --git a/windows/internal/copy_cpu.bat b/windows/internal/copy_cpu.bat index 864180d85..0a4c0dabb 100755 --- a/windows/internal/copy_cpu.bat +++ b/windows/internal/copy_cpu.bat @@ -1,3 +1,8 @@ copy "%CONDA_LIB_PATH%\libiomp*5md.dll" pytorch\torch\lib :: Should be set in build_pytorch.bat -copy "%libuv_ROOT%\bin\uv.dll" pytorch\torch\lib \ No newline at end of file +copy "%libuv_ROOT%\bin\uv.dll" pytorch\torch\lib + +IF "%PACKAGE_TYPE%"=="libtorch" ( + copy "%CONDA_LIB_PATH%\mkl_intel_thread.1.dll" pytorch\torch\lib + copy "%CONDA_LIB_PATH%\mkl_core.1.dll" pytorch\torch\lib +) diff --git a/windows/internal/static_lib_test.bat b/windows/internal/static_lib_test.bat index 2335ce0b3..aa15dd68f 100644 --- a/windows/internal/static_lib_test.bat +++ b/windows/internal/static_lib_test.bat @@ -70,6 +70,11 @@ echo "install and test libtorch" pip install cmake echo "installing cmake" +curl https://s3.amazonaws.com/ossci-windows/mkl_2020.2.254.7z -k -O +7z x -aoa mkl_2020.2.254.7z -omkl +set LIB=%CD%\mkl\lib;%LIB% + + if "%VC_YEAR%" == "2019" powershell internal\vs2019_install.ps1 if "%VC_YEAR%" == "2022" powershell internal\vs2022_install.ps1