Skip to content

Commit

Permalink
Add conda compilers (#702)
Browse files Browse the repository at this point in the history
Our `devel` Docker containers need to be switched to using `conda` compilers to resolve a linking error. `raft` is in those containers, but hasn't yet been built with `conda` compilers. This PR addresses that.

These changes won't cleanly merge into `branch-22.08` unfortunately due to the changes in #641, but we can address that another time.

Authors:
   - AJ Schmidt (https://github.com/ajschmidt8)
   - Corey J. Nolet (https://github.com/cjnolet)
   - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
   - Corey J. Nolet (https://github.com/cjnolet)
  • Loading branch information
ajschmidt8 authored Jun 7, 2022
1 parent 21e8874 commit 0b55c32
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 32 deletions.
26 changes: 13 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ function cmakeArgs {
# There are possible weird edge cases that may cause this regex filter to output nothing and fail silently
# the true pipe will catch any weird edge cases that may happen and will cause the program to fall back
# on the invalid option error
CMAKE_ARGS=$(echo $ARGS | { grep -Eo "\-\-cmake\-args=\".+\"" || true; })
if [[ -n ${CMAKE_ARGS} ]]; then
# Remove the full CMAKE_ARGS argument from list of args so that it passes validArgs function
ARGS=${ARGS//$CMAKE_ARGS/}
EXTRA_CMAKE_ARGS=$(echo $ARGS | { grep -Eo "\-\-cmake\-args=\".+\"" || true; })
if [[ -n ${EXTRA_CMAKE_ARGS} ]]; then
# Remove the full EXTRA_CMAKE_ARGS argument from list of args so that it passes validArgs function
ARGS=${ARGS//$EXTRA_CMAKE_ARGS/}
# Filter the full argument down to just the extra string that will be added to cmake call
CMAKE_ARGS=$(echo $CMAKE_ARGS | grep -Eo "\".+\"" | sed -e 's/^"//' -e 's/"$//')
EXTRA_CMAKE_ARGS=$(echo $EXTRA_CMAKE_ARGS | grep -Eo "\".+\"" | sed -e 's/^"//' -e 's/"$//')
fi
fi
}
Expand Down Expand Up @@ -196,9 +196,9 @@ if [[ ${CMAKE_TARGET} == "" ]]; then
CMAKE_TARGET="all"
fi

# Append `-DFIND_RAFT_CPP=ON` to CMAKE_ARGS unless a user specified the option.
if [[ "${CMAKE_ARGS}" != *"DFIND_RAFT_CPP"* ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DFIND_RAFT_CPP=ON"
# Append `-DFIND_RAFT_CPP=ON` to EXTRA_CMAKE_ARGS unless a user specified the option.
if [[ "${EXTRA_CMAKE_ARGS}" != *"DFIND_RAFT_CPP"* ]]; then
EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DFIND_RAFT_CPP=ON"
fi

# If clean given, run it prior to any other steps
Expand Down Expand Up @@ -250,7 +250,7 @@ if (( ${NUMARGS} == 0 )) || hasArg libraft || hasArg docs || hasArg tests || has
-DRAFT_COMPILE_DIST_LIBRARY=${COMPILE_DIST_LIBRARY} \
-DRAFT_USE_FAISS_STATIC=${BUILD_STATIC_FAISS} \
-DRAFT_ENABLE_thrust_DEPENDENCY=${ENABLE_thrust_DEPENDENCY} \
${CMAKE_ARGS}
${EXTRA_CMAKE_ARGS}

if [[ ${CMAKE_TARGET} != "" ]]; then
echo "-- Compiling targets: ${CMAKE_TARGET}, verbose=${VERBOSE_FLAG}"
Expand All @@ -266,19 +266,19 @@ fi
if (( ${NUMARGS} == 0 )) || hasArg pyraft || hasArg docs; then

cd ${REPODIR}/python/raft
python setup.py build_ext -j${PARALLEL_LEVEL:-1} --inplace -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBRAFT_BUILD_DIR} ${CMAKE_ARGS}
python setup.py build_ext -j${PARALLEL_LEVEL:-1} --inplace -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBRAFT_BUILD_DIR} ${EXTRA_CMAKE_ARGS}
if [[ ${INSTALL_TARGET} != "" ]]; then
python setup.py install --single-version-externally-managed --record=record.txt -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} ${CMAKE_ARGS}
python setup.py install --single-version-externally-managed --record=record.txt -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} ${EXTRA_CMAKE_ARGS}
fi
fi

# Build and (optionally) install the pylibraft Python package
if (( ${NUMARGS} == 0 )) || hasArg pylibraft; then

cd ${REPODIR}/python/pylibraft
python setup.py build_ext -j${PARALLEL_LEVEL:-1} --inplace -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBRAFT_BUILD_DIR} ${CMAKE_ARGS}
python setup.py build_ext -j${PARALLEL_LEVEL:-1} --inplace -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBRAFT_BUILD_DIR} ${EXTRA_CMAKE_ARGS}
if [[ ${INSTALL_TARGET} != "" ]]; then
python setup.py install --single-version-externally-managed --record=record.txt -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} ${CMAKE_ARGS}
python setup.py install --single-version-externally-managed --record=record.txt -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} ${EXTRA_CMAKE_ARGS}
fi
fi

