Skip to content

Commit

Permalink
Make UCX a top-level option (so it can be turned off if desired) and …
Browse files Browse the repository at this point in the history
…tweak FindUCX
  • Loading branch information
eisenhauer committed Jan 13, 2023
1 parent c2a2b09 commit 9e79052
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ adios_option(IME "Enable support for DDN IME transport" AUTO)
adios_option(Python "Enable support for Python bindings" AUTO)
adios_option(Fortran "Enable support for Fortran bindings" AUTO)
adios_option(SysVShMem "Enable support for SysV Shared Memory IPC on *NIX" AUTO)
adios_option(UCX "Enable support for UCX DataPlane in SST" AUTO)
adios_option(Profiling "Enable support for profiling" AUTO)
adios_option(Endian_Reverse "Enable support for Little/Big Endian Interoperability" AUTO)
adios_option(Sodium "Enable support for Sodium for encryption" AUTO)
Expand Down Expand Up @@ -225,7 +226,7 @@ endif()


set(ADIOS2_CONFIG_OPTS
BP5 DataMan DataSpaces HDF5 HDF5_VOL MHS SST CUDA Fortran MPI Python Blosc Blosc2 BZip2 LIBPRESSIO MGARD PNG SZ ZFP DAOS IME O_DIRECT Sodium Catalyst SysVShMem ZeroMQ Profiling Endian_Reverse GPU_Support
BP5 DataMan DataSpaces HDF5 HDF5_VOL MHS SST CUDA Fortran MPI Python Blosc Blosc2 BZip2 LIBPRESSIO MGARD PNG SZ ZFP DAOS IME O_DIRECT Sodium UCX Catalyst SysVShMem ZeroMQ Profiling Endian_Reverse GPU_Support
)

GenerateADIOSHeaderConfig(${ADIOS2_CONFIG_OPTS})
Expand Down
7 changes: 6 additions & 1 deletion cmake/DetectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,12 @@ if(ADIOS2_USE_SST AND NOT WIN32)
ADIOS2_HAVE_MPI_CLIENT_SERVER)
unset(CMAKE_REQUIRED_LIBRARIES)
endif()
find_package(UCX 1.9.0)
# UCX
if(ADIOS2_USE_UCX STREQUAL AUTO)
find_package(UCX 1.9.0)
elseif(ADIOS2_USE_UCX)
find_package(UCX 1.9.0)
endif()
if(UCX_FOUND)
set(ADIOS2_SST_HAVE_UCX TRUE)
endif()
Expand Down
26 changes: 16 additions & 10 deletions cmake/FindUCX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,27 @@ if(NOT (PC_UCX_FOUND STREQUAL "IGNORE"))
endif()
endif()

if(UCX_INCLUDE_DIR)
file(STRINGS ${UCX_INCLUDE_DIR}/uct/api/version.h _ver_strings
REGEX [=[UCT_VERNO_STRING +"[^"]*"]=]
)
if(_ver_string MATCHES [=[UCT_VERNO_STRING +"([0-9]+.[0-9]+.[0-9]+)]=])
set(UCX_VERSION ${CMAKE_MATCH_1})
endif()
if(NOT ${PC_UCX_VERSION})
set(_UCX_VER_FILE "${ucp_INCLUDE_DIR}/ucp/api/ucp_version.h")
if(EXISTS "${_UCX_VER_FILE}")
file(READ "${_UCX_VER_FILE}" _ver)
string(REGEX MATCH "#define UCP_API_MAJOR *([0-9]*)" _ ${_ver})
set(_major ${CMAKE_MATCH_1})
string(REGEX MATCH "#define UCP_API_MINOR *([0-9]*)" _ ${_ver})
set(_minor ${CMAKE_MATCH_1})
set(UCX_VERSION "${_major}.${_minor}")
endif()
else()
set(UCX_VERSION ${PC_UCX_VERSION})
endif()

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
# handle the QUIETLY and REQUIRED arguments and set UCX_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(UCX
FOUND_VAR UCX_FOUND
VERSION_VAR UCX_VERSION
REQUIRED_VARS UCX_LIBRARIES UCX_INCLUDE_DIRECTORIES)
REQUIRED_VARS UCX_LIBRARIES)

if(UCX_FOUND)
message("Found UCX: ")
Expand All @@ -89,4 +95,4 @@ if(UCX_FOUND)
)
endif()
endif()
endif()
endif()

0 comments on commit 9e79052

Please sign in to comment.