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

Remove unused CMake dependencies and build variables #23

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 1 addition & 50 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARGS=$*
# script, and that this script resides in the repo dir!
REPODIR=$(cd $(dirname $0); pwd)

VALIDARGS="clean libucxx libucxx_python ucxx benchmarks tests examples -v -g -n -l --show_depr_warn -h --build_metrics --incl_cache_stats"
VALIDARGS="clean libucxx libucxx_python ucxx benchmarks tests examples -v -g -n -l --show_depr_warn -h"
HELP="$0 [clean] [libucxx] [libucxx_python] [ucxx] [benchmarks] [tests] [examples] [-v] [-g] [-n] [-h] [--cmake-args=\\\"<args>\\\"]
clean - remove all existing build artifacts and configuration (start
over)
Expand All @@ -32,8 +32,6 @@ HELP="$0 [clean] [libucxx] [libucxx_python] [ucxx] [benchmarks] [tests] [example
-g - build for debug
-n - no install step
--show_depr_warn - show cmake deprecation warnings
--build_metrics - generate build metrics report for libucxx
--incl_cache_stats - include cache statistics in build metrics report
--cmake-args=\\\"<args>\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument)
-h | --h[elp] - print this text

Expand All @@ -52,8 +50,6 @@ BUILD_BENCHMARKS=OFF
BUILD_TESTS=OFF
BUILD_EXAMPLES=OFF
BUILD_DISABLE_DEPRECATION_WARNINGS=ON
BUILD_REPORT_METRICS=OFF
BUILD_REPORT_INCL_CACHE_STATS=OFF
UCXX_ENABLE_PYTHON=OFF
UCXX_ENABLE_RMM=OFF

Expand Down Expand Up @@ -135,16 +131,6 @@ fi
if hasArg --show_depr_warn; then
BUILD_DISABLE_DEPRECATION_WARNINGS=OFF
fi
if hasArg --ptds; then
BUILD_PER_THREAD_DEFAULT_STREAM=ON
fi
if hasArg --build_metrics; then
BUILD_REPORT_METRICS=ON
fi

if hasArg --incl_cache_stats; then
BUILD_REPORT_INCL_CACHE_STATS=ON
fi

if buildAll || hasArg libucxx_python; then
UCXX_ENABLE_PYTHON=ON
Expand Down Expand Up @@ -175,12 +161,6 @@ fi


if buildAll || hasArg libucxx; then
# get the current count before the compile starts
if [[ "$BUILD_REPORT_INCL_CACHE_STATS" == "ON" && -x "$(command -v sccache)" ]]; then
# zero the sccache statistics
sccache --zero-stats
fi

pwd
cmake -S $REPODIR/cpp -B ${LIB_BUILD_DIR} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
Expand All @@ -200,35 +180,6 @@ if buildAll || hasArg libucxx; then
compile_end=$(date +%s)
compile_total=$(( compile_end - compile_start ))

# Record build times
if [[ "$BUILD_REPORT_METRICS" == "ON" && -f "${LIB_BUILD_DIR}/.ninja_log" ]]; then
echo "Formatting build metrics"
python ${REPODIR}/cpp/scripts/sort_ninja_log.py ${LIB_BUILD_DIR}/.ninja_log --fmt xml > ${LIB_BUILD_DIR}/ninja_log.xml
MSG="<p>"
# get some sccache stats after the compile
if [[ "$BUILD_REPORT_INCL_CACHE_STATS" == "ON" && -x "$(command -v sccache)" ]]; then
COMPILE_REQUESTS=$(sccache -s | grep "Compile requests \+ [0-9]\+$" | awk '{ print $NF }')
CACHE_HITS=$(sccache -s | grep "Cache hits \+ [0-9]\+$" | awk '{ print $NF }')
HIT_RATE=$(echo - | awk "{printf \"%.2f\n\", $CACHE_HITS / $COMPILE_REQUESTS * 100}")
MSG="${MSG}<br/>cache hit rate ${HIT_RATE} %"
fi
MSG="${MSG}<br/>parallel setting: $PARALLEL_LEVEL"
MSG="${MSG}<br/>parallel build time: $compile_total seconds"
if [[ -f "${LIB_BUILD_DIR}/libucxx.so" ]]; then
LIBUCXX_FS=$(ls -lh ${LIB_BUILD_DIR}/libucxx.so | awk '{print $5}')
LIBUCXX_COMMON_FS=$(ls -lh ${LIB_BUILD_DIR}/libucxx_common.so | awk '{print $5}')
MSG="${MSG}<br/>libucxx.so size: $LIBUCXX_FS"
MSG="${MSG}<br/>libucxx_common.so size: $LIBUCXX_COMMON_FS"
fi
if [[ -f "${LIB_BUILD_DIR}/libpython.so" ]]; then
LIBUCXX_PYTHON_FS=$(ls -lh ${LIB_BUILD_DIR}/libucxx_python.so | awk '{print $5}')
MSG="${MSG}<br/>libucxx_python.so size: $LIBUCXX_PYTHON_FS"
fi
echo "$MSG"
python ${REPODIR}/cpp/scripts/sort_ninja_log.py ${LIB_BUILD_DIR}/.ninja_log --fmt html --msg "$MSG" > ${LIB_BUILD_DIR}/ninja_log.html
cp ${LIB_BUILD_DIR}/.ninja_log ${LIB_BUILD_DIR}/ninja.log
fi