Expand Down
11 changes: 11 additions & 0 deletions conda/recipes/libraft_distance/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
c_compiler_version:
- 9

cxx_compiler_version:
- 9

cuda_compiler:
- nvcc

sysroot_version:
- "2.17"
9 changes: 6 additions & 3 deletions conda/recipes/libraft_distance/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
- CUDAHOSTCXX
- PARALLEL_LEVEL
- VERSION_SUFFIX
- PROJECT_FLASH
Expand All @@ -33,9 +30,15 @@ build:
- SCCACHE_BUCKET=rapids-sccache
- SCCACHE_REGION=us-west-2
- SCCACHE_IDLE_TIMEOUT=32768
ignore_run_exports_from:
- {{ compiler('cuda') }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
- cmake>=3.20.1,!=3.23.0
host:
- libraft-headers {{ version }}
Expand Down
11 changes: 11 additions & 0 deletions conda/recipes/libraft_headers/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
c_compiler_version:
- 9

cxx_compiler_version:
- 9

cuda_compiler:
- nvcc

sysroot_version:
- "2.17"
9 changes: 6 additions & 3 deletions conda/recipes/libraft_headers/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
- CUDAHOSTCXX
- PARALLEL_LEVEL
- VERSION_SUFFIX
- PROJECT_FLASH
Expand All @@ -33,9 +30,15 @@ build:
- SCCACHE_BUCKET=rapids-sccache
- SCCACHE_REGION=us-west-2
- SCCACHE_IDLE_TIMEOUT=32768
ignore_run_exports_from:
- {{ compiler('cuda') }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
- cmake>=3.20.1,!=3.23.0
host:
- nccl>=2.9.9
Expand Down
11 changes: 11 additions & 0 deletions conda/recipes/libraft_nn/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
c_compiler_version:
- 9

cxx_compiler_version:
- 9

cuda_compiler:
- nvcc

sysroot_version:
- "2.17"
9 changes: 6 additions & 3 deletions conda/recipes/libraft_nn/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
- CUDAHOSTCXX
- PARALLEL_LEVEL
- VERSION_SUFFIX
- PROJECT_FLASH
Expand All @@ -33,9 +30,15 @@ build:
- SCCACHE_BUCKET=rapids-sccache
- SCCACHE_REGION=us-west-2
- SCCACHE_IDLE_TIMEOUT=32768
ignore_run_exports_from:
- {{ compiler('cuda') }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
- cmake>=3.20.1,!=3.23.0
host:
- libraft-headers {{ version }}
Expand Down
14 changes: 14 additions & 0 deletions conda/recipes/pylibraft/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
c_compiler_version:
- 9

cxx_compiler_version:
- 9

cuda_compiler:
- nvcc

sysroot_version:
- "2.17"

cmake_version:
- ">=3.20.1,!=3.23.0"
14 changes: 9 additions & 5 deletions conda/recipes/pylibraft/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ source:
build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
- VERSION_SUFFIX
ignore_run_exports_from:
- {{ compiler('cuda') }}

requirements:
build:
- cmake {{ cmake_version }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
host:
- python x.x
- setuptools
- cython>=0.29,<0.30
- cmake>=3.20.1,!=3.23.0
- cmake {{ cmake_version }}
- scikit-build>=0.13.1
- rmm {{ minor_version }}
- libraft-headers {{ version }}
Expand Down
15 changes: 15 additions & 0 deletions conda/recipes/pyraft/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
c_compiler_version:
- 9

cxx_compiler_version:
- 9

cuda_compiler:
- nvcc

sysroot_version:
- "2.17"

ucx_version:
- "1.12.1"

cmake_version:
- ">=3.20.1,!=3.23.0"
14 changes: 9 additions & 5 deletions conda/recipes/pyraft/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ source:
build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
- VERSION_SUFFIX
ignore_run_exports_from:
- {{ compiler('cuda') }}

requirements:
build:
- cmake {{ cmake_version }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
host:
- python x.x
- setuptools
- cython>=0.29,<0.30
- cmake>=3.20.1,!=3.23.0
- cmake {{ cmake_version }}
- scikit-build>=0.13.1
- rmm {{ minor_version }}
- libraft-headers {{ version }}
Expand Down

0 comments on commit 0b55c32

Please sign in to comment.