Skip to content

Commit

Permalink
add cupy-core
Browse files Browse the repository at this point in the history
  • Loading branch information
leofang committed Jan 19, 2024
1 parent 620eb3b commit 19a916f
Showing 1 changed file with 178 additions and 135 deletions.
313 changes: 178 additions & 135 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,143 +27,186 @@ source:
build:
number: 0
skip: true # [cuda_compiler_version not in ("11.8", "12.0")]
script:
# CuPy default detects CUDA from nvcc, but on Conda-Forge's dockers nvcc lives in a different place...
# With conda-forge/nvcc-feedstock#58, CUDA_PATH is set correctly
- export NVCC="$(which nvcc)" # [linux]
{% if cuda_major >= 12 %}
- export CUPY_NUM_BUILD_JOBS=1 # [(aarch64 or ppc64le) and (build_platform == target_platform)]
- export CUDA_PATH=$PREFIX/targets/{{ target_name }} # [linux]
{% endif %}
- echo "nvcc is $NVCC, CUDA path is $CUDA_PATH" # [linux]
- for /f "tokens=* usebackq" %%f in (`where nvcc`) do (set "dummy=%%f" && call set "NVCC=%%dummy:\=\\%%") # [win]
# we use this WAR until we figure out how to proceed with conda-forge/nvcc-feedstock#88
- set "NVCC=%NVCC% --use-local-env" # [win64]
- echo "nvcc is %NVCC%, CUDA path is %CUDA_PATH%" # [win]
- export CUSPARSELT_PATH="${PREFIX}" # [(linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]
# Workaround __ieee128 error; see https://github.com/LLNL/blt/issues/341
- export NVCC="$NVCC -Xcompiler -mno-float128" # [ppc64le]

- {{ PYTHON }} -m pip install . --no-deps -vv
- if errorlevel 1 exit 1 # [win]

# copy activate/deactivate scripts
- mkdir -p "${PREFIX}/etc/conda/activate.d" # [linux]
- cp "${RECIPE_DIR}/activate.sh" "${PREFIX}/etc/conda/activate.d/cupy_activate.sh" # [linux]
- mkdir -p "${PREFIX}/etc/conda/deactivate.d" # [linux]
- cp "${RECIPE_DIR}/deactivate.sh" "${PREFIX}/etc/conda/deactivate.d/cupy_deactivate.sh" # [linux]
- if not exist %PREFIX%\etc\conda\activate.d mkdir %PREFIX%\etc\conda\activate.d # [win]
- copy %RECIPE_DIR%\activate.bat %PREFIX%\etc\conda\activate.d\cupy_activate.bat # [win]
- if not exist %PREFIX%\etc\conda\deactivate.d mkdir %PREFIX%\etc\conda\deactivate.d # [win]
- copy %RECIPE_DIR%\deactivate.bat %PREFIX%\etc\conda\deactivate.d\cupy_deactivate.bat # [win]

# enable CuPy's preload mechanism
- mkdir -p "${SP_DIR}/cupy/.data/" # [linux]
- cp ${RECIPE_DIR}/preload_config/linux64_cuda{{ cuda_major }}_wheel.json ${SP_DIR}/cupy/.data/_wheel.json # [linux]
- if not exist %SP_DIR%\cupy\.data mkdir %SP_DIR%\cupy\.data # [win]
- copy %RECIPE_DIR%\preload_config\win64_cuda{{ cuda_major }}_wheel.json %SP_DIR%\cupy\.data\_wheel.json # [win]

# cupy/cupy#7578
- if not exist %SP_DIR%\cupy\.data\_depends.json exit 1 # [win]
missing_dso_whitelist:
- '*/libcuda.*' # [linux]
- '*/nvcuda.dll' # [win]
ignore_run_exports_from:
- {{ compiler('cuda') }}
ignore_run_exports:
# optional dependencies
- cudnn # [not ((aarch64 or ppc64le) and (cuda_compiler_version or "").startswith("12"))]
- nccl # [linux]
- cutensor
- cusparselt # [(linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]

