allow all three backends to co-exist in a single build (#270)

* add support for compiling all backends

also include the logic to select backends either based on user requests
or through some heuristics

* checkpoint for compiling all backends

* final checkpoint

all tests seem to pass when compiling all three backends simultaneasly
and forcing to use any of the three Backends.

* update PR to new envvar system
This commit is contained in:
Edgar Gabriel
2025-10-07 10:49:20 -05:00
کامیت شده توسط GitHub
والد c84bbc250b
کامیت a1269e3db5
22فایلهای تغییر یافته به همراه353 افزوده شده و 47 حذف شده
+32 -4
مشاهده پرونده
@@ -29,9 +29,11 @@
#if defined(USE_GDA)
#include "gda/backend_gda.hpp"
#elif defined(USE_RO)
#endif
#if defined(USE_RO)
#include "reverse_offload/backend_ro.hpp"
#elif defined(USE_IPC)
#endif
#if defined(USE_IPC)
#include "ipc/backend_ipc.hpp"
#endif
@@ -250,7 +252,20 @@ void Backend::reset_stats() {
}
__device__ bool Backend::create_ctx(int64_t option, rocshmem_ctx_t* ctx) {
#if defined(USE_GDA)
#if defined(USE_GDA) && defined(USE_RO) && defined(USE_IPC)
switch(this->type) {
case BackendType::GDA_BACKEND:
return static_cast<GDABackend*>(this)->create_ctx(option, ctx);
break;
case BackendType::RO_BACKEND:
return static_cast<ROBackend*>(this)->create_ctx(option, ctx);
break;
case BackendType::IPC_BACKEND:
default:
return static_cast<IPCBackend*>(this)->create_ctx(option, ctx);
break;
}
#elif defined(USE_GDA)
return static_cast<GDABackend*>(this)->create_ctx(option, ctx);
#elif defined(USE_RO)
return static_cast<ROBackend*>(this)->create_ctx(option, ctx);
@@ -260,7 +275,20 @@ __device__ bool Backend::create_ctx(int64_t option, rocshmem_ctx_t* ctx) {
}
__device__ void Backend::destroy_ctx(rocshmem_ctx_t* ctx) {
#if defined(USE_GDA)
#if defined(USE_GDA) && defined(USE_RO) && defined(USE_IPC)
switch(this->type) {
case BackendType::GDA_BACKEND:
static_cast<GDABackend*>(this)->destroy_ctx(ctx);
break;
case BackendType::RO_BACKEND:
static_cast<ROBackend*>(this)->destroy_ctx(ctx);
break;
case BackendType::IPC_BACKEND:
default:
static_cast<IPCBackend*>(this)->destroy_ctx(ctx);
break;
}
#elif defined(USE_GDA)
static_cast<GDABackend*>(this)->destroy_ctx(ctx);
#elif defined(USE_RO)
static_cast<ROBackend*>(this)->destroy_ctx(ctx);