if [[ ${INSTALL_TARGET} != "" ]]; then
cmake --build . -j${PARALLEL_LEVEL} --target install ${VERBOSE_FLAG}
if [[ ${UCXX_ENABLE_PYTHON} == "ON" ]]; then
Expand Down
2 changes: 0 additions & 2 deletions build_and_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ HELP="$0 [cpp_tests] [cpp_bench] [cpp_examples] [py_tests] [py_async_tests] [py_
-g - build for debug
-n - no install step
--show_depr_warn - show cmake deprecation warnings
--build_metrics - generate build metrics report for libucxx
--incl_cache_stats - include cache statistics in build metrics report
--cmake-args=\\\"<args>\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument)
-h | --h[elp] - print this text

Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/ucxx/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# SPDX-License-Identifier: BSD-3-Clause

export ucxx_ROOT="$(realpath ./cpp/build)"
./build.sh -n -v libucxx libucxx_python benchmarks examples tests --build_metrics --incl_cache_stats --cmake-args=\"-DCMAKE_INSTALL_LIBDIR=lib\"
./build.sh -n -v libucxx libucxx_python benchmarks examples tests --cmake-args=\"-DCMAKE_INSTALL_LIBDIR=lib\"
49 changes: 2 additions & 47 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,15 @@ cmake_minimum_required(VERSION 3.23.1 FATAL_ERROR)
include(../fetch_rapids.cmake)
include(rapids-cmake)
include(rapids-cpm)
include(rapids-cuda)
include(rapids-export)
include(rapids-find)

rapids_cuda_init_architectures(UCX)

project(
UCXX
VERSION 0.0.1
LANGUAGES C CXX CUDA
LANGUAGES C CXX
)
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.5)
message(
FATAL_ERROR
"libucxx requires CUDA Toolkit 11.5+ to compile (nvcc ${CMAKE_CUDA_COMPILER_VERSION} provided)"
)
endif()

# Needed because GoogleBenchmark changes the state of FindThreads.cmake, causing subsequent runs to
# have different values for the `Threads::Threads` target. Setting this flag ensures
Expand All @@ -41,14 +33,6 @@ option(BUILD_SHARED_LIBS "Build UCXX shared libraries" ON)
option(UCXX_ENABLE_PYTHON "Enable support for Python notifier thread" OFF)
option(UCXX_ENABLE_RMM "Enable support for CUDA multi-buffer transfer with RMM" OFF)
option(DISABLE_DEPRECATION_WARNINGS "Disable warnings generated from deprecated declarations." OFF)
# Option to enable line info in CUDA device compilation to allow introspection when profiling /
# memchecking
option(CUDA_ENABLE_LINEINFO
"Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF
)
option(CUDA_WARNINGS_AS_ERRORS "Enable -Werror=all-warnings for all CUDA compilation" ON)
# cudart can be statically linked or dynamically linked. The python ecosystem wants dynamic linking
option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF)

message(VERBOSE "UCXX: Configure CMake to build tests: ${BUILD_TESTS}")
message(VERBOSE "UCXX: Configure CMake to build benchmarks: ${BUILD_BENCHMARKS}")
Expand All @@ -60,11 +44,6 @@ message(
VERBOSE
"UCXX: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNINGS}"
)
message(
VERBOSE
"UCXX: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}"
)
message(VERBOSE "UCXX: Statically link the CUDA runtime: ${CUDA_STATIC_RUNTIME}")

# Set a default build type if none was specified
rapids_cmake_build_type("Release")
Expand All @@ -73,9 +52,7 @@ set(UCXX_BUILD_BENCHMARKS ${BUILD_BENCHMARKS})
set(UCXX_BUILD_EXAMPLES ${BUILD_EXAMPLES})

set(UCXX_CXX_FLAGS "")
set(UCXX_CUDA_FLAGS "")
set(UCXX_CXX_DEFINITIONS "")
set(UCXX_CUDA_DEFINITIONS "")