requirements:
build:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- {{ compiler("cuda") }}
#- cuda-nvcc
- sysroot_{{ target_platform }} 2.17 # [linux]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- python # [build_platform != target_platform]
- cython >=0.29.22,<3 # [build_platform != target_platform]
# TODO: clean up
{% if cuda_major >= 12 %}
- cuda-driver-dev # [linux and build_platform != target_platform]
- cuda-cudart-dev # [build_platform != target_platform]
- cuda-nvrtc-dev # [build_platform != target_platform]
- cuda-nvtx-dev # [build_platform != target_platform]
- cuda-profiler-api # [build_platform != target_platform]
- cuda-cccl_{{ build_platform }} # [build_platform != target_platform]
- libcublas-dev # [build_platform != target_platform]
- libcufft-dev # [build_platform != target_platform]
- libcurand-dev # [build_platform != target_platform]
- libcusolver-dev # [build_platform != target_platform]
- libcusparse-dev # [build_platform != target_platform]
{% endif %}
# optional dependencies for CUDA 11.2+
- cudnn >=8.0.*,<9 # [build_platform != target_platform and (not ((aarch64 or ppc64le) and (cuda_compiler_version or "").startswith("12")))]
- nccl >=2.8,<3 # [build_platform != target_platform]
- cutensor >=1.4,<2 # [build_platform != target_platform]
- cusparselt ~=0.2.0.0 # [build_platform != target_platform and (linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]

host:
- python
- pip
- setuptools
- cython >=0.29.22,<3
- fastrlock >=0.5
- cuda-version {{ cuda_compiler_version }}
- nvtx-c # [win64]
# TODO: clean up
{% if cuda_major >= 12 %}
- cuda-driver-dev # [linux]
- cuda-cudart-dev
- cuda-nvrtc-dev
- cuda-nvtx-dev
- cuda-profiler-api
- cuda-cccl_{{ target_platform }}
- libcublas-dev
- libcufft-dev
- libcurand-dev
- libcusolver-dev
- libcusparse-dev
{% endif %}
# optional dependencies
# TODO: see https://github.com/conda-forge/cudnn-feedstock/issues/58
- cudnn >=8.0.*,<9 # [not ((aarch64 or ppc64le) and (cuda_compiler_version or "").startswith("12"))]
- nccl >=2.8,<3 # [linux]
- cutensor >=1.4,<2
- cusparselt ~=0.2.0.0 # [(linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]

run:
- python
- {{ pin_compatible('fastrlock', max_pin='x.x') }}
- numpy >=1.21,<2
- cudatoolkit # [(cuda_compiler_version or "").startswith("11")]
- cuda-version >={{ cuda_major }}.2,<{{ cuda_major+1 }} # [(cuda_compiler_version or "").startswith("11")]
- cuda-version >={{ cuda_major }}.0,<{{ cuda_major+1 }} # [(cuda_compiler_version or "").startswith("12")]

run_constrained:
# Only GLIBC_2.17 or older symbols present
- __glibc >=2.17 # [linux]
- scipy >=1.7,<2
- optuna >=3,<4
- __cuda >=11.2 # [(cuda_compiler_version or "").startswith("11")]
- __cuda >=12.0 # [(cuda_compiler_version or "").startswith("12")]
# TODO: Waiting for `aarch64` & `ppc64le` CUDA 12 support
- {{ pin_compatible('cudnn') }} # [not ((aarch64 or ppc64le) and (cuda_compiler_version or "").startswith("12"))]
- {{ pin_compatible('nccl') }} # [linux]
- {{ pin_compatible('cutensor', lower_bound='1.4') }}
- {{ pin_compatible('cusparselt', max_pin='x.x') }} # [(linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]

test:
requires:
# need the libcuda stub for import test
- cuda-driver-dev # [linux and (cuda_compiler_version or "").startswith("12")]

source_files:
- tests
outputs:

- name: cupy
version: {{ version }}
build:
number: {{ build_num }}
requirements:
build:
host:
run:
- {{ pin_subpackage('custatevec', max_pin='x.x.x') }}
- cudatoolkit # [(cuda_compiler_version or "").startswith("11")]
- cuda-nvrtc # [(cuda_compiler_version or "").startswith("12")]
- cuda-nvtx # [(cuda_compiler_version or "").startswith("12")]
- libcublas # [(cuda_compiler_version or "").startswith("12")]
- libcufft # [(cuda_compiler_version or "").startswith("12")]
- libcurand # [(cuda_compiler_version or "").startswith("12")]
- libcusolver # [(cuda_compiler_version or "").startswith("12")]
- libcusparse # [(cuda_compiler_version or "").startswith("12")]
test:
imports:
- cupy # dummy

