Skip to content

Commit

Permalink
move c10/smh to %LIBRARY_PREFIX% as on unix; also asmjit/fbgemm; cons…
Browse files Browse the repository at this point in the history
…olidate lib testing
  • Loading branch information
h-vetinari committed Jan 22, 2025
1 parent eb8dc6f commit 851aae4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
4 changes: 2 additions & 2 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ if "%PKG_NAME%" == "libtorch" (

@REM Move the binaries into the packages site-package directory
@REM the only content of torch\bin, {asmjit,fbgemm}.dll, also exists in torch\lib
robocopy /NP /NFL /NDL /NJH /E torch\lib\ %LIBRARY_BIN%\ torch*.dll
robocopy /NP /NFL /NDL /NJH /E torch\lib\ %LIBRARY_LIB%\ torch*.lib
robocopy /NP /NFL /NDL /NJH /E torch\lib\ %LIBRARY_BIN%\ torch*.dll c10.dll shm.dll asmjit.dll fbgemm.dll
robocopy /NP /NFL /NDL /NJH /E torch\lib\ %LIBRARY_LIB%\ torch*.lib c10.lib shm.lib asmjit.lib fbgemm.lib
robocopy /NP /NFL /NDL /NJH /E torch\share\ %LIBRARY_PREFIX%\share
for %%f in (ATen caffe2 torch c10) do (
robocopy /NP /NFL /NDL /NJH /E torch\include\%%f %LIBRARY_INC%\%%f\
Expand Down
36 changes: 14 additions & 22 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,32 +192,24 @@ requirements:
# the global build stage, including tests
test:
commands:
# libraries
{% for each_lib in [ 'c10', 'shm', 'torch', 'torch_cpu', 'torch_global_deps'] %}
# libraries; peculiar formatting to avoid linter false positives about selectors
{% set torch_libs = [
"c10", "shm", "torch", "torch_cpu", "torch_global_deps"
] + (cuda_compiler_version != "None" and target_platform.startswith("linux")) * [
"c10_cuda", "caffe2_nvrtc", "torch_cuda_linalg"
] + (cuda_compiler_version != "None") * [
"torch_cuda"
] + target_platform.startswith("win") * [
"asmjit", "fbgemm"
]
%}
{% for each_lib in torch_libs %}
- test -f $PREFIX/lib/lib{{ each_lib }}.so # [linux]
- test -f $PREFIX/lib/lib{{ each_lib }}.dylib # [osx]
{% endfor %}
{% for each_lib in [ 'torch', 'torch_cpu', 'torch_global_deps'] %}
- if not exist %LIBRARY_BIN%\{{ each_lib }}.dll exit 1 # [win]
{% endfor %}

# Windows specific .LIB files
{% for each_lib in [ 'torch', 'torch_cpu'] %}
{% if each_lib != "torch_global_deps" %}
- if not exist %LIBRARY_LIB%\{{ each_lib }}.lib exit 1 # [win]
{% endfor %}

# Cuda only libraries
{% for each_lib in ['c10_cuda', 'caffe2_nvrtc', 'torch_cuda'] %}
- test -f $PREFIX/lib/lib{{ each_lib }}.so # [linux and cuda_compiler_version != "None"]
{% endfor %}
{% for each_lib in ['torch_cuda'] %}
- if not exist %LIBRARY_BIN%\{{ each_lib }}.dll exit 1 # [win and cuda_compiler_version != "None"]
- if not exist %LIBRARY_LIB%\{{ each_lib }}.lib exit 1 # [win and cuda_compiler_version != "None"]
{% endfor %}

# Linux specific cuda libraries
{% for each_lib in [ 'torch_cuda_linalg'] %}
- test -f $PREFIX/lib/lib{{ each_lib }}.so # [linux and cuda_compiler_version != "None"]
{% endif %}
{% endfor %}

# CMake files in share
Expand Down

0 comments on commit 851aae4

Please sign in to comment.