Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to CMake 3.20 features, rapids-cmake and CPM #3844

Merged
merged 45 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
856c013
FIX Simple conflict resolution
mdemoret-nv Feb 10, 2021
2234001
FEA First succesgul libcuml compilation
dantegd May 8, 2021
a213464
ENH tests and bench working, final todo is googlebench with rapids-cmake
dantegd May 9, 2021
81f5e6f
ENH First complete version, added versioning and tested static treeli…
dantegd May 9, 2021
eaec04b
FIX Small corrections to commented code
dantegd May 9, 2021
70b051c
FIX More small fixes and updates to setup.py for changes in cmake dep…
dantegd May 9, 2021
ffc4290
FIX Small conflict resolution
mdemoret-nv Feb 10, 2021
852cdc7
FIX build.sh and setup.py updates to account for recent changes
dantegd May 10, 2021
3961e86
ENH Centralize target names and revert back to original naming
dantegd May 10, 2021
3890490
DOC Beginning of readme update
dantegd May 10, 2021
e095d83
FIX Wrong variable name
dantegd May 10, 2021
da98143
FIX Copyright year and undo name change in examples CMakeLists
dantegd May 10, 2021
d26fb38
ENH Simplify get_ucx to not build from source for now
dantegd May 10, 2021
3e8e465
FIX Update cmake version in conda recipe
dantegd May 10, 2021
2737fed
FIX Use https for fetching rapids-cmake as opposed to ssh
dantegd May 10, 2021
27ad38e
ENH Enhancements to get_raft to allow for pinning commits in PRs for …
dantegd May 11, 2021
b7db3bd
FIX Forgot to add parameter in cmake parse args
dantegd May 11, 2021
f18adbb
FIX Add gmock to conda recipe build requirements since cmake targets …
dantegd May 12, 2021
877d0a2
FIX c wrapper library target name in test cmakelists
dantegd May 13, 2021
a52c8de
FIX Name of cpp docs target in build.sh
dantegd May 13, 2021
9e27e59
FIX Remove cutlass include dirs that was remaining
dantegd May 13, 2021
7450727
FIX Port back setuputils fix done in cugraph
dantegd May 13, 2021
fb5ba92
UPD Update raft pin
dantegd May 14, 2021
62109d0
Merge branch-21.06 into fea-rapids-cmake
dantegd May 17, 2021
e377b00
ENH Update raft pin and remove build.sh not used options
dantegd May 17, 2021
06a2679
Update cpp/cmake/thirdparty/get_rmm.cmake
dantegd May 18, 2021
77d1f0b
Update cpp/cmake/thirdparty/get_raft.cmake
dantegd May 18, 2021
0818ce7
Update cpp/cmake/thirdparty/get_cumlprims_mg.cmake
dantegd May 18, 2021
f11424c
Update cpp/cmake/thirdparty/get_rmm.cmake
dantegd May 18, 2021
bda9d05
Update cpp/cmake/thirdparty/get_raft.cmake
dantegd May 18, 2021
15115b1
Update cpp/CMakeLists.txt
dantegd May 18, 2021
9b10702
ENH Make setuputils deduce version of main branch from cmakelists
dantegd May 19, 2021
b584bc6
Update cpp/CMakeLists.txt
dantegd May 19, 2021
57c2aeb
Merge remote-tracking branch 'origin/branch-21.06' into fea-rapids-cmake
dantegd May 20, 2021
3aa919d
Merge branch 'fea-rapids-cmake' of github.com:dantegd/cuml into fea-r…
dantegd May 20, 2021
6f8d028
FIX revert changes to doxygen to avoid more changes in this PR
dantegd May 20, 2021
22eabf1
FIX remove required from find doxygen and add missing include from we…
dantegd May 20, 2021
3dd3962
FIX Pin thrust to 1.10 because 1.12 causes a segfault in SVC
dantegd May 21, 2021
3c9dc67
FIX copyright year
dantegd May 21, 2021
33b6317
FIX for thrust target install
dantegd May 21, 2021
deb903b
DOC Update cmake docs
dantegd May 24, 2021
86cc454
Merge branch 'fea-rapids-cmake' of github.com:dantegd/cuml into fea-r…
dantegd May 24, 2021
572e975
Merge remote-tracking branch 'origin/branch-21.06' into fea-rapids-cmake
dantegd May 25, 2021
bae8ab0
FIX missing faiss link that somehow hadn't been caught before by CI
dantegd May 25, 2021
43ae795
FIX remove duplicated include
dantegd May 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 103 additions & 68 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ARGS=$*
REPODIR=$(cd $(dirname $0); pwd)

