Skip to content
Snippets Groups Projects
Commit 3e28a07d authored by Carsten Patzke's avatar Carsten Patzke
Browse files

Only enable LibFabric localhost emulation if compiler flag is set

parent fcbbee39
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,7 @@ option(BUILD_CONSUMER_TOOLS "Build consumer tools" OFF)
option(BUILD_EXAMPLES "Build examples" OFF)
option(ENABLE_LIBFABRIC "Enables LibFabric support for RDMA transfers" OFF)
option(ENABLE_LIBFABRIC_LOCALHOST "Emulates LibFabric stack over TCP. Only for localhost and testing purposes." OFF)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules/)
......@@ -75,6 +76,10 @@ IF(ENABLE_LIBFABRIC)
message(STATUS "LIB_FABRIC: Path: ${LIBFABRIC_LIBRARY} Include: ${LIBFABRIC_INCLUDE_DIR}")
add_definitions(-DLIBFABRIC_ENABLED)
SET(ASAPO_COMMON_FABRIC_LIBRARIES ${ASAPO_COMMON_FABRIC_LIBRARIES} fabric)
IF(ENABLE_LIBFABRIC_LOCALHOST)
message(STATUS "LIB_FABRIC: Enabled emulated RDMA when localhost is used. Should only be used for tests.")
add_definitions(-DLIBFARBIC_ALLOW_LOCALHOST)
ENDIF()
ENDIF()
SET_PROPERTY(GLOBAL PROPERTY ASAPO_COMMON_FABRIC_LIBRARIES ${ASAPO_COMMON_FABRIC_LIBRARIES})
......@@ -123,4 +128,4 @@ endif()
include(prepare_version)
add_subdirectory(docs)
\ No newline at end of file
add_subdirectory(docs)
......@@ -66,8 +66,15 @@ void FabricContextImpl::InitCommon(const std::string& networkIpHint, uint16_t se
uint64_t additionalFlags = isServer ? FI_SOURCE : 0;
fi_info* hints = fi_allocinfo();
if (networkIpHint == "127.0.0.1") {
#ifdef LIBFARBIC_ALLOW_LOCALHOST
constexpr bool allowLocalhost = true;
#else
constexpr bool allowLocalhost = false;
#endif
if (networkIpHint == "127.0.0.1" && allowLocalhost) {
// sockets mode
printf("WARN: Using sockets to emulate RDMA, this should only used for tests.\n");
hints->fabric_attr->prov_name = strdup("sockets");
hotfix_using_sockets_ = true;
} else {
......
......@@ -39,5 +39,9 @@ endif()
add_subdirectory(bug_fixes)
if (ENABLE_LIBFABRIC)
add_subdirectory(asapo_fabric)
if (ENABLE_LIBFABRIC_LOCALHOST)
add_subdirectory(asapo_fabric)
else ()
message(WARNING "Disabled automated LibFabric test because 'ENABLE_LIBFABRIC_LOCALHOST' is not enabled.")
endif()
endif()
......@@ -10,7 +10,9 @@ int main(int argc, char* argv[]) {
if (argc < 3 || argc > 5) {
std::cout
<< "Usage: " << argv[0] << " <serverAddress> <serverPort> [kiByte=1024*400/*400MiByte*/ /*MUST BE SYNC WITH SERVER*/] [count=10]" << std::endl
#ifdef LIBFARBIC_ALLOW_LOCALHOST
<< "If the address is localhost or 127.0.0.1 the verbs connection will be emulated" << std::endl
#endif
;
return 1;
}
......
......@@ -40,7 +40,9 @@ int main(int argc, char* argv[]) {
if (argc < 3 || argc > 4) {
std::cout
<< "Usage: " << argv[0] << " <listenAddress> <listenPort> [kiByte=1024*400/*400MiByte*/ /*MUST BE SYNC WITH CLIENT*/]" << std::endl
#ifdef LIBFARBIC_ALLOW_LOCALHOST
<< "If the address is localhost or 127.0.0.1 the verbs connection will be emulated" << std::endl
#endif
;
return 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment