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

[GraphBolt][io_uring] Refactor and enable tests #7506

Merged
merged 15 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
29 changes: 2 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dgl_option(BUILD_TYPE "Type of the build: dev, dogfood or release" "dev")
message(STATUS "Build for ${BUILD_TYPE}")

dgl_option(USE_CUDA "Build with CUDA" OFF)
dgl_option(USE_LIBURING "Build with liburing" OFF)
dgl_option(USE_LIBURING "Build with liburing" ON)
dgl_option(TORCH_PYTHON_INTERPS "Python interpreter for building sub-components" python3)

# Conda build related options.
Expand Down Expand Up @@ -350,27 +350,6 @@ endif(EXTERNAL_PHMAP_PATH)
target_include_directories(dgl PRIVATE "tensoradapter/include")
target_include_directories(dgl PRIVATE "third_party/pcg/include")

if(USE_LIBURING)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-DHAVE_LIBRARY_LIBURING)
include(ExternalProject)
set(LIBURING_INSTALL_DIR ${CMAKE_BINARY_DIR}/third_party/liburing)
ExternalProject_Add(
liburing
SOURCE_DIR ${CMAKE_SOURCE_DIR}/third_party/liburing
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=/
BUILD_COMMAND bash -c "make -j 4"
BUILD_IN_SOURCE ON
INSTALL_COMMAND make install DESTDIR=${LIBURING_INSTALL_DIR}
BUILD_BYPRODUCTS ${LIBURING_INSTALL_DIR}/lib/liburing.a
BUILD_BYPRODUCTS ${LIBURING_INSTALL_DIR}/include
DOWNLOAD_EXTRACT_TIMESTAMP true
)
set(LIBURING_INCLUDE ${LIBURING_INSTALL_DIR}/include)
set(LIBURING ${LIBURING_INSTALL_DIR}/lib/liburing.a)
endif()
endif(USE_LIBURING)

if(EXTERNAL_NANOFLANN_PATH)
include_directories(SYSTEM ${EXTERNAL_NANOFLANN_PATH})
else(EXTERNAL_NANOFLANN_PATH)
Expand Down Expand Up @@ -580,6 +559,7 @@ if(BUILD_GRAPHBOLT)
CMAKE_COMMAND=${CMAKE_CMD}
CUDA_TOOLKIT_ROOT_DIR=${CUDA_TOOLKIT_ROOT_DIR}
USE_CUDA=${USE_CUDA}
USE_LIBURING=${USE_LIBURING}
BINDIR=${CMAKE_CURRENT_BINARY_DIR}
GPU_CACHE_INCLUDE_DIRS="${GPU_CACHE_INCLUDE_DIRS_ESCAPED}"
CFLAGS=${CMAKE_C_FLAGS}
Expand All @@ -593,9 +573,4 @@ if(BUILD_GRAPHBOLT)
if(USE_CUDA)
add_dependencies(graphbolt gpu_cache)
endif(USE_CUDA)
if(USE_LIBURING)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_dependencies(graphbolt liburing)
endif()
endif(USE_LIBURING)
endif(BUILD_GRAPHBOLT)
29 changes: 25 additions & 4 deletions graphbolt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.18)
project(graphbolt C CXX)
set (CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(USE_CUDA)
message(STATUS "Build graphbolt with CUDA support")
Expand Down Expand Up @@ -76,11 +77,31 @@ include_directories(BEFORE ${BOLT_DIR}
"../third_party/pcg/include"
"../third_party/phmap")
target_link_libraries(${LIB_GRAPHBOLT_NAME} "${TORCH_LIBRARIES}")

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(USE_LIBURING)
target_include_directories(${LIB_GRAPHBOLT_NAME} PRIVATE "../third_party/liburing/src/include")
get_filename_component(PARENT_DIR "${CMAKE_SOURCE_DIR}" DIRECTORY)
target_link_libraries(${LIB_GRAPHBOLT_NAME} ${PARENT_DIR}/build/third_party/liburing/lib/liburing.a)
add_definitions(-DHAVE_LIBRARY_LIBURING)
include(ExternalProject)
set(LIBURING_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/third_party/liburing)
set(LIBURING_C_COMPILER "${CMAKE_C_COMPILER} -w")
ExternalProject_Add(
liburing
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/liburing
CONFIGURE_COMMAND <SOURCE_DIR>/configure --cc=${LIBURING_C_COMPILER} --cxx=${CMAKE_CXX_COMPILER} --prefix=/
BUILD_COMMAND bash -c "make -j 4"
mfbalin marked this conversation as resolved.
Show resolved Hide resolved
BUILD_IN_SOURCE ON
INSTALL_COMMAND make install DESTDIR=${LIBURING_INSTALL_DIR}
BUILD_BYPRODUCTS ${LIBURING_INSTALL_DIR}/lib/liburing.a
BUILD_BYPRODUCTS ${LIBURING_INSTALL_DIR}/include
DOWNLOAD_EXTRACT_TIMESTAMP true
)
set(LIBURING_INCLUDE ${LIBURING_INSTALL_DIR}/include)
set(LIBURING ${LIBURING_INSTALL_DIR}/lib/liburing.a)

target_include_directories(${LIB_GRAPHBOLT_NAME} PRIVATE ${LIBURING_INCLUDE})
add_dependencies(${LIB_GRAPHBOLT_NAME} liburing)
target_link_libraries(${LIB_GRAPHBOLT_NAME} ${CMAKE_CURRENT_BINARY_DIR}/third_party/liburing/lib/liburing.a)
message(STATUS "Build graphbolt with liburing.")
endif(USE_LIBURING)
endif()

Expand Down
4 changes: 2 additions & 2 deletions graphbolt/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ if ! [[ -z "${CUDAARCHS}" ]]; then
TORCH_CUDA_ARCH_LIST=${LAST_ARCHITECTURE:0:-1}'.'${LAST_ARCHITECTURE: -1}
fi
fi
CMAKE_FLAGS="-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_TOOLKIT_ROOT_DIR -DUSE_CUDA=$USE_CUDA -DGPU_CACHE_BUILD_DIR=$BINDIR -DTORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST"
echo $CMAKE_FLAGS
CMAKE_FLAGS="-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_TOOLKIT_ROOT_DIR -DUSE_CUDA=$USE_CUDA -DGPU_CACHE_BUILD_DIR=$BINDIR -DTORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST -DUSE_LIBURING=$USE_LIBURING"
echo "graphbolt cmake flags: $CMAKE_FLAGS"

if [ $# -eq 0 ]; then
$CMAKE_COMMAND $CMAKE_FLAGS ..
Expand Down
Loading
Loading