Skip to content

add rget/rput in comm_backend #61

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
52 changes: 0 additions & 52 deletions .github/workflows/ci-lci1.yml

This file was deleted.

11 changes: 2 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@ option(RECONVERSE_TRY_ENABLE_COMM_LCI2 "whether to enable the LCIv2 backend" ON)
option(RECONVERSE_AUTOFETCH_LCI2
"whether to autofetch LCIv2 if LCI2 cannot be found" OFF)
set(RECONVERSE_AUTOFETCH_LCI2_TAG
"85dc99f3b32cfc8b3b4b0e0590ee445282964b57"
CACHE STRING "The tag to fetch for LCIv2") # master branch as of 2025-04-17

option(RECONVERSE_TRY_ENABLE_COMM_LCI1 "whether to enable the LCIv1 backend" OFF)
option(RECONVERSE_AUTOFETCH_LCI1
"whether to autofetch LCIv1 if LCI1 cannot be found" OFF)
set(RECONVERSE_AUTOFETCH_LCI1_TAG
"ad1c43e5ff28bb2cfc8a300615f4d502b7bce31f"
CACHE STRING "The tag to fetch for LCIv1") # master branch as of 2025-04-17
"96f8c00d4b9f9c391083dadb36affdf243122cac"
CACHE STRING "The tag to fetch for LCIv2") # master branch as of 2025-05-03

option(SPANTREE "whether to enable spanning tree collectives" ON)
option(CMK_SMP "whether to enable SMP support" ON)
Expand Down
55 changes: 1 addition & 54 deletions src/comm_backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,57 +61,4 @@ if(RECONVERSE_TRY_ENABLE_COMM_LCI2)
"LCI2 is not found. The LCI2 backend is not enabled. Try setting RECONVERSE_AUTOFETCH_LCI2=ON to fetch LCIv2 automatically."
)
endif()
endif()

# LCI1
if(NOT RECONVERSE_ENABLE_COMM_LCI2 AND RECONVERSE_TRY_ENABLE_COMM_LCI1)
# Try to find LCIv1 externally
find_package(
LCI
CONFIG
HINTS
${LCI_ROOT}
$ENV{LCI_ROOT}
PATH_SUFFIXES
lib/cmake
lib64/cmake)
if(LCI_FOUND
AND NOT LCI_WITH_LCT_ONLY
AND LCI_VERSION VERSION_LESS 2.0.0)
set(RECONVERSE_ENABLE_COMM_LCI1 ON)
endif()

if(NOT RECONVERSE_ENABLE_COMM_LCI1 AND RECONVERSE_AUTOFETCH_LCI1)
if(FETCHCONTENT_SOURCE_DIR_LCI)
message(
STATUS
"LCI will be include through FetchContent from ${FETCHCONTENT_SOURCE_DIR_LCI}"
)
else()
message(
STATUS
"LCI will be include throught FetchContent from GIT_TAG ${RECONVERSE_AUTOFETCH_LCI1_TAG}"
)
endif()
include(FetchContent)
FetchContent_Declare(
lci
GIT_REPOSITORY https://github.com/uiuc-hpc/lci.git
GIT_TAG ${RECONVERSE_AUTOFETCH_LCI1_TAG})
FetchContent_MakeAvailable(lci)
set(RECONVERSE_ENABLE_COMM_LCI1 ON)
endif()

