Skip to content

Commit 8cb54a8

Browse files
author
William Malpica
authored
Merge pull request #3 from BlazingDB/feature/cudf0.8
[REVIEW] Use cudf 0.8
2 parents 7588ad4 + 1ef8cba commit 8cb54a8

File tree

5 files changed

+215
-1
lines changed

5 files changed

+215
-1
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ project(blazingdb-dependencies C CXX CUDA)
1010
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
1111
message(STATUS "CMAKE_MODULE_PATH:" "${CMAKE_MODULE_PATH}")
1212

13+
## rmm - git@github.com:rapidsai/rmm.git
14+
option(ENABLE_RMM "Add the rmm (rapidsai) library" OFF)
15+
1316
## custrings - git@github.com:rapidsai/custrings.git
1417
option(ENABLE_CUSTRINGS "Add the custring (rapidsai) library" OFF)
1518

@@ -48,6 +51,13 @@ include(ConfigurePython3)
4851

4952
include(ConfigureJitify) # NOTE cudf related
5053

54+
if(ENABLE_RMM)
55+
message(STATUS "Enable the rmm (rapidsai) library")
56+
include(ConfigureRMM)
57+
else()
58+
message(STATUS "Disable the rmm (rapidsai) library")
59+
endif()
60+
5161
if(ENABLE_CUSTRINGS)
5262
message(STATUS "Enable the custring (rapidsai) library")
5363
include(ConfigureNVStrings)
@@ -81,6 +91,11 @@ install(DIRECTORY ${THRIFT_ROOT} DESTINATION . USE_SOURCE_PERMISSIONS)
8191
install(DIRECTORY ${ARROW_ROOT} DESTINATION . USE_SOURCE_PERMISSIONS)
8292
install(DIRECTORY ${PYTHON3_ROOT} DESTINATION . USE_SOURCE_PERMISSIONS)
8393

94+
## rmm - git@github.com:rapidsai/rmm.git
95+
if(ENABLE_RMM)
96+
install(DIRECTORY ${RMM_ROOT} DESTINATION . USE_SOURCE_PERMISSIONS)
97+
endif()
98+
8499
## custrings - git@github.com:rapidsai/custrings.git
85100
if(ENABLE_CUSTRINGS)
86101
install(DIRECTORY ${NVSTRINGS_ROOT} DESTINATION . USE_SOURCE_PERMISSIONS)

cmake/ConfigureRMM.cmake

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#=============================================================================
2+
# Copyright 2019 BlazingDB, Inc.
3+
# Copyright 2019 Percy Camilo Triveño Aucahuasi <percy@blazingdb.com>
4+
#=============================================================================
5+
6+
# BEGIN macros
7+
8+
macro(CONFIGURE_GPU_RMM_EXTERNAL_PROJECT)
9+
set(ENV{CUDACXX} $ENV{CUDACXX})
10+
11+
set(RMM_CMAKE_ARGS
12+
)
13+
14+
if(CXX_OLD_ABI)
15+
# enable old ABI for C/C++
16+
list(APPEND RMM_CMAKE_ARGS " -DCMAKE_CXX11_ABI=OFF")
17+
else()
18+
list(APPEND RMM_CMAKE_ARGS " -DCMAKE_CXX11_ABI=ON")
19+
endif()
20+
21+
# Download and unpack rmm at configure time
22+
configure_file(${CMAKE_CURRENT_LIST_DIR}/RMM.CMakeLists.txt.cmake ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-download/CMakeLists.txt)
23+
24+
execute_process(
25+
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
26+
RESULT_VARIABLE result
27+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-download/
28+
)
29+
30+
if(result)
31+
message(FATAL_ERROR "CMake step for rmm failed: ${result}")
32+
endif()
33+
34+
execute_process(
35+
COMMAND ${CMAKE_COMMAND} --build . -- -j8
36+
RESULT_VARIABLE result
37+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-download/
38+
)
39+
40+
if(result)
41+
message(FATAL_ERROR "Build step for rmm failed: ${result}")
42+
endif()
43+
44+
execute_process(
45+
COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/patch_rmm.sh ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-install/
46+
RESULT_VARIABLE result
47+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-download/
48+
)
49+
50+
if(result)
51+
message(FATAL_ERROR "Patch step for rmm failed: ${result}")
52+
endif()
53+
endmacro()
54+
55+
# END macros
56+
57+
# BEGIN MAIN #
58+
59+
if (RMM_INSTALL_DIR)
60+
if (NOT RMM_INSTALL_DIR)
61+
message(FATAL_ERROR "If you use the RMM_INSTALL_DIR argument then you need pass the RMM_INSTALL_DIR argument too (the home installation of rmm)")
62+
endif()
63+
64+
message(STATUS "RMM_INSTALL_DIR defined, it will use vendor version from ${RMM_INSTALL_DIR}")
65+
set(RMM_ROOT "${RMM_INSTALL_DIR}")
66+
else()
67+
message(STATUS "RMM_INSTALL_DIR not defined, it will be built from sources")
68+
configure_gpu_rmm_external_project()
69+
set(RMM_ROOT "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-install/")
70+
endif()
71+
72+
find_package(RMM REQUIRED)
73+
set_package_properties(RMM PROPERTIES TYPE REQUIRED
74+
PURPOSE "rmm is a C library for implementing common functionality for a GPU Data Frame."
75+
URL "https://github.com/gpuopenanalytics/rmm")
76+
77+
if(NOT RMM_FOUND)
78+
message(FATAL_ERROR "rmm not found, please check your settings.")
79+
endif()
80+
81+
message(STATUS "rmm found in ${RMM_ROOT}")
82+
83+
set(RMM_LIBDIR ${RMM_ROOT}/lib/)
84+
link_directories(${RMM_LIBDIR})
85+
86+
include_directories(${RMM_INCLUDEDIR} ${RMM_INCLUDE_DIR})
87+
# TODO percy seems cmake bug: we cannot define target dirs per cuda target
88+
# ... see if works in future cmake versions
89+
link_directories(${RMM_LIBDIR})
90+
91+
# END MAIN #

