-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pkg 6001 win #52
Pkg 6001 win #52
Changes from 27 commits
6392ecb
5cb7864
72bacd7
fb490d4
618fbd3
74258de
2781c34
177e4a2
5fd2413
f163074
325177c
3a1044c
d6e5b8f
ac741b2
a4c7fb1
f3d270c
6a25649
6a7ebc1
fc109ce
e17fbc2
14bf984
121378a
ed9022b
7b53796
e02b47d
7bfde6d
58b281e
fe50aa4
0662f6a
a3d51b2
c3cb07a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
@echo On | ||
setlocal enabledelayedexpansion | ||
|
||
:: The PyTorch test suite includes some symlinks, which aren't resolved on Windows, leading to packaging errors. | ||
:: ATTN! These change and have to be updated manually, often with each release. | ||
:: (no current symlinks being packaged. Leaving this information here as it took some months to find the issue. Look out | ||
:: for a failure with error message: "conda_package_handling.exceptions.ArchiveCreationError: <somefile> Cannot stat | ||
:: while writing file") | ||
|
||
set TH_BINARY_BUILD=1 | ||
set PYTORCH_BUILD_VERSION=%PKG_VERSION% | ||
set PYTORCH_BUILD_NUMBER=%PKG_BUILDNUM% | ||
|
||
|
@@ -21,6 +21,12 @@ if "%pytorch_variant%" == "gpu" ( | |
set USE_CUDA=0 | ||
) | ||
|
||
:: KINETO seems to require CUPTI and will look quite hard for it. | ||
:: CUPTI seems to cause trouble when users install a version of | ||
:: cudatoolkit different than the one specified at compile time. | ||
:: https://github.com/conda-forge/pytorch-cpu-feedstock/issues/135 | ||
set "USE_KINETO=OFF" | ||
|
||
:: =============================== CUDA FLAGS> ====================================== | ||
if "%build_with_cuda%" == "" goto cuda_flags_end | ||
|
||
|
@@ -41,6 +47,7 @@ set USE_MKLDNN=1 | |
set USE_TENSORPIPE=0 | ||
set DISTUTILS_USE_SDK=1 | ||
set BUILD_TEST=0 | ||
set INSTALL_TEST=0 | ||
:: Don't increase MAX_JOBS to NUMBER_OF_PROCESSORS, as it will run out of heap | ||
set CPU_COUNT=1 | ||
set MAX_JOBS=%CPU_COUNT% | ||
|
@@ -64,9 +71,12 @@ set CUDNN_INCLUDE_DIR=%LIBRARY_PREFIX%\include | |
:: =============================== CUDA< ====================================== | ||
|
||
set CMAKE_GENERATOR=Ninja | ||
set "CMAKE_GENERATOR_TOOLSET=" | ||
set "CMAKE_GENERATOR_PLATFORM=" | ||
set "CMAKE_PREFIX_PATH=%LIBRARY_PREFIX%" | ||
set CMAKE_BUILD_TYPE=Release | ||
set "CMAKE_INCLUDE_PATH=%LIBRARY_INC%" | ||
set "CMAKE_LIBRARY_PATH=%LIBRARY_LIB%" | ||
set "CMAKE_BUILD_TYPE=Release" | ||
:: This is so that CMake finds the environment's Python, not another one | ||
set Python_EXECUTABLE=%PYTHON% | ||
set Python3_EXECUTABLE=%PYTHON% | ||
|
@@ -81,10 +91,45 @@ set BLAS=MKL | |
set INTEL_MKL_DIR=%LIBRARY_PREFIX% | ||
|
||
set "libuv_ROOT=%LIBRARY_PREFIX%" | ||
set "USE_SYSTEM_SLEEF=OFF" | ||
:: Note that BUILD_CUSTOM_PROTOBUF=OFF (which would use our protobuf) doesn't work properly as of last testing, and results in | ||
:: duplicate symbols at link time. | ||
:: set "BUILD_CUSTOM_PROTOBUF=OFF" | ||
set "USE_SYSTEM_SLEEF=ON" | ||
|
||
:: Use our protobuf | ||
set "BUILD_CUSTOM_PROTOBUF=OFF" | ||
set "USE_LITE_PROTO=ON" | ||
|
||
:: Here we split the build into two parts. | ||
:: | ||
:: Both the packages libtorch and pytorch use this same build script. | ||
:: - The output of the libtorch package should just contain the binaries that are | ||
:: not related to Python. | ||
:: - The output of the pytorch package contains everything except for the | ||
:: non-python specific binaries. | ||
:: | ||
:: This ensures that a user can quickly switch between python versions without the | ||
:: need to redownload all the large CUDA binaries. | ||
|
||
if "%PKG_NAME%" == "libtorch" ( | ||
:: For the main script we just build a wheel for libtorch so that the C++/CUDA | ||
:: parts are built. Then they are reused in each python version. | ||
set BUILD_LIBTORCH_WHL=1 | ||
set BUILD_PYTHON_ONLY=0 | ||
|
||
%PYTHON% setup.py bdist_wheel | ||
%PYTHON% -m pip install --find-links=dist torch_no_python --no-build-isolation --no-deps | ||
|
||
:: building libtorch generates an empty __init__.py file. We don't want to package that, it should come from pytorch. | ||
rm %SP_DIR%\torch\__init__.py | ||
) else ( | ||
set BUILD_LIBTORCH_WHL=0 | ||
:: In theory we want BUILD_PYTHON_ONLY=1 but that ends up causing lots of linking problems. | ||
:: set BUILD_PYTHON_ONLY=1 | ||
|
||
:: NOTE: Passing --cmake is necessary here since the torch frontend has it's | ||
ELundby45 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
:: own cmake files that it needs to generate | ||
cmake -DPython_EXECUTABLE="%PYTHON%" --build build --target clean | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure about this. you seem to be mixing setting a configuration variable and running a build step. Try removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I brought that over straight from the conda-forge PR. I'll try removing the The https://github.com/pytorch/pytorch/blob/main/setup.py#L874-L892 |
||
%PYTHON% setup.py bdist_wheel --cmake | ||
%PYTHON% -m pip install --find-links=dist torch --no-build-isolation --no-deps | ||
) | ||
|
||
%PYTHON% -m pip install . --no-deps --no-build-isolation -vv | ||
if errorlevel 1 exit /b 1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
@echo On | ||
setlocal enabledelayedexpansion | ||
|
||
call %RECIPE_DIR%\bld.bat | ||
if errorlevel 1 exit /b 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like there might be some patching/contribution upstream to do? also with the linking problems