Skip to content

Commit

Permalink
Adding UCC build (#579)
Browse files Browse the repository at this point in the history
* adding initial build

* fixing the build

* upgrading ucx version

* fixing conda build

* attempting to fix cmake error

* fixing glog version

* removing parallel build

* fixing glog libs

* fixing glog libs
  • Loading branch information
nirandaperera authored Apr 10, 2022
1 parent 2759a30 commit f68cc62
Show file tree
Hide file tree
Showing 10 changed files with 270 additions and 48 deletions.
12 changes: 6 additions & 6 deletions conda/environments/cylon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ dependencies:
- python=3.8
- cmake>=3.17
- pyarrow=5.0.0
- glog>=0.4.0
- openmpi>=4.1.1
- ucx>=1.9.0
- glog=0.5.0
- openmpi>=4.1
- ucx>=1.12.1
- cython>=0.29,<0.30
- numpy
- pandas
- setuptools
- numpy>=1.16
- pandas>=1.0
- setuptools>=40.0,<60.0
# they are not needed for using pygcylon or compiling it
- pytest
- pytest-mpi
Expand Down
12 changes: 6 additions & 6 deletions conda/environments/cylon_MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ channels:
dependencies:
- python=3.8
- cmake>=3.17
- pyarrow=4.0.1
- glog>=0.4.0
- openmpi>=4.1.1
- pyarrow=5.0.0
- glog=0.5.0
- openmpi>=4.1
- cython>=0.29,<0.30
- numpy
- pandas
- setuptools
- numpy>=1.16
- pandas>=1.0
- setuptools>=40.0,<60.0
# they are not needed for using pygcylon or compiling it
- pytest
- pytest-mpi
Expand Down
12 changes: 6 additions & 6 deletions conda/environments/gcylon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ dependencies:
- cython>=0.29,<0.30
- cudf=21.10.01
- cudatoolkit=11.2
# - pyarrow=4.0.1
# - arrow-cpp=4.0.1
- glog>=0.4.0
- setuptools>=49.6.0
- openmpi>=4.1.1
- ucx>=1.9.0
- glog=0.5.0
- openmpi>=4.1
- ucx>=1.12.0
- numpy>=1.16
- pandas>=1.0
- setuptools>=40.0,<60.0
# these are for running tests only,
# they are not needed for using pygcylon or compiling it
- pytest
Expand Down
8 changes: 4 additions & 4 deletions conda/environments/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ dependencies:
- python=3.8
- cmake>=3.17
- pyarrow=5.0.0
- glog
- glog=0.5.0
- msmpi
- cython>=0.29,<0.30
- numpy
- pandas
- setuptools
- numpy>=1.16
- pandas>=1.0
- setuptools>=40.0,<60.0
# they are not needed for using pygcylon or compiling it
- pytest
17 changes: 12 additions & 5 deletions cpp/CMake/Modules/ConfigureArrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
##
include(GNUInstallDirs)

set(ARROW_HOME ${CMAKE_BINARY_DIR}/arrow/install)
set(ARROW_ROOT ${CMAKE_BINARY_DIR}/arrow)
Expand Down Expand Up @@ -69,14 +68,14 @@ if (ARROW_CONFIG)
message(FATAL_ERROR "Configuring Arrow failed: " ${ARROW_CONFIG})
endif (ARROW_CONFIG)

set(PARALLEL_BUILD -j)
set(PARALLEL_BUILD "")
if ($ENV{PARALLEL_LEVEL})
set(NUM_JOBS $ENV{PARALLEL_LEVEL})
set(PARALLEL_BUILD "${PARALLEL_BUILD}${NUM_JOBS}")
set(PARALLEL_BUILD "-j ${NUM_JOBS}")
endif ($ENV{PARALLEL_LEVEL})

execute_process(
COMMAND ${CMAKE_COMMAND} --build ..
COMMAND ${CMAKE_COMMAND} --build .. ${PARALLEL_BUILD}
RESULT_VARIABLE ARROW_BUILD
WORKING_DIRECTORY ${ARROW_ROOT}/build)

Expand All @@ -85,8 +84,16 @@ if (ARROW_BUILD)
endif (ARROW_BUILD)

message(STATUS "Arrow installed here: " ${ARROW_ROOT}/install)
set(ARROW_LIBRARY_DIR "${ARROW_ROOT}/install/${CMAKE_INSTALL_LIBDIR}")
if (EXISTS "${ARROW_ROOT}/install/lib")
set(ARROW_LIBRARY_DIR "${ARROW_ROOT}/install/lib")
elseif (EXISTS "${ARROW_ROOT}/install/lib64")
set(ARROW_LIBRARY_DIR "${ARROW_ROOT}/install/lib64")
else ()
message(ERROR "Unable to find Arrow lib directory in ${ARROW_ROOT}/install")
endif ()
set(ARROW_INCLUDE_DIR "${ARROW_ROOT}/install/include")
message(STATUS "Arrow libs dir: " ${ARROW_LIBRARY_DIR})
message(STATUS "Arrow include dir: " ${ARROW_INCLUDE_DIR})

# find packages with the help of arrow Find*.cmake files
find_package(Arrow REQUIRED HINTS "${ARROW_LIBRARY_DIR}/cmake/arrow" CONFIGS FindArrow.cmake)
Expand Down
28 changes: 18 additions & 10 deletions cpp/CMake/Modules/ConfigureGlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
##

# build glog from github tag
include(GNUInstallDirs)

set(GLOG_ROOT ${CMAKE_BINARY_DIR}/glog)
set(GLOG_INSTALL ${CMAKE_BINARY_DIR}/glog/install)

Expand Down Expand Up @@ -49,18 +47,28 @@ execute_process(
RESULT_VARIABLE GLOG_BUILD
WORKING_DIRECTORY ${GLOG_ROOT}/build)

if(GLOG_BUILD)
if (GLOG_BUILD)
message(FATAL_ERROR "Building Glog failed: " ${GLOG_BUILD})
endif(GLOG_BUILD)
endif (GLOG_BUILD)

message(STATUS "Glog installed here: " ${GLOG_ROOT}/install)
set(GLOG_LIBRARY_DIR "${GLOG_ROOT}/install/${CMAKE_INSTALL_LIBDIR}")
if (EXISTS "${GLOG_ROOT}/install/lib")
set(GLOG_LIBRARY_DIR "${GLOG_ROOT}/install/lib")
elseif (EXISTS "${GLOG_ROOT}/install/lib64")
set(GLOG_LIBRARY_DIR "${GLOG_ROOT}/install/lib64")
else ()
message(ERROR "Unable to find glog lib directory in ${GLOG_ROOT}/install")
endif ()
set(GLOG_INCLUDE_DIR "${GLOG_ROOT}/install/include")

set(GLOG_FOUND TRUE)

IF(WIN32)
set(GLOG_LIBRARIES ${GLOG_INSTALL}/lib/glog.lib)
ELSE()
set(GLOG_LIBRARIES ${GLOG_INSTALL}/${CMAKE_INSTALL_LIBDIR}/libglog.a)
ENDIF()
IF (WIN32)
set(GLOG_LIBRARIES ${GLOG_INSTALL}/lib/glog.lib)
ELSE ()
set(GLOG_LIBRARIES ${GLOG_LIBRARY_DIR}/libglog.a)
ENDIF ()

message(STATUS "Glog libs dir: " ${GLOG_LIBRARY_DIR})
message(STATUS "Glog include dir: " ${GLOG_INCLUDE_DIR})
message(STATUS "Glog libs: " ${GLOG_LIBRARIES})
20 changes: 19 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
# if conda build, we will get glog from conda instead of building ourselves
if (CYLON_CONDA_BUILD)
message("Using Conda Glog")
find_package(glog 0.5.0 REQUIRED)
find_package(glog REQUIRED)
set(GLOG_LIBRARIES glog::glog)
else ()
message("Building Glog locally")
Expand Down Expand Up @@ -197,6 +197,7 @@ endif ()

# ucx
option(CYLON_UCX "Build Cylon with UCX" OFF)
option(CYLON_UCC "Build Cylon with UCC" OFF)
if (CYLON_UCX)
message("Cylon UCX enabled")
# Definition used for checking
Expand Down Expand Up @@ -235,6 +236,23 @@ if (CYLON_UCX)
${UCX_LIBDIR}/libucp.so)
endif (CONDA_LINK_DIRS)
message(STATUS "UCX libs: ${UCX_LIBRARIES}")

