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

simplify wholegraph CMake, other small building and testing changes #102

Merged
merged 2 commits into from
Jan 3, 2025
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
exclude: '^thirdparty'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: debug-statements
Expand Down Expand Up @@ -54,7 +54,7 @@ repos:
setup[.]cfg$
- id: verify-alpha-spec
- repo: https://github.com/rapidsai/dependency-file-generator
rev: v1.16.0
rev: v1.17.0
hooks:
- id: rapids-dependency-file-generator
args: ["--clean"]
6 changes: 2 additions & 4 deletions ci/build_cpp.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -13,13 +13,11 @@ export CMAKE_GENERATOR=Ninja

rapids-print-env

version=$(rapids-generate-version)

rapids-logger "Begin cpp build"

sccache --zero-stats

RAPIDS_PACKAGE_VERSION=${version} rapids-conda-retry mambabuild conda/recipes/libwholegraph
RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) rapids-conda-retry mambabuild conda/recipes/libwholegraph

sccache --show-adv-stats

Expand Down
3 changes: 2 additions & 1 deletion ci/build_docs.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
# Copyright (c) 2023-2025, NVIDIA CORPORATION.

set -euo pipefail

rapids-logger "Create test conda environment"
. /opt/conda/etc/profile.d/conda.sh

RAPIDS_VERSION="$(rapids-version)"
export RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For re-use in cpp/Doxyfile


rapids-dependency-file-generator \
--output conda \
Expand Down
4 changes: 1 addition & 3 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2018-2024, NVIDIA CORPORATION.
# Copyright (c) 2018-2025, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -73,8 +73,6 @@ for DEP in "${DEPENDENCIES[@]}"; do
done
done

sed_runner "s/\(PROJECT_NUMBER[[:space:]]*\)=.*/\1= ${NEXT_SHORT_TAG}/" cpp/Doxyfile