VALIDTARGETS="clean libcuml cuml cpp-mgtests prims bench prims-bench cppdocs pydocs"
VALIDFLAGS="-v -g -n --allgpuarch --buildfaiss --buildgtest --singlegpu --nvtx --show_depr_warn --codecov --ccache -h --help "
VALIDFLAGS="-v -g -n --allgpuarch --singlegpu --nolibcumltest --nvtx --show_depr_warn --codecov --ccache -h --help "
VALIDARGS="${VALIDTARGETS} ${VALIDFLAGS}"
HELP="$0 [<target> ...] [<flag> ...]
where <target> is:
Expand All @@ -28,25 +28,24 @@ HELP="$0 [<target> ...] [<flag> ...]
around the C++ code.
cuml - build the cuml Python package
cpp-mgtests - build libcuml mnmg tests. Builds MPI communicator, adding MPI as dependency.
prims - build the ML prims tests
bench - build the cuml C++ benchmark
prims - build the ml-prims tests
bench - build the libcuml C++ benchmark
prims-bench - build the ml-prims C++ benchmark
cppdocs - build the C++ API doxygen documentation
pydocs - build the general and Python API documentation
and <flag> is:
-v - verbose build mode
-g - build for debug
-n - no install step
-h - print this text
--allgpuarch - build for all supported GPU architectures
--buildfaiss - build faiss statically into libcuml
--buildgtest - build googletest library
--singlegpu - Build libcuml and cuml without multigpu components
--nolibcumltest - disable building libcuml C++ tests for a faster build
--nvtx - Enable nvtx for profiling support
--show_depr_warn - show cmake deprecation warnings
--codecov - Enable code coverage support by compiling with Cython linetracing
and profiling enabled (WARNING: Impacts performance)
--ccache - Use ccache to cache previous compilations
-h - print this text

default action (no args) is to build and install 'libcuml', 'cuml', and 'prims' targets only for the detected GPU arch

Expand Down Expand Up @@ -74,16 +73,17 @@ CCACHE=OFF
CLEAN=0
BUILD_DISABLE_DEPRECATION_WARNING=ON
BUILD_CUML_STD_COMMS=ON
BUILD_CPP_MG_TESTS=OFF
BUILD_CUML_TESTS=ON
BUILD_CUML_MG_TESTS=OFF
BUILD_STATIC_FAISS=OFF
CMAKE_LOG_LEVEL=WARNING

# Set defaults for vars that may not have been defined externally
# FIXME: if INSTALL_PREFIX is not set, check PREFIX, then check
# CONDA_PREFIX, but there is no fallback from there!
INSTALL_PREFIX=${INSTALL_PREFIX:=${PREFIX:=${CONDA_PREFIX}}}
PARALLEL_LEVEL=${PARALLEL_LEVEL:=""}


# Default to Ninja if generator is not specified
export CMAKE_GENERATOR="${CMAKE_GENERATOR:=Ninja}"

Expand Down Expand Up @@ -112,58 +112,91 @@ if hasArg -h || hasArg --help; then
exit 0
fi

# Check for valid usage
if (( ${NUMARGS} != 0 )); then
for a in ${ARGS}; do
if ! (echo " ${VALIDARGS} " | grep -q " ${a} "); then
echo "Invalid option: ${a}"
exit 1
fi
done
fi

# Process flags
if hasArg -v; then
VERBOSE=1
fi
if hasArg -g; then
BUILD_TYPE=Debug
fi
if hasArg -n; then
INSTALL_TARGET=""
fi
if hasArg --allgpuarch; then
BUILD_ALL_GPU_ARCH=1
fi
if hasArg --singlegpu; then
CUML_EXTRA_PYTHON_ARGS="${CUML_EXTRA_PYTHON_ARGS} --singlegpu"
SINGLEGPU_CPP_FLAG=ON
fi
if hasArg cpp-mgtests; then
BUILD_CPP_MG_TESTS=ON
fi
if hasArg --buildfaiss; then
BUILD_STATIC_FAISS=ON
fi
if hasArg --buildgtest; then
BUILD_GTEST=ON
fi
if hasArg --nvtx; then
NVTX=ON
fi
if hasArg --show_depr_warn; then
BUILD_DISABLE_DEPRECATION_WARNING=OFF
fi
if hasArg --codecov; then
CUML_EXTRA_PYTHON_ARGS="${CUML_EXTRA_PYTHON_ARGS} --linetrace=1 --profile"
fi
if hasArg --ccache; then
CCACHE=ON
fi
if hasArg clean; then
CLEAN=1
fi


# Long arguments
LONG_ARGUMENT_LIST=(
"verbose"
"debug"
"no-install"
"allgpuarch"
"singlegpu"
"nvtx"
"show_depr_warn"
"codecov"
"ccache"
"nolibcumltest"
)

# Short arguments
ARGUMENT_LIST=(
"v"
"g"
"n"
)

# read arguments
opts=$(getopt \
--longoptions "$(printf "%s," "${LONG_ARGUMENT_LIST[@]}")" \
--name "$(basename "$0")" \
--options "$(printf "%s" "${ARGUMENT_LIST[@]}")" \
-- "$@"
)

if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi

eval set -- "$opts"

