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 CPM, fix build for latest branch-0.20 changes #152

Merged
merged 1 commit into from
Apr 16, 2021
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
2 changes: 2 additions & 0 deletions modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ add_library(${PROJECT_NAME} SHARED ${NODE_RAPIDS_CORE_SRC_FILES} ${CMAKE_JS_SRC}
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SUFFIX ".node"
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
Expand Down
20 changes: 11 additions & 9 deletions modules/core/cmake/Modules/ConfigureCUDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@
# limitations under the License.
#=============================================================================

include(get_cpm)
function(find_and_configure_cudf VERSION)

_set_package_dir_if_exists(cudf cudf)
_set_package_dir_if_exists(dlpack dlpack)
_set_package_dir_if_exists(jitify jitify)
_set_package_dir_if_exists(Thrust thrust)
_set_package_dir_if_exists(libcudacxx libcudacxx)
_set_package_dir_if_exists(arrow_static arrow)
_set_package_dir_if_exists(arrow_cuda_static arrow)
include(get_cpm)

function(find_and_configure_cudf VERSION)
_clean_build_dirs_if_not_fully_built(cudf libcudf.so)

_set_package_dir_if_exists(cudf cudf)
_set_package_dir_if_exists(dlpack dlpack)
_set_package_dir_if_exists(jitify jitify)
_set_package_dir_if_exists(Thrust thrust)
_set_package_dir_if_exists(libcudacxx libcudacxx)
_set_package_dir_if_exists(arrow_static arrow)
_set_package_dir_if_exists(arrow_cuda_static arrow)

include(ConfigureRMM)

Expand Down
8 changes: 5 additions & 3 deletions modules/core/cmake/Modules/ConfigureCUSPATIAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
# limitations under the License.
#=============================================================================

include(get_cpm)
function(find_and_configure_cuspatial VERSION)

_set_package_dir_if_exists(cuspatial cuspatial)
include(get_cpm)

function(find_and_configure_cuspatial VERSION)
_clean_build_dirs_if_not_fully_built(cuspatial libcuspatial.so)

_set_package_dir_if_exists(cuspatial cuspatial)

include(ConfigureCUDF)

Expand Down
2 changes: 1 addition & 1 deletion modules/core/cmake/Modules/ConfigureCXX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if(NODE_RAPIDS_USE_CCACHE)
endif(NODE_RAPIDS_USE_CCACHE)

execute_process(COMMAND node -p
"require('@rapidsai/core').cpp_include_path"
"require('@rapidsai/core').cpp_core_include_path"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE RAPIDS_CORE_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down
9 changes: 6 additions & 3 deletions modules/core/cmake/Modules/ConfigureCuGraph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
# limitations under the License.
#=============================================================================

include(get_cpm)
function(find_and_configure_cugraph VERSION)

_set_package_dir_if_exists(cugraph cugraph)
include(get_cpm)

function(find_and_configure_cugraph VERSION)
_clean_build_dirs_if_not_fully_built(cugraph libcugraph.so)

_set_package_dir_if_exists(cugraph cugraph)

include(ConfigureCUDF)

Expand Down Expand Up @@ -64,6 +66,7 @@ function(find_and_configure_cugraph VERSION)

set_target_properties(cugraph
PROPERTIES BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
# set target compile options
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
Expand Down
10 changes: 5 additions & 5 deletions modules/core/cmake/Modules/ConfigureRMM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
# limitations under the License.
#=============================================================================

include(get_cpm)
function(find_and_configure_rmm VERSION)

_set_package_dir_if_exists(rmm rmm)
_set_package_dir_if_exists(spdlog spdlog)
_set_package_dir_if_exists(Thrust thrust)
include(get_cpm)

function(find_and_configure_rmm VERSION)
_set_package_dir_if_exists(rmm rmm)
_set_package_dir_if_exists(spdlog spdlog)
_set_package_dir_if_exists(Thrust thrust)

if(NOT TARGET rmm::rmm)

Expand Down
61 changes: 44 additions & 17 deletions modules/core/cmake/Modules/get_cpm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@

if(DEFINED CPM_SOURCE_CACHE AND
(DEFINED ENV{CPM_SOURCE_CACHE}) AND
(DEFINED CPM_DOWNLOAD_VERSION) AND
(DEFINED CPM_DOWNLOAD_LOCATION))
message(STATUS "get_cpm: CPM already loaded")
return()
if(DEFINED ENV{NODE_RAPIDS_USE_LOCAL_DEPS_BUILD_DIRS})
message(STATUS "get_cpm: CPM already loaded")
return()
endif()
if(DEFINED CPM_BINARY_CACHE AND
(DEFINED ENV{CPM_BINARY_CACHE}))
message(STATUS "get_cpm: CPM already loaded")
return()
endif()
endif()

execute_process(COMMAND node -p
Expand All @@ -31,7 +39,22 @@ set(CPM_SOURCE_CACHE "${NODE_RAPIDS_CPM_SOURCE_CACHE}")
set(ENV{CPM_SOURCE_CACHE} "${NODE_RAPIDS_CPM_SOURCE_CACHE}")
message(STATUS "get_cpm: Using CPM source cache: $ENV{CPM_SOURCE_CACHE}")

set(CPM_DOWNLOAD_VERSION 4fad2eac0a3741df3d9c44b791f9163b74aa7b07) # 0.32.0
if (NOT DEFINED ENV{NODE_RAPIDS_USE_LOCAL_DEPS_BUILD_DIRS})
execute_process(COMMAND node -p
"require('@rapidsai/core').cpm_binary_cache_path"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE NODE_RAPIDS_CPM_BINARY_CACHE
OUTPUT_STRIP_TRAILING_WHITESPACE)

set(CPM_BINARY_CACHE "${NODE_RAPIDS_CPM_BINARY_CACHE}")
set(ENV{CPM_BINARY_CACHE} "${NODE_RAPIDS_CPM_BINARY_CACHE}")
message(STATUS "get_cpm: Using CPM BINARY cache: $ENV{CPM_BINARY_CACHE}")

message(STATUS "get_cpm: Using CMake FetchContent base dir: ${NODE_RAPIDS_CPM_BINARY_CACHE}")
set(FETCHCONTENT_BASE_DIR "${NODE_RAPIDS_CPM_BINARY_CACHE}" CACHE STRING "" FORCE)
endif()

set(CPM_DOWNLOAD_VERSION 7644c3a40fc7889f8dee53ce21e85dc390b883dc) # v0.32.1

if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a tilde (~)
Expand All @@ -44,7 +67,7 @@ else()
endif()

if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(VERBOSE "get_cpm: Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
message(STATUS "get_cpm: Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(
DOWNLOAD
https://raw.githubusercontent.com/cpm-cmake/CPM.cmake/${CPM_DOWNLOAD_VERSION}/cmake/CPM.cmake
Expand All @@ -55,8 +78,23 @@ include(${CPM_DOWNLOAD_LOCATION})

function(_set_package_dir_if_exists pkg dir)
if (NOT DEFINED ENV{NODE_RAPIDS_USE_LOCAL_DEPS_BUILD_DIRS})
if (EXISTS "${FETCHCONTENT_BASE_DIR}/${dir}-build")
set(${pkg}_DIR "${FETCHCONTENT_BASE_DIR}/${dir}-build" PARENT_SCOPE)
if (EXISTS "${CPM_BINARY_CACHE}/${dir}-build")
message(STATUS "get_cpm: setting ${pkg}_DIR to '${CPM_BINARY_CACHE}/${dir}-build'")
set(${pkg}_DIR "${CPM_BINARY_CACHE}/${dir}-build" PARENT_SCOPE)
else()
message(STATUS "get_cpm: not setting ${pkg}_DIR because '${CPM_BINARY_CACHE}/${dir}-build' does not exist")
endif()
endif()
endfunction()

function(_clean_build_dirs_if_not_fully_built dir soname)
if (NOT DEFINED ENV{NODE_RAPIDS_USE_LOCAL_DEPS_BUILD_DIRS})
if (NOT (EXISTS "${CPM_BINARY_CACHE}/${dir}-build/${soname}"))
message(STATUS "get_cpm: not clearing shared build dirs since '${CPM_BINARY_CACHE}/${dir}-build/${soname}' exists")
else()
file(REMOVE_RECURSE "${CPM_BINARY_CACHE}/${dir}-build")
file(REMOVE_RECURSE "${CPM_BINARY_CACHE}/${dir}-subbuild")
message(STATUS "get_cpm: clearing shared build dirs since '${CPM_BINARY_CACHE}/${dir}-build/${soname}' does not exist")
endif()
endif()
endfunction()
Expand All @@ -71,14 +109,3 @@ function(_fix_cmake_global_defaults target)
endif()
endif()
endfunction()

if (NOT DEFINED ENV{NODE_RAPIDS_USE_LOCAL_DEPS_BUILD_DIRS})
execute_process(COMMAND node -p
"require('@rapidsai/core').cmake_fetchcontent_base"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE NODE_RAPIDS_FETCHCONTENT_BASE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)

set(FETCHCONTENT_BASE_DIR "${NODE_RAPIDS_FETCHCONTENT_BASE_DIR}")
message(STATUS "get_cpm: Using CMake FetchContent base dir: ${FETCHCONTENT_BASE_DIR}")
endif()
2 changes: 2 additions & 0 deletions modules/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ add_library(${PROJECT_NAME} SHARED ${NODE_CUDA_SRC_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SUFFIX ".node"
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
Expand Down
4 changes: 3 additions & 1 deletion modules/cudf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ include(ConfigureCXX)
include(ConfigureCUDA)
include(ConfigureNapi)
include(ConfigureCUDF)

###################################################################################################
# - node_cudf target ------------------------------------------------------------------------------

Expand All @@ -66,6 +66,8 @@ add_library(${PROJECT_NAME} SHARED ${NODE_CUDF_SRC_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SUFFIX ".node"
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
Expand Down
2 changes: 2 additions & 0 deletions modules/cugraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ add_library(${PROJECT_NAME} SHARED ${NODE_CUGRAPH_SRC_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SUFFIX ".node"
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
Expand Down
4 changes: 2 additions & 2 deletions modules/cugraph/src/layout/force_atlas2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Napi::Value GraphCOO::force_atlas2(Napi::CallbackInfo const &info) {
y_start = x_start + num_nodes();
return buf->Value();
}
return DeviceBuffer::New(
std::make_unique<rmm::device_buffer>(num_nodes() * 2 * sizeof(float), nullptr, mr));
return DeviceBuffer::New(std::make_unique<rmm::device_buffer>(
num_nodes() * 2 * sizeof(float), rmm::cuda_stream_default, mr));
}(options.Get("positions"));

auto graph = this->view();
Expand Down
2 changes: 2 additions & 0 deletions modules/cuspatial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ add_library(${PROJECT_NAME} SHARED ${NODE_CUSPATIAL_SRC_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SUFFIX ".node"
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
Expand Down
4 changes: 3 additions & 1 deletion modules/glfw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ add_library(${PROJECT_NAME} SHARED ${NODE_GLFW_SRC_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SUFFIX ".node"
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
Expand All @@ -83,7 +85,7 @@ target_compile_options(${PROJECT_NAME}
)

target_include_directories(${PROJECT_NAME}
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src"
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
"$<BUILD_INTERFACE:${RAPIDS_CORE_INCLUDE_DIR}>"
"$<BUILD_INTERFACE:${NAPI_INCLUDE_DIRS}>"
"$<BUILD_INTERFACE:${DISPLAY_SERVER_INCLUDE_DIRS}>"
Expand Down
2 changes: 2 additions & 0 deletions modules/rmm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ add_library(${PROJECT_NAME} SHARED ${NODE_CUDA_SRC_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SUFFIX ".node"
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
Expand Down
4 changes: 3 additions & 1 deletion modules/webgl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ add_library(${PROJECT_NAME} SHARED ${NODE_WEBGL_SRC_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SUFFIX ".node"
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
Expand All @@ -82,7 +84,7 @@ target_compile_options(${PROJECT_NAME}
)

target_include_directories(${PROJECT_NAME}
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src"
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
"$<BUILD_INTERFACE:${RAPIDS_CORE_INCLUDE_DIR}>"
"$<BUILD_INTERFACE:${NAPI_INCLUDE_DIRS}>"
"$<BUILD_INTERFACE:${DISPLAY_SERVER_INCLUDE_DIRS}>"
Expand Down
2 changes: 1 addition & 1 deletion node-rapids.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
"--background-index=true",
"--all-scopes-completion",
"--header-insertion=never",
"--suggest-missing-includes",
"--completion-style=detailed",
"--header-insertion-decorators"
],
Expand All @@ -163,6 +162,7 @@
},
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.associations": {
"*.cu": "cuda",
"*.cuh": "cuda",
Expand Down