cmake/DefineVersions.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,20 @@ define_default_git_package(
233233
"Release"
234234
)
235235

236+
if(ENABLE_RMM)
237+
define_default_git_package(
238+
"RMM"
239+
"https://github.com/rapidsai/rmm.git"
240+
"branch-0.8"
241+
"Release"
242+
)
243+
endif()
244+
236245
if(ENABLE_CUSTRINGS)
237246
define_default_git_package(
238247
"NVSTRINGS"
239248
"https://github.com/rapidsai/custrings.git"
240-
"branch-0.4"
249+
"branch-0.8"
241250
"Release"
242251
)
243252
endif()

cmake/FindRMM.cmake

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#=============================================================================
2+
# Copyright 2019 BlazingDB, Inc.
3+
# Copyright 2019 Percy Camilo Triveño Aucahuasi <percy@blazingdb.com>
4+
#=============================================================================
5+
6+
# - Find GPU Open Analytics Initiative (GoAi) librmm (librmm.a)
7+
# RMM_ROOT hints the location
8+
#
9+
# This module defines
10+
# RMM_FOUND
11+
# RMM_INCLUDEDIR Preferred include directory e.g. <prefix>/include
12+
# RMM_INCLUDE_DIR, directory containing librmm headers
13+
# RMM_LIBS, librmm libraries
14+
# RMM_LIBDIR, directory containing librmm libraries
15+
# RMM_STATIC_LIB, path to librmm.a
16+
# rmm - static library
17+
#TODO percy find librmm.so/.a ...
18+
19+
# If RMM_ROOT is not defined try to search in the default system path
20+
if ("${RMM_ROOT}" STREQUAL "")
21+
set(RMM_ROOT "/usr")
22+
endif()
23+
24+
set(RMM_SEARCH_LIB_PATH
25+
${RMM_ROOT}/lib
26+
${RMM_ROOT}/lib/x86_64-linux-gnu
27+
${RMM_ROOT}/lib64
28+
${RMM_ROOT}/build
29+
)
30+
31+
set(RMM_SEARCH_INCLUDE_DIR
32+
${RMM_ROOT}/include/
33+
)
34+
35+
find_path(RMM_INCLUDE_DIR rmm.h
36+
PATHS ${RMM_SEARCH_INCLUDE_DIR}/rmm
37+
NO_DEFAULT_PATH
38+
DOC "Path to librmm headers"
39+
)
40+
41+
#find_library(RMM_LIBS NAMES rmm
42+
# PATHS ${RMM_SEARCH_LIB_PATH}
43+
# NO_DEFAULT_PATH
44+
# DOC "Path to librmm library"
45+
#)
46+
47+
#TODO percy change to librmm.a once rmm supports static build
48+
find_library(RMM_STATIC_LIB NAMES librmm.so
49+
PATHS ${RMM_SEARCH_LIB_PATH}
50+
NO_DEFAULT_PATH
51+
DOC "Path to librmm static library"
52+
)
53+
54+
if (NOT RMM_STATIC_LIB)
55+
message(FATAL_ERROR "librmm includes and libraries NOT found. "
56+
"Looked for headers in ${RMM_SEARCH_INCLUDE_DIR}, "
57+
"and for libs in ${RMM_SEARCH_LIB_PATH}")
58+
set(RMM_FOUND FALSE)
59+
else()
60+
set(RMM_INCLUDEDIR ${RMM_ROOT}/include/)
61+
set(RMM_LIBDIR ${RMM_ROOT}/lib) # TODO percy make this part cross platform
62+
set(RMM_FOUND TRUE)
63+
#TODO percy change to STATIC once rmm supports static build
64+
add_library(rmm SHARED IMPORTED)
65+
set_target_properties(rmm PROPERTIES IMPORTED_LOCATION "${RMM_STATIC_LIB}")
66+
endif ()
67+
68+
mark_as_advanced(
69+
RMM_FOUND
70+
RMM_INCLUDEDIR
71+
RMM_INCLUDE_DIR
72+
RMM_LIBS
73+
RMM_STATIC_LIB
74+
rmm
75+
)

cmake/RMM.CMakeLists.txt.cmake

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#=============================================================================
2+
# Copyright 2018 BlazingDB, Inc.
3+
# Copyright 2018 Percy Camilo Triveño Aucahuasi <percy@blazingdb.com>
4+
#=============================================================================
5+
6+
cmake_minimum_required(VERSION 2.8.12)
7+
8+
cmake_policy(SET CMP0048 NEW)
9+
10+
project(rmm-download NONE)
11+
12+
include(ExternalProject)
13+
14+
ExternalProject_Add(rmm
15+
GIT_REPOSITORY ${RMM_GIT_REPOSITORY}
16+
GIT_TAG ${RMM_GIT_REPOSITORY}
17+
SOURCE_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-src"
18+
BINARY_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-build"
19+
INSTALL_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-install"
20+
UPDATE_COMMAND ""
21+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${RMM_BUILD_TYPE}
22+
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/rmm-install
23+
${RMM_CMAKE_ARGS}
24+
)

0 commit comments

Comments
 (0)