Skip to content

Commit

Permalink
more refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
JiakunYan committed Feb 17, 2024
1 parent 26b1f74 commit 97b4566
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
33 changes: 14 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,23 @@ if(NOT LCI_WITH_LCT_ONLY)
"If using the ofi(libfabric) backend, provide a hint for the provider to use"
)

find_package(OFI)
find_package(IBV)
find_package(ucx)
if(IBV_FOUND AND OFI_FOUND)
if(LCI_SERVER STREQUAL "ofi")
set(FABRIC OFI)
else()
set(FABRIC IBV)
endif()
find_package(OFI)
find_package(UCX)
string(TOUPPER ${LCI_SERVER} LCI_SERVER_UPPER)
if(${LCI_SERVER_UPPER}_FOUND)
# If the user-specified server are found, just use it.
set(FABRIC ${LCI_SERVER_UPPER})
elseif(IBV_FOUND)
set(FABRIC IBV)
elseif(OFI_FOUND)
set(FABRIC OFI)
elseif(UCX_FOUND)
set(FABRIC UCX)
else()
message(FATAL_ERROR "Find neither libfabric nor libibverbs. Give up!")
message(FATAL_ERROR "Cannot find any servers. Give up!")
endif()
if(LCI_SERVER STREQUAL "ucx")
if(NOT ucx_FOUND)
message(FATAL_ERROR "ucx is chosen as network backend but not found!")
endif()
set(FABRIC ucx)
endif()
string(TOUPPER ${LCI_SERVER} LCI_SERVER_UPPER)

if(LCI_FORCE_SERVER AND NOT LCI_SERVER_UPPER STREQUAL FABRIC)
message(
FATAL_ERROR
Expand Down Expand Up @@ -269,10 +263,11 @@ if(NOT LCI_WITH_LCT_ONLY)
C_STANDARD 11
C_EXTENSIONS ON)
target_compile_definitions(LCI PRIVATE _GNU_SOURCE)
if(FABRIC STREQUAL ucx)
target_link_libraries(LCI PUBLIC Threads::Threads ${FABRIC}::ucp LCT)
target_link_libraries(LCI PUBLIC Threads::Threads LCT)
if(FABRIC STREQUAL UCX)
target_link_libraries(LCI PUBLIC ucx::ucp)
else()
target_link_libraries(LCI PUBLIC Threads::Threads ${FABRIC}::${FABRIC} LCT)
target_link_libraries(LCI PUBLIC ${FABRIC}::${FABRIC})
endif()
if(LCI_USE_AVX)
target_compile_options(LCI PUBLIC -mavx)
Expand Down
19 changes: 14 additions & 5 deletions lci/api/lci.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,25 @@ typedef enum {
extern LCI_rdv_protocol_t LCI_RDV_PROTOCOL;

/**
* @ingroup
* @ingroup LCI_COMM
* @brief For the libfabric cxi provider, Try turning off the hacking to see
* whether cxi has fixed the double mr_bind error.
*/
extern bool LCI_OFI_CXI_TRY_NO_HACK;

/**
* @ingroup LCI_COMM
* @brief For the UCX backend, use try_lock to wrap the ucx function calls.
*/
extern bool LCI_UCX_USE_TRY_LOCK;

/**
* @ingroup LCI_COMM
* @brief For the UCX backend, use blocking lock to wrap the ucx_progress
* function calls.
*/
extern bool LCI_UCX_PROGRESS_FOCUSED;

/**
* @ingroup LCI_COMM
* @brief Try_lock mode of network backend.
Expand Down Expand Up @@ -629,10 +642,6 @@ extern LCI_endpoint_t LCI_UR_ENDPOINT;
*/
extern LCI_comp_t LCI_UR_CQ;

extern bool LCI_UCX_USE_TRY_LOCK;

extern bool LCI_UCX_PROGRESS_FOCUSED;

/**
* @ingroup LCI_SETUP
* @brief Initialize the LCI runtime. No LCI calls are allowed to be called
Expand Down
2 changes: 0 additions & 2 deletions lci/api/lci_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#cmakedefine LCI_ENABLE_SLOWDOWN
#cmakedefine LCI_USE_PAPI
#cmakedefine01 LCI_USE_DREG_DEFAULT

#cmakedefine LCI_UCX_NO_PROGRESS_THREAD
#cmakedefine LCI_UCX_USE_SEGMENTED_PUT

#define LCI_PACKET_SIZE_DEFAULT @LCI_PACKET_SIZE_DEFAULT@
Expand Down
4 changes: 2 additions & 2 deletions lci/runtime/env.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ LCI_API bool LCI_ENABLE_PRG_NET_ENDPOINT;
LCI_API LCI_rdv_protocol_t LCI_RDV_PROTOCOL;
LCI_API bool LCI_OFI_CXI_TRY_NO_HACK;
LCI_API uint64_t LCI_BACKEND_TRY_LOCK_MODE;
LCI_API bool LCI_UCX_USE_TRY_LOCK;
LCI_API bool LCI_UCX_PROGRESS_FOCUSED;
LCI_API LCI_device_t LCI_UR_DEVICE;
LCI_API LCI_endpoint_t LCI_UR_ENDPOINT;
LCI_API LCI_comp_t LCI_UR_CQ;
LCI_API bool LCI_UCX_USE_TRY_LOCK;
LCI_API bool LCI_UCX_PROGRESS_FOCUSED;

void LCII_env_init_cq_type();

Expand Down

0 comments on commit 97b4566

Please sign in to comment.