- name: cupy-core
version: {{ version }}
build:
number: {{ build_num }}
script:
# CuPy default detects CUDA from nvcc, but on Conda-Forge's dockers nvcc lives in a different place...
# With conda-forge/nvcc-feedstock#58, CUDA_PATH is set correctly
- export NVCC="$(which nvcc)" # [linux]
{% if cuda_major >= 12 %}
- export CUPY_NUM_BUILD_JOBS=1 # [(aarch64 or ppc64le) and (build_platform == target_platform)]
- export CUDA_PATH=$PREFIX/targets/{{ target_name }} # [linux]
{% endif %}
- echo "nvcc is $NVCC, CUDA path is $CUDA_PATH" # [linux]
- for /f "tokens=* usebackq" %%f in (`where nvcc`) do (set "dummy=%%f" && call set "NVCC=%%dummy:\=\\%%") # [win]
# we use this WAR until we figure out how to proceed with conda-forge/nvcc-feedstock#88
- set "NVCC=%NVCC% --use-local-env" # [win64]
- echo "nvcc is %NVCC%, CUDA path is %CUDA_PATH%" # [win]
- export CUSPARSELT_PATH="${PREFIX}" # [(linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]
# Workaround __ieee128 error; see https://github.com/LLNL/blt/issues/341
- export NVCC="$NVCC -Xcompiler -mno-float128" # [ppc64le]

- {{ PYTHON }} -m pip install . --no-deps -vv
- if errorlevel 1 exit 1 # [win]

# copy activate/deactivate scripts
- mkdir -p "${PREFIX}/etc/conda/activate.d" # [linux]
- cp "${RECIPE_DIR}/activate.sh" "${PREFIX}/etc/conda/activate.d/cupy_activate.sh" # [linux]
- mkdir -p "${PREFIX}/etc/conda/deactivate.d" # [linux]
- cp "${RECIPE_DIR}/deactivate.sh" "${PREFIX}/etc/conda/deactivate.d/cupy_deactivate.sh" # [linux]
- if not exist %PREFIX%\etc\conda\activate.d mkdir %PREFIX%\etc\conda\activate.d # [win]
- copy %RECIPE_DIR%\activate.bat %PREFIX%\etc\conda\activate.d\cupy_activate.bat # [win]
- if not exist %PREFIX%\etc\conda\deactivate.d mkdir %PREFIX%\etc\conda\deactivate.d # [win]
- copy %RECIPE_DIR%\deactivate.bat %PREFIX%\etc\conda\deactivate.d\cupy_deactivate.bat # [win]

# enable CuPy's preload mechanism
- mkdir -p "${SP_DIR}/cupy/.data/" # [linux]
- cp ${RECIPE_DIR}/preload_config/linux64_cuda{{ cuda_major }}_wheel.json ${SP_DIR}/cupy/.data/_wheel.json # [linux]
- if not exist %SP_DIR%\cupy\.data mkdir %SP_DIR%\cupy\.data # [win]
- copy %RECIPE_DIR%\preload_config\win64_cuda{{ cuda_major }}_wheel.json %SP_DIR%\cupy\.data\_wheel.json # [win]

