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:
+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);
|
||||
|
||||
مرجع در شماره جدید
Block a user