while true; do
case "$1" in
-h)
show_help
exit 0
;;
-v | --verbose )
VERBOSE=true
CMAKE_LOG_LEVEL=VERBOSE
;;
-g | --debug )
BUILD_TYPE=Debug
;;
-n | --no-install )
INSTALL_TARGET=""
;;
--allgpuarch )
BUILD_ALL_GPU_ARCH=1
;;
--singlegpu )
CUML_EXTRA_PYTHON_ARGS="${CUML_EXTRA_PYTHON_ARGS} --singlegpu"
SINGLEGPU_CPP_FLAG=ON
;;
--nvtx )
NVTX=ON
;;
--show_depr_warn )
BUILD_DISABLE_DEPRECATION_WARNING=OFF
;;
--codecov )
CUML_EXTRA_PYTHON_ARGS="${CUML_EXTRA_PYTHON_ARGS} --linetrace=1 --profile"
;;
--ccache )
CCACHE=ON
;;
--nolibcumltest )
BUILD_CUML_TESTS=OFF
;;
--)
shift
break
;;
esac
shift
done


# If clean given, run it prior to any other steps
if (( ${CLEAN} == 1 )); then
# If the dirs to clean are mounted dirs in a container, the
Expand All @@ -182,36 +215,35 @@ if (( ${CLEAN} == 1 )); then
cd ${REPODIR}
fi

# Before

################################################################################
# Configure for building all C++ targets
if completeBuild || hasArg libcuml || hasArg prims || hasArg bench || hasArg prims-bench || hasArg cppdocs || hasArg cpp-mgtests; then
if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then
GPU_ARCH=""
CUML_CMAKE_CUDA_ARCHITECTURES="NATIVE"
echo "Building for the architecture of the GPU in the system..."
else
GPU_ARCH="-DGPU_ARCHS=ALL"
CUML_CMAKE_CUDA_ARCHITECTURES="ALL"
echo "Building for *ALL* supported GPU architectures..."
fi

mkdir -p ${LIBCUML_BUILD_DIR}
cd ${LIBCUML_BUILD_DIR}

cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DBLAS_LIBRARIES=${INSTALL_PREFIX}/lib/libopenblas.so.0 \
${GPU_ARCH} \
-DCMAKE_CUDA_ARCHITECTURES=${CUML_CMAKE_CUDA_ARCHITECTURES} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DBUILD_CUML_C_LIBRARY=ON \
-DSINGLEGPU=${SINGLEGPU_CPP_FLAG} \
-DWITH_UCX=ON \
-DBUILD_CUML_MPI_COMMS=${BUILD_CPP_MG_TESTS} \
-DBUILD_CUML_MG_TESTS=${BUILD_CPP_MG_TESTS} \
-DBUILD_STATIC_FAISS=${BUILD_STATIC_FAISS} \
-DBUILD_CUML_TESTS=${BUILD_CUML_TESTS} \
-DBUILD_CUML_MPI_COMMS=${BUILD_CUML_MG_TESTS} \
-DBUILD_CUML_MG_TESTS=${BUILD_CUML_MG_TESTS} \
-DNVTX=${NVTX} \
-DPARALLEL_LEVEL=${PARALLEL_LEVEL} \
-DUSE_CCACHE=${CCACHE} \
-DNCCL_PATH=${INSTALL_PREFIX} \
-DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \
-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
-DCMAKE_MESSAGE_LOG_LEVEL=${CMAKE_LOG_LEVEL} \
${CUML_EXTRA_CMAKE_ARGS} \
..
fi
Expand All @@ -220,7 +252,10 @@ fi

MAKE_TARGETS=
if hasArg libcuml; then
MAKE_TARGETS="${MAKE_TARGETS}cuml++ cuml ml"
MAKE_TARGETS="${MAKE_TARGETS}cuml++ cuml"
if ! hasArg --nolibcumltest; then
MAKE_TARGETS="${MAKE_TARGETS} ml"
fi
fi
if hasArg cpp-mgtests; then
MAKE_TARGETS="${MAKE_TARGETS} ml_mg"
Expand Down Expand Up @@ -252,7 +287,7 @@ fi

if hasArg cppdocs; then
cd ${LIBCUML_BUILD_DIR}
cmake --build ${LIBCUML_BUILD_DIR} --target doc
cmake --build ${LIBCUML_BUILD_DIR} --target docs_cuml
fi


Expand Down
3 changes: 2 additions & 1 deletion conda/recipes/libcuml/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build:

requirements:
build:
- cmake>=3.14
- cmake>=3.20.1
- clang=8.0.1
- clang-tools=8.0.1
host:
Expand All @@ -48,6 +48,7 @@ requirements:
- treelite=1.3.0
- faiss-proc=*=cuda
- gtest=1.10.0
- gmock
- conda-forge::libfaiss=1.7.0
run:
- libcumlprims {{ minor_version }}
Expand Down
Loading