if(RECONVERSE_ENABLE_COMM_LCI1)
message(STATUS "LCIv1 found. Enabling LCIv1 backend.")
message(WARNING "LCIv1 is deprecated. Please use LCIv2 instead.")
target_link_libraries(reconverse PRIVATE LCI::LCI)
target_sources(reconverse PRIVATE lci1/comm_backend_lci1.cpp)
set(RECONVERSE_ENABLE_COMM_LCI1 ON PARENT_SCOPE)
else()
message(
WARNING
"LCIv1 is not found. The LCIv1 backend is not enabled. Try setting RECONVERSE_AUTOFETCH_LCI1=ON to fetch LCIv1 automatically."
)
endif()
endif()
endif()
23 changes: 19 additions & 4 deletions src/comm_backend/comm_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
namespace comm_backend {

struct Status {
void *msg;
void *local_buf;
size_t size;
};
using CompHandler = void (*)(Status status);
using AmHandler = int;
using mr_t = void *;
const mr_t MR_NULL = nullptr;
using rkey_t = uint64_t;

/**
* @brief Initialize the communication backend. Not thread-safe.
Expand All @@ -35,10 +36,20 @@ int getNumNodes();
*/
AmHandler registerAmHandler(CompHandler handler);
/**
* @brief Send an active message. Thread-safe.
* @brief Issue an active message. Thread-safe.
*/
void sendAm(int rank, void *msg, size_t size, mr_t mr, CompHandler localComp,
AmHandler remoteComp);
void issueAm(int rank, void *local_buf, size_t size, mr_t mr,
CompHandler localComp, AmHandler remoteComp);
/**
* @brief Issue a remote get operation. Thread-safe.
*/
void issueRget(int rank, void *local_buf, size_t size, mr_t local_mr,
uintptr_t remote_buf, rkey_t rkey, CompHandler localComp);
/**
* @brief Issue a remote put operation. Thread-safe.
*/
void issueRput(int rank, void *local_buf, size_t size, mr_t local_mr,
uintptr_t remote_buf, rkey_t rkey, CompHandler localComp);
/**
* @brief Make progress on the communication backend. Thread-safe.
*/
Expand All @@ -51,6 +62,10 @@ void barrier(void);
* @brief Register a memory region
*/
mr_t registerMemory(void *addr, size_t size);
/**
* @brief Get the remote key for a registered memory region
*/
rkey_t getRKey(mr_t mr);
/**
* @brief Deregister a memory region
*/
Expand Down
33 changes: 28 additions & 5 deletions src/comm_backend/comm_backend_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ int gMyNodeID = 0;
void init(int *argc, char ***argv) {
#ifdef RECONVERSE_ENABLE_COMM_LCI2
gCommBackend = new CommBackendLCI2();
#elif defined(RECONVERSE_ENABLE_COMM_LCI1)
gCommBackend = new CommBackendLCI1();
#endif
if (gCommBackend == nullptr) {
return;
Expand Down Expand Up @@ -40,12 +38,30 @@ AmHandler registerAmHandler(CompHandler handler) {
return gCommBackend->registerAmHandler(handler);
}

void sendAm(int rank, void *msg, size_t size, mr_t mr, CompHandler localComp,
AmHandler remoteComp) {
void issueAm(int rank, void *msg, size_t size, mr_t mr, CompHandler localComp,
AmHandler remoteComp) {
if (gCommBackend == nullptr) {
return;
}
gCommBackend->sendAm(rank, msg, size, mr, localComp, remoteComp);
gCommBackend->issueAm(rank, msg, size, mr, localComp, remoteComp);
}

void issueRget(int rank, void *local_buf, size_t size, mr_t local_mr,
uintptr_t remote_buf, rkey_t rkey, CompHandler localComp) {
if (gCommBackend == nullptr) {
return;
}
gCommBackend->issueRget(rank, local_buf, size, local_mr, remote_buf, rkey,
localComp);
}

void issueRput(int rank, void *local_buf, size_t size, mr_t local_mr,
uintptr_t remote_buf, rkey_t rkey, CompHandler localComp) {
if (gCommBackend == nullptr) {
return;
}
gCommBackend->issueRput(rank, local_buf, size, local_mr, remote_buf, rkey,
localComp);
}

bool progress(void) {
Expand All @@ -69,6 +85,13 @@ mr_t registerMemory(void *addr, size_t size) {
return gCommBackend->registerMemory(addr, size);
}

rkey_t getRKey(mr_t mr) {
if (gCommBackend == nullptr) {
return 0;
}
return gCommBackend->getRKey(mr);
}

void deregisterMemory(mr_t mr) {
if (gCommBackend == nullptr) {
return;
Expand Down
14 changes: 9 additions & 5 deletions src/comm_backend/comm_backend_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ class CommBackendBase {
virtual int getMyNodeId() = 0;
virtual int getNumNodes() = 0;
virtual AmHandler registerAmHandler(CompHandler handler) = 0;
virtual void sendAm(int rank, void *msg, size_t size, mr_t mr,
CompHandler localComp, AmHandler remoteComp) = 0;
virtual void issueAm(int rank, void *local_buf, size_t size, mr_t mr,
CompHandler localComp, AmHandler remoteComp) = 0;
virtual void issueRget(int rank, void *local_buf, size_t size, mr_t local_mr,
uintptr_t remote_buf, rkey_t rkey,
CompHandler localComp) = 0;
virtual void issueRput(int rank, void *local_buf, size_t size, mr_t local_mr,
uintptr_t remote_buf, rkey_t rkey,
CompHandler localComp) = 0;
// return true if there is more work to do
virtual bool progress(void) = 0;
virtual void barrier(void) = 0;
virtual mr_t registerMemory(void *addr, size_t size) { return MR_NULL; }
virtual rkey_t getRKey(mr_t mr) { return 0; }
virtual void deregisterMemory(mr_t mr) {}
virtual ~CommBackendBase() {};
};
Expand All @@ -31,8 +38,5 @@ class CommBackendBase {
#ifdef RECONVERSE_ENABLE_COMM_LCI2
#include "comm_backend/lci2/comm_backend_lci2.h"
#endif
#ifdef RECONVERSE_ENABLE_COMM_LCI1
#include "comm_backend/lci1/comm_backend_lci1.h"
#endif

#endif // COMM_BACKEND_INTERNAL_H
Loading