# CI files
for FILE in .github/workflows/*.yaml; do
sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_SHORT_TAG}/g" "${FILE}"
Expand Down
4 changes: 2 additions & 2 deletions conda/recipes/pylibwholegraph/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.

{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
Expand Down Expand Up @@ -60,7 +60,7 @@ requirements:
{% if cuda_major == "11" %}
- cudatoolkit
{% endif %}
- cython
- cython >=3.0.0
- libwholegraph ={{ version }}
- python
- rapids-build-backend >=0.3.0,<0.4.0.dev0
Expand Down
34 changes: 7 additions & 27 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2018-2024, NVIDIA CORPORATION.
# Copyright (c) 2018-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,20 +14,9 @@
# limitations under the License.
#=============================================================================

cmake_minimum_required(VERSION 3.23.1 FATAL_ERROR)
cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)

include(../rapids_config.cmake)

set(WHOLEGRAPH_VERSION "${RAPIDS_VERSION_MAJOR_MINOR}.00")

include(FetchContent)

FetchContent_Declare(
rapids-cmake
GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git
GIT_TAG origin/branch-${RAPIDS_VERSION_MAJOR_MINOR}
)
FetchContent_MakeAvailable(rapids-cmake)
include(rapids-cmake)
include(rapids-cpm)
include(rapids-cuda)
Expand All @@ -36,13 +25,11 @@ include(rapids-find)

rapids_cuda_init_architectures(WHOLEGRAPH)

project(WHOLEGRAPH VERSION ${WHOLEGRAPH_VERSION} LANGUAGES CXX CUDA)

set(CMAKE_CXX_STANDARD 17)

set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES FALSE)
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES FALSE)
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES FALSE)
project(
WHOLEGRAPH
VERSION "${RAPIDS_VERSION}"
LANGUAGES CXX CUDA
)

# Write the version header
rapids_cmake_write_version_file(include/wholegraph/version_config.hpp)
Expand Down Expand Up @@ -109,11 +96,6 @@ endif(CMAKE_COMPILER_IS_GNUCXX)

message("-- Building for GPU_ARCHS = ${CMAKE_CUDA_ARCHITECTURES}")

#list(APPEND WHOLEGRAPH_CUDA_FLAGS --expt-extended-lambda --expt-relaxed-constexpr)
#list(APPEND WHOLEGRAPH_CUDA_FLAGS -Werror=cross-execution-space-call -Wno-deprecated-declarations -Xptxas=--disable-warnings)
#list(APPEND WHOLEGRAPH_CUDA_FLAGS -Xcompiler=-Wall,-Wno-error=sign-compare,-Wno-error=unused-but-set-variable)
#list(APPEND WHOLEGRAPH_CUDA_FLAGS -Xfatbin=-compress-all)

# Option to enable line info in CUDA device compilation to allow introspection when profiling /
# memchecking
if (CMAKE_CUDA_LINEINFO)
Expand Down Expand Up @@ -171,8 +153,6 @@ target_compile_options(wholegraph
"$<$<COMPILE_LANGUAGE:CUDA>:${WHOLEGRAPH_CUDA_FLAGS}>"
)

#target_link_libraries(wholegraph PRIVATE -static-libgcc -static-libstdc++)

################################################################################
# - include paths --------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion cpp/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "WholeGraph C API"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 25.02
PROJECT_NUMBER = $(RAPIDS_VERSION_MAJOR_MINOR)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what other RAPIDS projects are doing, e.g. rmm: https://github.com/rapidsai/rmm/blob/8275ba8dc94a7fc63d9513acd81e3a2cf30a85d1/doxygen/Doxyfile#L41

One less hard-coded version is nice for:

  • smaller diffs on updates when development switches to new versions
  • simpler update-version.sh
  • reduced risk of inconsistencies between docs and code


# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
30 changes: 7 additions & 23 deletions python/pylibwholegraph/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2018-2024, NVIDIA CORPORATION.
# Copyright (c) 2018-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,23 +17,17 @@
cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)

include(../../rapids_config.cmake)
set(WHOLEGRAPH_VERSION "${RAPIDS_VERSION_MAJOR_MINOR}.00")

include(FetchContent)

FetchContent_Declare(
rapids-cmake
GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git
GIT_TAG origin/branch-${RAPIDS_VERSION_MAJOR_MINOR}
)
FetchContent_MakeAvailable(rapids-cmake)
include(rapids-cmake)
include(rapids-cuda)
include(rapids-cpm)

rapids_cuda_init_architectures(PYLIBWHOLEGRAPH)

project(PYLIBWHOLEGRAPH VERSION ${WHOLEGRAPH_VERSION} LANGUAGES CXX CUDA)
project(
PYLIBWHOLEGRAPH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're a little inconsistent about this across repos but it might be nice to use lowercase pylibwholegraph here. However, it's fine if that is out-of-scope for this PR (and/or not important enough to change at all).

e.g. cuDF has project(CUDF...) but also project(pylibcudf...), so our casing is not consistent even within a repo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, yeah I'd noticed that. Let's treat it as out-of-scope for this PR. I'd like to merge this to simplify things ahead of setting up libwholegraph wheels.

The project name flows into a bunch of other variables that CMake generates (see https://cmake.org/cmake/help/latest/command/project.html#command:project) and I'm not sure if those are case-sensitive, so changing the case could require other changes to CMake code here (and maybe in other places that build wholegraph from source, like RAPIDS devcontainers). I'd rather not work through that right now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, all those downstream uses are case sensitive. At some point we may want to strive for consistency across RAPIDS but it’s low priority - lots of work, risk of breakage, and not a lot of value.

VERSION "${RAPIDS_VERSION}"
LANGUAGES CXX CUDA
)

##############################################################################
# - User Options ------------------------------------------------------------
Expand Down Expand Up @@ -122,12 +116,6 @@ else()
"cmake prefix ${CMAKE_PREFIX_PATH} or user dir $ENV{LIBWHOLEGRAPH_DIR}")
endif()

execute_process(
COMMAND "${Python_EXECUTABLE}" -c "import os; import skbuild; print(os.path.join(os.path.dirname(skbuild.__file__), 'resources/cmake'))"
OUTPUT_VARIABLE SKBUILD_CMAKE_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE
)
list(APPEND CMAKE_MODULE_PATH "${SKBUILD_CMAKE_MODULE_PATH}")

include(rapids-cython-core)
rapids_cython_init()

Expand All @@ -142,15 +130,11 @@ message(VERBOSE "PYLIBWHOLEGRAPH: Enable detection of conda environment for depe
# this is needed for clang-tidy runs
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

list(APPEND CXX_DEFINITIONS WHOLEGRAPH_VERSION=${WHOLEGRAPH_VERSION})

message(STATUS "PYLIBWHOLEGRAPH: DEFAULT_CXX_FLAGS='${DEFAULT_CXX_FLAGS}'")
message(STATUS "PYLIBWHOLEGRAPH: CXX_FLAGS='${CXX_FLAGS}'")
message(STATUS "PYLIBWHOLEGRAPH: CXX_DEFINITIONS='${CXX_DEFINITIONS}'")

##############################################################################
# - Variables ----------------------------------------------------------------

set(WHOLEGRAPH_CPP_TARGET "wholegraph::wholegraph" CACHE STRING "libwholegraph target name")
# - Cython modules -----------------------------------------------------------

add_subdirectory(pylibwholegraph/binding)
Loading