if (CYLON_UCC)
message("Cylon UCC enabled")
# Definition used for checking
add_definitions(-DBUILD_CYLON_UCC)

if (NOT UCC_INSTALL_PREFIX)
message(FATAL_ERROR "CYLON_UCC is set, but UCC_INSTALL_PREFIX is missing")
endif ()

find_package(ucc REQUIRED CONFIG HINTS ${UCC_INSTALL_PREFIX})
message(STATUS "UCC include dirs: ${UCC_INCLUDE_DIRS}")
message(STATUS "UCC libs: ${UCC_LIBRARIES}")

include_directories(SYSTEM ${UCC_INCLUDE_DIRS})
link_directories(${UCC_LIBRARIES})
endif (CYLON_UCC)
endif (CYLON_UCX)

# gloo
Expand Down
3 changes: 3 additions & 0 deletions cpp/src/cylon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ target_link_libraries(cylon ${PARQUET_LIB})

if (CYLON_UCX)
target_link_libraries(cylon ${UCX_LIBRARIES})
if (CYLON_UCC)
target_link_libraries(cylon ucc)
endif ()
endif ()

if (CYLON_GLOO)
Expand Down
21 changes: 11 additions & 10 deletions cpp/src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ macro(cylon_add_exe EXENAME)

if (CYLON_GLOO)
target_link_libraries(${EXENAME} ${GLOO_LIBRARIES})
endif()
endif ()

if (CYLON_UCX)
target_link_libraries(${EXENAME} ${UCX_LIBRARIES})
if (CYLON_UCC)
target_link_libraries(${EXENAME} ucc)
endif (CYLON_UCC)
endif (CYLON_UCX)

install(TARGETS ${EXENAME} RUNTIME DESTINATION cylon/examples)
endmacro(cylon_add_exe)
Expand Down Expand Up @@ -70,21 +77,15 @@ cylon_add_exe(parquet_join_example)

if (CYLON_UCX)
cylon_add_exe(ucx_join_example)
if (CYLON_UCC)
cylon_add_exe(ucc_example)
endif ()
endif (CYLON_UCX)

if (CYLON_GLOO)
cylon_add_exe(gloo_example)
endif (CYLON_GLOO)

macro(cylon_add_exe2 DIR EXENAME)
add_executable(${EXENAME} ${DIR}/${EXENAME}.cpp)
target_link_libraries(${EXENAME} ${MPI_LIBRARIES})
target_link_libraries(${EXENAME} cylon)
target_link_libraries(${EXENAME} ${ARROW_LIB})
target_link_libraries(${EXENAME} ${GLOG_LIBRARIES})
target_link_libraries(${EXENAME} cylon_example_utils)
install(TARGETS ${EXENAME} RUNTIME DESTINATION cylon/examples)
endmacro(cylon_add_exe2)



Loading

0 comments on commit f68cc62

Please sign in to comment.