-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathmeta.yaml
391 lines (374 loc) · 17.3 KB
/
meta.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
{% set version = "2.5.1" %}
{% set build = 8 %}
{% if cuda_compiler_version != "None" %}
{% set build = build + 200 %}
{% endif %}
{% if blas_impl == "mkl" %}
{% set build = build + 100 %}
{% endif %}
# see .ci/docker/ci_commit_pins/triton.txt
# pytorch and triton are released in tandem, see notes in their release process
# https://github.com/pytorch/pytorch/blob/main/RELEASE.md#triton-dependency-for-the-release
{% set triton = "3.1.0" %}
package:
name: libtorch
version: {{ version }}
source:
url: https://github.com/pytorch/pytorch/releases/download/v{{ version }}/pytorch-v{{ version }}.tar.gz
sha256: 740eb5fff95e33cfe699bad43be83523f569c7cc7f9c285c2a255416443dd266
patches:
- patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch
# https://github.com/pytorch/pytorch/pull/137084
- patches/0002-Help-find-numpy.patch
# https://github.com/pytorch/pytorch/pull/138287
- patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch
# sympy 1.13.2 was reported to result in test failures on Windows and mac
# https://github.com/pytorch/pytorch/pull/133235
- patches/0004-Update-sympy-version.patch
- patches/0005-Fix-duplicate-linker-script.patch # [cuda_compiler_version != "None" and aarch64]
# https://github.com/pytorch/pytorch/pull/136034
- patches/0006-3.13-fix-3.13-pickle-error-in-serialization.py-13603.patch
# https://github.com/pytorch/pytorch/pull/137331
- patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch
# conda-specific patch, upstream force-disables libcufile w/ TH_BINARY_BUILD
# for their PyPI wheel builds
- patches/0008-Allow-libcufile-for-conda-builds.patch
# conda-specific patch, lets us override CUDA paths
- patches/0009-Allow-overriding-CUDA-related-paths.patch
# NumPy 2 fixes:
# https://github.com/pytorch/pytorch/pull/136800
- patches/0010-Fix-test-test_linalg.py-for-NumPy-2-136800.patch
# https://github.com/pytorch/pytorch/pull/137740
- patches/0011-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch
# fix BLAS calling convention for openblas
- patches/0013-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch
# fix mkl-2024 issue
# https://github.com/pytorch/pytorch/pull/143894
- patches/0014-fix-issue-142484.patch
build:
number: {{ build }}
skip: true # [win]
# cuda 11.8 was dropped due to maintenance effort, see discussion in #177
skip: true # [cuda_compiler_version == "11.8"]
string: cuda{{ cuda_compiler_version | replace('.', '') }}_{{ blas_impl }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"]
string: cpu_{{ blas_impl }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"]
detect_binary_files_with_prefix: false
run_exports:
- {{ pin_subpackage('libtorch', max_pin='x.x') }}
ignore_run_exports_from:
- python * # [megabuild]
- numpy * # [megabuild]
- cross-python_{{ target_platform }} # [megabuild and build_platform != target_platform]
ignore_run_exports:
- python * # [megabuild]
- numpy * # [megabuild]
- libmagma_sparse
requirements:
# Keep this list synchronized (except for python*, numpy*) in outputs
# We use python to build libtorch as well because it is easier
build:
# When you change 3.12 here, change it in build.sh as well
- python 3.12 # [megabuild and build_platform != target_platform]
- python # [not megabuild and build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- numpy * # [megabuild and build_platform != target_platform]
- numpy # [not megabuild and build_platform != target_platform]
- {{ stdlib('c') }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} # [cuda_compiler_version != "None"]
- libgomp # [linux]
- llvm-openmp # [osx]
- cmake
- ninja
# Keep libprotobuf here so that a compatibile version
# of protobuf is installed between build and host
- libprotobuf
- protobuf
- make # [linux]
host:
# GPU requirements
- cudnn # [cuda_compiler_version != "None"]
- nccl # [cuda_compiler_version != "None"]
- magma # [cuda_compiler_version != "None"]
- cuda-version {{ cuda_compiler_version }} # [cuda_compiler_version != "None"]
- nvtx-c # [cuda_compiler_version != "None"]
{% if cuda_compiler_version != "None" %}
- cuda-driver-dev
- cuda-cudart-dev
- cuda-nvrtc-dev
- cuda-nvtx-dev
- cuda-nvml-dev
- cuda-profiler-api
- cusparselt
- libcublas-dev
- libcudss-dev
- libcufile-dev
- libcufft-dev
- libcurand-dev
- libcusolver-dev
- libcusparse-dev
{% endif %}
# other requirements
- python 3.12 # [megabuild]
- python # [not megabuild]
- numpy * # [megabuild]
- numpy # [not megabuild]
- pip
- setuptools
- pyyaml
- requests
- six
- mkl-devel {{ mkl }} # [blas_impl == "mkl"]
- libcblas * *_mkl # [blas_impl == "mkl"]
- libcblas # [blas_impl != "mkl"]
- liblapack # [blas_impl != "mkl"]
- libgomp # [linux]
- llvm-openmp # [osx]
- libabseil
- libprotobuf
- sleef
- libuv
- pkg-config # [unix]
- typing_extensions
run:
# GPU requirements without run_exports
- {{ pin_compatible('cudnn') }} # [cuda_compiler_version != "None"]
run_constrained:
# These constraints ensure conflict between pytorch and
# pytorch-cpu 1.1 which we built before conda-forge had GPU infrastructure
# built into place.
# https://github.com/conda-forge/pytorch-cpu-feedstock/issues/65
- pytorch-cpu =={{ version }} # [cuda_compiler_version == "None"]
- pytorch-gpu ==99999999 # [cuda_compiler_version == "None"]
- pytorch-gpu =={{ version }} # [cuda_compiler_version != "None"]
- pytorch-cpu ==99999999 # [cuda_compiler_version != "None"]
- pytorch {{ version }} cuda{{ cuda_compiler_version | replace('.', '') }}_{{ blas_impl }}_*_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"]
- pytorch {{ version }} cpu_{{ blas_impl }}_*_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"]
test:
commands:
# libraries
{% for each_lib in [ 'libc10', 'libshm', 'libtorch', 'libtorch_cpu', 'libtorch_global_deps'] %}
- test -f $PREFIX/lib/{{ each_lib }}.so # [linux]
- test -f $PREFIX/lib/{{ each_lib }}.dylib # [osx]
{% endfor %}
{% for each_lib in ['libc10_cuda', 'libcaffe2_nvrtc', 'libtorch_cuda', 'libtorch_cuda_linalg'] %}
- test -f $PREFIX/lib/{{ each_lib }}.so # [linux and cuda_compiler_version != "None"]
{% endfor %}
outputs:
- name: libtorch
- name: pytorch
script: build.sh # [unix]
script: bld.bat # [win]
build:
string: cuda{{ cuda_compiler_version | replace('.', '') }}_{{ blas_impl }}_py{{ CONDA_PY }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"]
string: cpu_{{ blas_impl }}_py{{ CONDA_PY }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"]
detect_binary_files_with_prefix: false
run_exports:
- {{ pin_subpackage('pytorch', max_pin='x.x') }}
- {{ pin_subpackage('libtorch', max_pin='x.x') }}
ignore_run_exports:
- libmagma_sparse
requirements:
build:
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- numpy # [build_platform != target_platform]
- {{ stdlib('c') }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} # [cuda_compiler_version != "None"]
- libgomp # [linux]
- llvm-openmp # [osx]
- cmake
- ninja
# Keep libprotobuf here so that a compatibile version
# of protobuf is installed between build and host
- libprotobuf
- protobuf
- make # [linux]
host:
# GPU requirements
- cudnn # [cuda_compiler_version != "None"]
- nccl # [cuda_compiler_version != "None"]
- cuda-version {{ cuda_compiler_version }} # [cuda_compiler_version != "None"]
- nvtx-c # [cuda_compiler_version != "None"]
- magma # [cuda_compiler_version != "None"]
{% if cuda_compiler_version != "None" %}
- cuda-driver-dev
- cuda-cudart-dev
- cuda-nvrtc-dev
- cuda-nvtx-dev
- cuda-nvml-dev
- cuda-profiler-api
- cusparselt
- libcublas-dev
- libcudss-dev
- libcufile-dev
- libcufft-dev
- libcurand-dev
- libcusolver-dev
- libcusparse-dev
{% endif %}
# other requirements
- python
- numpy
- pip
- setuptools
- pyyaml
- requests
- six
- mkl-devel {{ mkl }} # [blas_impl == "mkl"]
- libcblas * *_mkl # [blas_impl == "mkl"]
- libcblas # [blas_impl != "mkl"]
- liblapack # [blas_impl != "mkl"]
- libgomp # [linux]
- llvm-openmp # [osx]
- libabseil
- libprotobuf
- sleef
- libuv
- pkg-config # [unix]
- typing_extensions
- {{ pin_subpackage('libtorch', exact=True) }}
run:
- llvm-openmp # [osx]
# GPU requirements without run_exports
- {{ pin_compatible('cudnn') }} # [cuda_compiler_version != "None"]
# other requirements
- python
- typing_extensions
# sympy 1.13.2 was reported to result in test failures on Windows and mac
# https://github.com/pytorch/pytorch/pull/133235
- sympy >=1.13.1,!=1.13.2
- filelock
- jinja2
- networkx
- nomkl # [blas_impl != "mkl"]
- fsspec
# avoid that people without GPUs needlessly download ~0.5-1GB
- __cuda # [cuda_compiler_version != "None"]
- libtorch {{ version }}
- setuptools
- triton {{ triton }} # [cuda_compiler_version != "None"]
run_constrained:
# These constraints ensure conflict between pytorch and
# pytorch-cpu 1.1 which we built before conda-forge had GPU infrastructure
# built into place.
# https://github.com/conda-forge/pytorch-cpu-feedstock/issues/65
- pytorch-cpu =={{ version }} # [cuda_compiler_version == "None"]
- pytorch-gpu ==99999999 # [cuda_compiler_version == "None"]
- pytorch-gpu =={{ version }} # [cuda_compiler_version != "None"]
- pytorch-cpu ==99999999 # [cuda_compiler_version != "None"]
test:
requires:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- ninja
- boto3
- hypothesis
- pytest
- tabulate
- pydot
- pip
- expecttest
- xmlrunner
- pytest-flakefinder
- pytest-rerunfailures
- pytest-xdist
imports:
- torch # [not (aarch64 and cuda_compiler_version != "None")]
source_files:
- test
# tools/ is needed to optimise test run
# as of pytorch=2.0.0, there is a bug when trying to run tests without the tools
- tools
commands:
# Run pip check so as to ensure that all pytorch packages are installed
# https://github.com/conda-forge/pytorch-cpu-feedstock/issues/24
- pip check
- python -c "import torch; print(torch.__version__)" # [not (aarch64 and cuda_compiler_version != "None")]
- python -c "import torch; assert torch.backends.mkldnn.m.is_available()" # [x86 and cuda_compiler_version == "None"]
- python -c "import torch; torch.tensor(1).to('cpu').numpy(); print('numpy support enabled!!!')"
# At conda-forge, we target versions of OSX that are too old for MPS support
# But if users install a newer version of OSX, they will have MPS support
# https://github.com/conda-forge/pytorch-cpu-feedstock/pull/123#issuecomment-1186355073
# - python -c "import torch; assert torch.backends.mps.is_available()" # [osx]
# python-version-specific library (default location in SP_DIR symlinks back to this)
- test -f $PREFIX/lib/libtorch_python${SHLIB_EXT} # [unix]
# a reasonably safe subset of tests that should run under 15 minutes
# disable hypothesis because it randomly yields health check errors
{% set tests = " ".join([
"test/test_autograd.py",
"test/test_autograd_fallback.py",
"test/test_custom_ops.py",
"test/test_linalg.py",
"test/test_mkldnn.py",
"test/test_modules.py",
"test/test_nn.py",
"test/test_torch.py",
"test/test_xnnpack_integration.py",
"-m 'not hypothesis'",
]) %}
{% set skips = "(TestTorch and test_print)" %}
# tolerance violation with openblas
{% set skips = skips ~ " or test_1_sized_with_0_strided_cpu_float32" %} # [osx]
# timeouts and failures on aarch, see https://github.com/conda-forge/pytorch-cpu-feedstock/pull/298#issuecomment-2555888508
{% set skips = skips ~ " or test_pynode_destruction_deadlock" %} # [aarch64]
{% set skips = skips ~ " or (TestLinalgCPU and test_cholesky_cpu_float32)" %} # [aarch64]
{% set skips = skips ~ " or (TestLinalgCPU and test_pca_lowrank_cpu)" %} # [aarch64]
{% set skips = skips ~ " or (TestLinalgCPU and test_svd_lowrank_cpu)" %} # [aarch64]
{% set skips = skips ~ " or (TestMkldnnCPU and test_lstm_cpu)" %} # [aarch64]
# dynamo does not support python 3.13
{% set skips = skips ~ " or (TestCustomOp and test_data_dependent_compile)" %} # [py==313]
{% set skips = skips ~ " or (TestCustomOp and test_functionalize_error)" %} # [py==313]
{% set skips = skips ~ " or (TestCustomOpAPI and test_compile)" %} # [py==313]
{% set skips = skips ~ " or (TestCustomOpAPI and test_fake)" %} # [py==313]
{% set skips = skips ~ " or test_compile_int4_mm or test_compile_int8_mm" %} # [py==313]
# the whole test suite takes forever, but we should get a good enough coverage
# for potential packaging problems by running a fixed subset
- export OMP_NUM_THREADS=4 # [unix]
- python -m pytest -n auto {{ tests }} -k "not ({{ skips }})" --durations=50 # [not (aarch64 and cuda_compiler_version != "None")]
# 2021/08/01, hmaarrfk
# While this seems like a roundabout way of defining the package name
# It helps the linter avoid errors on a package not having tests.
{% set pytorch_cpu_gpu = "pytorch-cpu" %} # [cuda_compiler_version == "None"]
{% set pytorch_cpu_gpu = "pytorch-gpu" %} # [cuda_compiler_version != "None"]
- name: {{ pytorch_cpu_gpu }}
build:
string: cuda{{ cuda_compiler_version | replace('.', '') }}_{{ blas_impl }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [megabuild and cuda_compiler_version != "None"]
string: cpu_{{ blas_impl }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [megabuild and cuda_compiler_version == "None"]
string: cuda{{ cuda_compiler_version | replace('.', '') }}_{{ blas_impl }}py{{ CONDA_PY }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [not megabuild and cuda_compiler_version != "None"]
string: cpu_{{ blas_impl }}_py{{ CONDA_PY }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [not megabuild and cuda_compiler_version == "None"]
detect_binary_files_with_prefix: false
# weigh down cpu implementation and give cuda preference
track_features:
- pytorch-cpu # [cuda_compiler_version == "None"]
requirements:
run:
- pytorch {{ version }}=cuda*_{{ blas_impl }}*{{ PKG_BUILDNUM }} # [megabuild and cuda_compiler_version != "None"]
- pytorch {{ version }}=cpu_{{ blas_impl }}*{{ PKG_BUILDNUM }} # [megabuild and cuda_compiler_version == "None"]
- {{ pin_subpackage("pytorch", exact=True) }} # [not megabuild]
test:
imports:
- torch
about:
home: https://pytorch.org/
dev_url: https://github.com/pytorch/pytorch
license: BSD-3-Clause
license_family: BSD
license_file:
- LICENSE
- NOTICE
- third_party/pybind11/LICENSE
summary: PyTorch is an optimized tensor library for deep learning using GPUs and CPUs.
extra:
recipe-maintainers:
- h-vetinari
- jeongseok-meta
- hmaarrfk
- sodre
- benjaminrwilson
- Tobias-Fischer
- beckermr
feedstock-name: pytorch-cpu