-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathmeta.yaml
588 lines (566 loc) · 31 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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
# if you wish to build release candidate number X, append the version string with ".rcX"
{% set version = "2.5.1" %}
{% set build = 12 %}
# Use a higher build number for the CUDA variant, to ensure that it's
# preferred by conda's solver, and it's preferentially
# installed where the platform supports it.
{% 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" %}
# TODO Temporary pin, remove me
{% set mkl = "<2025" %}
package:
name: libtorch
version: {{ version }}
source:
{% if "rc" in version %}
git_url: https://github.com/pytorch/pytorch.git
git_rev: v{{ version.replace(".rc", "-rc") }}
{% else %}
# The "pytorch-v" tarballs contain submodules; the "pytorch-" ones don't.
url: https://github.com/pytorch/pytorch/releases/download/v{{ version }}/pytorch-v{{ version }}.tar.gz
sha256: 740eb5fff95e33cfe699bad43be83523f569c7cc7f9c285c2a255416443dd266
{% endif %}
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-fix-3.13-pickle-error-in-serialization.py-136034.patch
# https://github.com/pytorch/pytorch/pull/137331
- patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch
# conda-specific patch, lets us override CUDA paths
- patches/0008-Allow-overriding-CUDA-related-paths.patch
# NumPy 2 fixes:
# https://github.com/pytorch/pytorch/pull/136800
- patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch
# https://github.com/pytorch/pytorch/pull/137740
- patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch
# fix BLAS calling convention for openblas
- patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch
# fix mkl-2024 issue
# https://github.com/pytorch/pytorch/pull/143894
- patches/0012-fix-issue-142484.patch
- patches/0013-Fix-FindOpenBLAS.patch
# backport https://github.com/pytorch/pytorch/pull/138095
- patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch
# backport https://github.com/pytorch/pytorch/pull/145480
- patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch
# point to headers that are now living in $PREFIX/include instead of $SP_DIR/torch/include
- patches/0016-point-include-paths-to-PREFIX-include.patch
- patches/0017-Add-conda-prefix-to-inductor-include-paths.patch
- patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch
- patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch # [win]
- patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch
- patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch
- patches_submodules/fbgemm/0001-remove-DESTINATION-lib-from-CMake-install-directives.patch # [win]
- patches_submodules/tensorpipe/0001-switch-away-from-find_package-CUDA.patch
build:
number: {{ build }}
# cuda 11.8 was dropped due to maintenance effort, see discussion in #177
skip: true # [cuda_compiler_version == "11.8"]
# This logic allows two rc variants to be defined in the conda_build_config, but only one to actually be built.
# We want to be able to define two variants in the cbc so we can assign different labels to each in the upload channel
# (by zipping is_rc with channel_targets). This prevents rc builds being used unless specifically requested.
{% if "rc" in version %}
skip: true # [not is_rc]
{% else %}
skip: true # [is_rc]
{% endif %}
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/bld.bat 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]
- intel-openmp {{ mkl }} # [win]
- libuv # [win]
- cmake
- ninja
# Keep libprotobuf here so that a compatibile version
# of protobuf is installed between build and host
- libprotobuf
- protobuf
- make # [linux]
- sccache # [win]
- rsync # [unix]
host:
# GPU requirements
- cudnn # [cuda_compiler_version != "None"]
- nccl # [cuda_compiler_version != "None" and linux]
- 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 # [linux]
- cuda-cudart-dev
- cuda-cupti-dev
- cuda-nvrtc-dev
- cuda-nvtx-dev
- cuda-nvml-dev
- cuda-profiler-api
- cusparselt
- libcublas-dev
- libcudss-dev
- libcufile-dev # [linux]
- libcufft-dev
- libcurand-dev
- libcusolver-dev
- libcusparse-dev
{% endif %}
# other requirements
- python 3.12 # [megabuild]
- python # [not megabuild]
- numpy * # [megabuild]
- numpy # [not megabuild]
- pip
# see https://github.com/pytorch/pytorch/issues/136541
- setuptools <=72.1.0 # [win]
- setuptools # [not win]
- pyyaml
- requests
- six
- mkl-devel {{ mkl }} # [blas_impl == "mkl"]
- libcblas * *_mkl # [blas_impl == "mkl"]
- libblas # [blas_impl != "mkl"]
- libcblas # [blas_impl != "mkl"]
- liblapack # [blas_impl != "mkl"]
- libgomp # [linux]
- llvm-openmp # [osx]
- intel-openmp {{ mkl }} # [win]
- libabseil
- libprotobuf
- sleef
- libuv
- pkg-config # [unix]
- typing_extensions
- pybind11
- eigen
- zlib
run:
# GPU requirements without run_exports
- {{ pin_compatible('cudnn') }} # [cuda_compiler_version != "None"]
- intel-openmp {{ mkl }} # [win]
- libblas * *{{ blas_impl }} # [blas_impl == "mkl"]
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"]
# if using OpenBLAS, ensure that a version compatible with OpenMP is used
# otherwise, we get the following warnings:
# OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option.
- openblas * openmp_* # [unix and blas_impl != "mkl"]
# these tests are for the libtorch output below, but due to
# a particularity of conda-build, that output is defined in
# the global build stage, including tests
test:
requires:
# cmake needs a compiler to run package detection, see
# https://discourse.cmake.org/t/questions-about-find-package-cli-msvc/6194
- {{ compiler('cxx') }}
# for CMake config to find cuda & nvrtc
- {{ compiler('cuda') }} # [cuda_compiler_version != "None"]
- cuda-nvrtc-dev # [cuda_compiler_version != "None"]
- cmake
- ninja
- pkg-config
files:
- cmake_test/
commands:
# 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")) * [
"torch_cuda_linalg"
] + (cuda_compiler_version != "None") * [
"c10_cuda", "caffe2_nvrtc", "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]
- if not exist %LIBRARY_BIN%\{{ each_lib }}.dll exit 1 # [win]
{% if each_lib != "torch_global_deps" %}
- if not exist %LIBRARY_LIB%\{{ each_lib }}.lib exit 1 # [win]
{% endif %}
{% endfor %}
# CMake files in share
- test -f $PREFIX/share/cmake/Torch/TorchConfig.cmake # [linux]
- if not exist %LIBRARY_PREFIX%\share\cmake\Torch\TorchConfig.cmake exit 1 # [win]
# test integrity of CMake metadata
- cd cmake_test
- cmake -GNinja -DCMAKE_CXX_STANDARD=17 $CMAKE_ARGS . # [unix]
- cmake -GNinja -DCMAKE_CXX_STANDARD=17 %CMAKE_ARGS% . # [win]
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
- 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]
- intel-openmp {{ mkl }} # [win]
- cmake
- ninja
# Keep libprotobuf here so that a compatibile version
# of protobuf is installed between build and host
- libprotobuf
- protobuf
- make # [linux]
- sccache # [win]
host:
# GPU requirements
- cudnn # [cuda_compiler_version != "None"]
- nccl # [cuda_compiler_version != "None" and linux]
- 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 # [linux]
- cuda-cudart-dev
- cuda-cupti-dev
- cuda-nvrtc-dev
- cuda-nvtx-dev
- cuda-nvml-dev
- cuda-profiler-api
- cusparselt
- libcublas-dev
- libcudss-dev
- libcufile-dev # [linux]
- libcufft-dev
- libcurand-dev
- libcusolver-dev
- libcusparse-dev
{% endif %}
# other requirements
- python
- numpy
- pip
# see https://github.com/pytorch/pytorch/issues/136541
- setuptools <=72.1.0 # [win]
- setuptools # [not win]
- 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]
- intel-openmp {{ mkl }} # [win]
- libabseil
- libprotobuf
- sleef
- libuv
- pkg-config # [unix]
- typing_extensions
- {{ pin_subpackage('libtorch', exact=True) }}
- pybind11
- eigen
- zlib
run:
- llvm-openmp # [osx]
- intel-openmp {{ mkl }} # [win]
- libblas * *{{ blas_impl }} # [blas_impl == "mkl"]
# 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
- pybind11
- 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" and not win]
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') }}
# for torch.compile tests
- {{ compiler('cuda') }} # [cuda_compiler_version != "None"]
- ninja
- boto3
- hypothesis
- pytest
- tabulate
- pydot
- pip
- expecttest
- xmlrunner
# Required by run_test.py
- pytest-flakefinder
- pytest-rerunfailures
- pytest-xdist
# danpetry/TF: Pytorch includes their own edited version of pytest-shard and adding
# it into the test deps as well results in the --shard-id option being added twice.
# https://github.com/pytorch/pytorch/blob/main/test/pytest_shard_custom.py
# - pytest-shard
imports:
- torch
source_files:
# Only include the source_files if we are actually going to run the tests.
- 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
#- .ci/pytorch/smoke_test/smoke_test.py
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__)"
- 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!!!')"
# We have had issues with openmp .dylibs being doubly loaded in certain cases. These two tests catch the (observed) issue
- python -c "import torch; import numpy"
- python -c "import numpy; import torch"
# distributed support is enabled by default on linux; for mac, we enable it manually in build.sh
- python -c "import torch; assert torch.distributed.is_available()" # [linux or osx]
- python -c "import torch; assert torch.backends.cuda.is_built()" # [linux64 and (cuda_compiler_version != "None")]
- python -c "import torch; assert torch.backends.cudnn.is_available()" # [linux64 and (cuda_compiler_version != "None")]
- python -c "import torch; assert torch.backends.cudnn.enabled" # [linux64 and (cuda_compiler_version != "None")]
# 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]
- if not exist %LIBRARY_BIN%\torch_python.dll exit 1 # [win]
- if not exist %LIBRARY_LIB%\torch_python.lib exit 1 # [win]
# See here for environment variables needed by the smoke test script
# https://github.com/pytorch/pytorch/blob/266fd35c5842902f6304aa8e7713b252cbfb243c/.ci/pytorch/smoke_test/smoke_test.py#L16
- set MATRIX_GPU_ARCH_VERSION="{{ '.'.join((cuda_compiler_version or "").split('.')[:2]) }}" # [(cuda_compiler_version != "None") and (win)]
- set MATRIX_GPU_ARCH_TYPE="cuda" # [(cuda_compiler_version != "None") and (win)]
- set MATRIX_GPU_ARCH_VERSION="none" # [(cuda_compiler_version == "None") and (win)]
- set MATRIX_GPU_ARCH_TYPE="none" # [(cuda_compiler_version == "None") and (win)]
- set MATRIX_CHANNEL="defaults" # [win]
- set MATRIX_STABLE_VERSION={{ version }} # [win]
- set MATRIX_PACKAGE_TYPE="conda" # [win]
- set TARGET_OS="windows" # [win]
- set OMP_NUM_THREADS=4 # [win]
- export MATRIX_GPU_ARCH_VERSION="{{ '.'.join((cuda_compiler_version or "").split('.')[:2]) }}" # [(cuda_compiler_version != "None") and (linux and x86_64)]
- export MATRIX_GPU_ARCH_TYPE="cuda" # [(cuda_compiler_version != "None") and (linux and x86_64)]
- export MATRIX_GPU_ARCH_VERSION="none" # [(cuda_compiler_version == "None") and (not win)]
- export MATRIX_GPU_ARCH_TYPE="none" # [(cuda_compiler_version == "None") and (not win)]
- export MATRIX_CHANNEL="defaults" # [not win]
- export MATRIX_STABLE_VERSION="{{ version }}" # [not win]
- export MATRIX_PACKAGE_TYPE="conda" # [not win]
- export TARGET_OS="linux" # [linux]
- export TARGET_OS="macos-arm64" # [(osx and arm64)]
- export TARGET_OS="macos-x86_64" # [(osx and x86_64)]
- export OMP_NUM_THREADS=4 # [not win]
#- python ./smoke_test/smoke_test.py --package torchonly
# a reasonably safe subset of tests that should run under 15 minutes
{% 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",
]) %}
# tests torch.compile; avoid on aarch because it adds >4h in test runtime in emulation;
# they add a lot of runtime (15->60min on windows), so run them for only one python version
{% set tests = tests ~ " test/inductor/test_torchinductor.py" %} # [py==312 and not aarch64]
{% 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]
# doesn't crash, but gets different result on aarch + CUDA
{% set skips = skips ~ " or illcondition_matrix_input_should_not_crash_cpu" %} # [aarch64 and cuda_compiler_version != "None"]
# may crash spuriously
{% set skips = skips ~ " or (TestAutograd and test_profiler_seq_nr)" %}
{% set skips = skips ~ " or (TestAutograd and test_profiler_propagation)" %}
# tests that fail due to resource clean-up issues (non-unique temporary libraries), see
# https://github.com/conda-forge/pytorch-cpu-feedstock/pull/318#issuecomment-2620080859
{% set skips = skips ~ " or test_mutable_custom_op_fixed_layout" %} # [cuda_compiler_version != "None"]
# trivial accuracy problems
{% set skips = skips ~ " or test_BCELoss_weights_no_reduce_cuda" %} # [unix and cuda_compiler_version != "None"]
{% set skips = skips ~ " or test_ctc_loss_cudnn_tensor_cuda " %} # [unix and cuda_compiler_version != "None"]
{% set skips = skips ~ " or (TestTorch and test_index_add_correctness)" %} # [unix and cuda_compiler_version != "None"]
# These tests require higher-resource or more recent GPUs than the CI provides
{% set skips = skips ~ " or test_sdpa_inference_mode_aot_compile" %} # [linux and cuda_compiler_version != "None"]
{% set skips = skips ~ " or (TestNN and test_grid_sample)" %} # [linux and cuda_compiler_version != "None"]
# don't mess with tests that rely on GPU failure handling
{% set skips = skips ~ " or test_indirect_device_assert" %} # [linux and cuda_compiler_version != "None"]
# test that fails to find temporary resource
{% set skips = skips ~ " or (GPUTests and test_scatter_reduce2)" %} # [linux and cuda_compiler_version != "None"]
# MKL problems
{% set skips = skips ~ " or (TestLinalgCPU and test_inverse_errors_large_cpu)" %} # [linux and blas_impl == "mkl" and cuda_compiler_version != "None"]
{% set skips = skips ~ " or test_reentrant_parent_error_on_cpu_cuda)" %} # [linux and blas_impl == "mkl" and cuda_compiler_version != "None"]
# non-MKL problems
{% set skips = skips ~ " or test_cross_entropy_loss_2d_out_of_bounds_class_index_cuda" %} # [linux and blas_impl != "mkl" and cuda_compiler_version != "None"]
{% set skips = skips ~ " or test_cublas_config_nondeterministic_alert_cuda " %} # [linux and blas_impl != "mkl" and cuda_compiler_version != "None"]
# these tests are failing with low -n values
{% set skips = skips ~ " or test_base_does_not_require_grad_mode_nothing" %}
{% set skips = skips ~ " or test_base_does_not_require_grad_mode_warn" %}
{% set skips = skips ~ " or test_composite_registered_to_cpu_mode_nothing" %}
# these tests are failing on windows
{% set skips = skips ~ " or (TestNN and test_Conv1d_dilated)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv1d_pad_same_dilated)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv2d_pad_same_dilated)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv2d_padding)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv2d_strided)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv3d_dilated)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv3d_dilated_strided)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv3d_pad_same_dilated)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv3d_stride)" %} # [win]
{% set skips = skips ~ " or (TestNN and test_Conv3d_stride_padding)" %} # [win]
# 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]
# reduced paralellism to avoid OOM; test only one python version on aarch because emulation is super-slow
# disable hypothesis because it randomly yields health check errors
- python -m pytest -n 2 {{ tests }} -k "not ({{ skips }})" -m "not hypothesis" --durations=50 # [unix and (not aarch64 or py==312)]
- python -m pytest -v -s {{ tests }} -k "not ({{ skips }})" -m "not hypothesis" --durations=50 # [win]
# regression test for https://github.com/conda-forge/pytorch-cpu-feedstock/issues/329, where we picked up
# duplicate `.pyc` files due to newest py-ver (3.13) in the build environment not matching the one in host;
# obviously this test can only be done for other python versions.
- test ! -f $SP_DIR/functorch/__pycache__/__init__.cpython-313.pyc # [py!=313 and unix]
- if exist %SP_DIR%\functorch\__pycache__\__init__.cpython-313.pyc exit 1 # [py!=313 and win]
# 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/CMake/Copyright.txt
summary: PyTorch is an optimized tensor library for deep learning using GPUs and CPUs.
description: |
PyTorch is a Python package that provides two high-level features:
- Tensor computation (like NumPy) with strong GPU acceleration
- Deep neural networks built on a tape-based autograd system
You can reuse your favorite Python packages such as NumPy, SciPy, and Cython to extend PyTorch when needed.
doc_url: https://pytorch.org/docs/
extra:
recipe-maintainers:
- baszalmstra
- benjaminrwilson
- beckermr
- h-vetinari
- hmaarrfk
- jeongseok-meta
- mgorny
- sodre
- Tobias-Fischer
feedstock-name: pytorch-cpu