# cupy/cupy#7578
- if not exist %SP_DIR%\cupy\.data\_depends.json exit 1 # [win]
missing_dso_whitelist:
- '*/libcuda.*' # [linux]
- '*/nvcuda.dll' # [win]
ignore_run_exports_from:
- {{ compiler('cuda') }}
{% if cuda_major >= 12 %}
- cuda-driver-dev # [linux]
- cuda-cudart-dev
- cuda-nvrtc-dev
- cuda-nvtx-dev
- cuda-profiler-api
- cuda-cccl_{{ target_platform }}
- libcublas-dev
- libcufft-dev
- libcurand-dev
- libcusolver-dev
- libcusparse-dev
{% endif %}
ignore_run_exports:
# optional dependencies
- cudnn # [not ((aarch64 or ppc64le) and (cuda_compiler_version or "").startswith("12"))]
- nccl # [linux]
- cutensor
- cusparselt # [(linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]
requirements:
build:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- {{ compiler("cuda") }}
#- cuda-nvcc
- sysroot_{{ target_platform }} 2.17 # [linux]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- python # [build_platform != target_platform]
- cython >=0.29.22,<3 # [build_platform != target_platform]
# TODO: clean up
{% if cuda_major >= 12 %}
- cuda-driver-dev # [linux and build_platform != target_platform]
- cuda-cudart-dev # [build_platform != target_platform]
- cuda-nvrtc-dev # [build_platform != target_platform]
- cuda-nvtx-dev # [build_platform != target_platform]
- cuda-profiler-api # [build_platform != target_platform]
- cuda-cccl_{{ build_platform }} # [build_platform != target_platform]
- libcublas-dev # [build_platform != target_platform]
- libcufft-dev # [build_platform != target_platform]
- libcurand-dev # [build_platform != target_platform]
- libcusolver-dev # [build_platform != target_platform]
- libcusparse-dev # [build_platform != target_platform]
{% endif %}
# optional dependencies for CUDA 11.2+
- cudnn >=8.0.*,<9 # [build_platform != target_platform and (not ((aarch64 or ppc64le) and (cuda_compiler_version or "").startswith("12")))]
- nccl >=2.8,<3 # [build_platform != target_platform]
- cutensor >=2,<3 # [build_platform != target_platform]
- cusparselt ~=0.2.0.0 # [build_platform != target_platform and (linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]
host:
- python
- pip
- setuptools
- cython >=0.29.22,<3
- fastrlock >=0.5
- cuda-version {{ cuda_compiler_version }}
- nvtx-c # [win64]
# TODO: clean up
{% if cuda_major >= 12 %}
- cuda-driver-dev # [linux]
- cuda-cudart-dev
- cuda-nvrtc-dev
- cuda-nvtx-dev
- cuda-profiler-api
- cuda-cccl_{{ target_platform }}
- libcublas-dev
- libcufft-dev
- libcurand-dev
- libcusolver-dev
- libcusparse-dev
{% endif %}
# optional dependencies
# TODO: see https://github.com/conda-forge/cudnn-feedstock/issues/58
- cudnn >=8.0.*,<9 # [not ((aarch64 or ppc64le) and (cuda_compiler_version or "").startswith("12"))]
- nccl >=2.8,<3 # [linux]
- cutensor >=2,<3
- cusparselt ~=0.2.0.0 # [(linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]
run:
- python
- {{ pin_compatible('fastrlock', max_pin='x.x') }}
- numpy >=1.21,<2
- cuda-version >={{ cuda_major }}.2,<{{ cuda_major+1 }} # [(cuda_compiler_version or "").startswith("11")]
- cuda-version >={{ cuda_major }}.0,<{{ cuda_major+1 }} # [(cuda_compiler_version or "").startswith("12")]
run_constrained:
# Only GLIBC_2.17 or older symbols present
- __glibc >=2.17 # [linux]
- cudatoolkit # [(cuda_compiler_version or "").startswith("11")]
- cuda-nvrtc # [(cuda_compiler_version or "").startswith("12")]
- cuda-nvtx # [(cuda_compiler_version or "").startswith("12")]
- libcublas # [(cuda_compiler_version or "").startswith("12")]
- libcufft # [(cuda_compiler_version or "").startswith("12")]
- libcurand # [(cuda_compiler_version or "").startswith("12")]
- libcusolver # [(cuda_compiler_version or "").startswith("12")]
- libcusparse # [(cuda_compiler_version or "").startswith("12")]
- scipy >=1.7,<2
- optuna >=3,<4
- __cuda >=11.2 # [(cuda_compiler_version or "").startswith("11")]
- __cuda >=12.0 # [(cuda_compiler_version or "").startswith("12")]
# TODO: Waiting for `aarch64` & `ppc64le` CUDA 12 support
- {{ pin_compatible('cudnn') }} # [not ((aarch64 or ppc64le) and (cuda_compiler_version or "").startswith("12"))]
- {{ pin_compatible('nccl') }} # [linux]
- {{ pin_compatible('cutensor', lower_bound='2.0') }}
- {{ pin_compatible('cusparselt', max_pin='x.x') }} # [(linux64 or aarch64 or win) and (cuda_compiler_version or "").startswith("11")]
test:
requires:
# need the libcuda stub for import test
- cuda-driver-dev # [linux and (cuda_compiler_version or "").startswith("12")]
source_files:
- tests

about:
home: https://cupy.dev/
Expand Down

0 comments on commit 19a916f

Please sign in to comment.