# Set RMM logging level
set(RMM_LOGGING_LEVEL
Expand All @@ -97,17 +74,11 @@ rapids_cmake_support_conda_env(conda_env MODIFY_PREFIX_PATH)

# ##################################################################################################
# * compiler options ------------------------------------------------------------------------------
rapids_find_package(
CUDAToolkit REQUIRED
BUILD_EXPORT_SET ucxx-exports
INSTALL_EXPORT_SET ucxx-exports
)
rapids_find_package(
ucx REQUIRED
BUILD_EXPORT_SET ucxx-exports
INSTALL_EXPORT_SET ucxx-exports
)
include(cmake/Modules/ConfigureCUDA.cmake) # set other CUDA compilation flags

# ##################################################################################################
# * dependencies ----------------------------------------------------------------------------------
Expand Down Expand Up @@ -163,15 +134,12 @@ set_target_properties(
# set target compile options
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
INTERFACE_POSITION_INDEPENDENT_CODE ON
)

target_compile_options(
ucxx PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${UCXX_CXX_FLAGS}>"
"$<$<COMPILE_LANGUAGE:CUDA>:${UCXX_CUDA_FLAGS}>"
)

# Specify include paths for the current target and dependents
Expand All @@ -185,7 +153,6 @@ target_include_directories(

target_compile_definitions(
ucxx PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${UCXX_CXX_DEFINITIONS}>"
"$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:${UCXX_CUDA_DEFINITIONS}>>"
)

# Enable RMM if necessary
Expand All @@ -207,18 +174,6 @@ if(TARGET conda_env)
target_link_libraries(ucxx PRIVATE conda_env)
endif()

if(CUDA_STATIC_RUNTIME)
# Tell CMake what CUDA language runtime to use
set_target_properties(ucxx PROPERTIES CUDA_RUNTIME_LIBRARY Static)
# Make sure to export to consumers what runtime we used
target_link_libraries(ucxx PUBLIC CUDA::cudart_static)
else()
# Tell CMake what CUDA language runtime to use
set_target_properties(ucxx PROPERTIES CUDA_RUNTIME_LIBRARY Shared)
# Make sure to export to consumers what runtime we used
target_link_libraries(ucxx PUBLIC CUDA::cudart)
endif()

add_library(ucxx::ucxx ALIAS ucxx)

# Build Python if requested
Expand Down Expand Up @@ -347,6 +302,6 @@ add_custom_target(
# * make gdb helper scripts ------------------------------------------------------------------------

# build pretty-printer load script
if(Thrust_SOURCE_DIR AND rmm_SOURCE_DIR)
if(rmm_SOURCE_DIR)
configure_file(scripts/load-pretty-printers.in load-pretty-printers @ONLY)
endif()
47 changes: 0 additions & 47 deletions cpp/cmake/Modules/ConfigureCUDA.cmake

This file was deleted.

16 changes: 0 additions & 16 deletions cpp/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@ set_target_properties(
# set target compile options
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
INTERFACE_POSITION_INDEPENDENT_CODE ON
)

target_compile_options(
ucxx_python PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${UCXX_CXX_FLAGS}>"
"$<$<COMPILE_LANGUAGE:CUDA>:${UCXX_CUDA_FLAGS}>"
)

# Specify include paths for the current target and dependents
Expand All @@ -53,7 +50,6 @@ target_include_directories(

target_compile_definitions(
ucxx_python PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${UCXX_CXX_DEFINITIONS}>"
"$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:${UCXX_CUDA_DEFINITIONS}>>"
)

target_compile_definitions(ucxx_python PUBLIC UCXX_ENABLE_PYTHON)
Expand All @@ -71,18 +67,6 @@ if(TARGET conda_env)
target_link_libraries(ucxx_python PRIVATE conda_env)
endif()

if(CUDA_STATIC_RUNTIME)
# Tell CMake what CUDA language runtime to use
set_target_properties(ucxx_python PROPERTIES CUDA_RUNTIME_LIBRARY Static)
# Make sure to export to consumers what runtime we used
target_link_libraries(ucxx_python PUBLIC CUDA::cudart_static)
else()
# Tell CMake what CUDA language runtime to use
set_target_properties(ucxx_python PROPERTIES CUDA_RUNTIME_LIBRARY Shared)
# Make sure to export to consumers what runtime we used
target_link_libraries(ucxx_python PUBLIC CUDA::cudart)
endif()

include(GNUInstallDirs)
add_library(ucxx::python ALIAS ucxx_python)
install(DIRECTORY ${UCXX_SOURCE_DIR}/python/include/ucxx
Expand Down
12 changes: 1 addition & 11 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ cmake_minimum_required(VERSION 3.23.1 FATAL_ERROR)
set(ucxx_version 0.0.1)

include(../fetch_rapids.cmake)
include(rapids-cuda)
rapids_cuda_init_architectures(ucxx-python)

project(
ucxx-python
Expand All @@ -18,13 +16,12 @@ project(
# language to be enabled here. The test project that is built in scikit-build to verify
# various linking options for the python library is hardcoded to build with C, so until
# that is fixed we need to keep C.
C CXX CUDA
C CXX
)

option(FIND_UCXX_CPP "Search for existing UCXX C++ installations before defaulting to local files"
OFF
)
option(UCXX_BUILD_WHEELS "Whether this build is generating a Python wheel." OFF)

# If the user requested it we attempt to find UCXX.
if(FIND_UCXX_CPP)
Expand All @@ -40,13 +37,6 @@ if(NOT ucxx_FOUND)
set(BUILD_BENCHMARKS OFF)

set(_exclude_from_all "")
if(UCXX_BUILD_WHEELS)
# Statically link cudart if building wheels
set(CUDA_STATIC_RUNTIME ON)

# Don't install the UCXX C++ targets into wheels
set(_exclude_from_all EXCLUDE_FROM_ALL)
endif()

add_subdirectory(../cpp ucxx-cpp ${_exclude_from_all})

Expand Down