diff --git a/examples/hello_world.cpp b/examples/hello_world.cpp index 6548a69..e78466e 100644 --- a/examples/hello_world.cpp +++ b/examples/hello_world.cpp @@ -67,7 +67,7 @@ void Server() { // Some of the following calls might fail, but at least one will succeed Manager::listen("SHM:/MTCA-server"); Manager::listen("TCP:0.0.0.0:42000"); - Manager::listen("MPI:0:10"); + Manager::listen("MPI:0"); // can be omitted Manager::listen("MPIP2P:test"); Manager::listen("MQTT:label"); Manager::listen("UCX:0.0.0.0:21000"); @@ -132,7 +132,7 @@ void Client() { auto handle = []() { auto h = Manager::connect("MPIP2P:test"); if (!h.isValid()) { - auto h = Manager::connect("MPI:0:10"); + auto h = Manager::connect("MPI:0"); if (!h.isValid()) { auto h = Manager::connect("MQTT:label"); if(!h.isValid()) { diff --git a/examples/p2p-perf.cpp b/examples/p2p-perf.cpp index 96541c0..b8fdaad 100644 --- a/examples/p2p-perf.cpp +++ b/examples/p2p-perf.cpp @@ -22,7 +22,7 @@ #include #include #include "mtcl.hpp" - +using namespace MTCL; const int NROUND = 100; const int N = 24; const size_t minsize = 16; // bytes diff --git a/examples/pingpong.cpp b/examples/pingpong.cpp index 1b9f8fb..f4d1632 100644 --- a/examples/pingpong.cpp +++ b/examples/pingpong.cpp @@ -76,8 +76,8 @@ int main(int argc, char** argv){ to make the Manager happy in this "protocol-agnostic" example. */ #ifdef ENABLE_MPI - listen_str = {"MPI:"}; - connect_str = {"MPI:0:5"}; + listen_str = {"MPI:0"}; + connect_str = {"MPI:0"}; #endif diff --git a/include/collectives/collectiveContext.hpp b/include/collectives/collectiveContext.hpp index 9920a56..4e5e69a 100644 --- a/include/collectives/collectiveContext.hpp +++ b/include/collectives/collectiveContext.hpp @@ -8,11 +8,11 @@ #include "collectiveImpl.hpp" #include "../handle.hpp" -#ifdef ENABLE_MPI +#ifdef MTCL_ENABLE_MPI #include "mpiImpl.hpp" #endif -#ifdef ENABLE_UCX +#ifdef MTCL_ENABLE_UCX #include "uccImpl.hpp" #endif @@ -57,7 +57,7 @@ class CollectiveContext : public CommunicationHandle { coll = new BroadcastGeneric(participants, size, root, rank, uniqtag); break; case MPI: - #ifdef ENABLE_MPI + #ifdef MTCL_ENABLE_MPI void *max_tag; int flag; MPI_Comm_get_attr( MPI_COMM_WORLD, MPI_TAG_UB, &max_tag, &flag); @@ -65,7 +65,7 @@ class CollectiveContext : public CommunicationHandle { #endif break; case UCC: - #ifdef ENABLE_UCX + #ifdef MTCL_ENABLE_UCX coll = new BroadcastUCC(participants, size, root, rank, uniqtag); #endif break; @@ -83,7 +83,7 @@ class CollectiveContext : public CommunicationHandle { coll = new ScatterGeneric(participants, size, root, rank, uniqtag); break; case MPI: - #ifdef ENABLE_MPI + #ifdef MTCL_ENABLE_MPI void *max_tag; int flag; MPI_Comm_get_attr( MPI_COMM_WORLD, MPI_TAG_UB, &max_tag, &flag); @@ -91,7 +91,7 @@ class CollectiveContext : public CommunicationHandle { #endif break; case UCC: - #ifdef ENABLE_UCX + #ifdef MTCL_ENABLE_UCX coll = new ScatterUCC(participants, size, root, rank, uniqtag); #endif break; @@ -111,7 +111,7 @@ class CollectiveContext : public CommunicationHandle { coll = new GatherGeneric(participants, size, root, rank, uniqtag); break; case MPI: - #ifdef ENABLE_MPI + #ifdef MTCL_ENABLE_MPI void *max_tag; int flag; MPI_Comm_get_attr( MPI_COMM_WORLD, MPI_TAG_UB, &max_tag, &flag); @@ -119,7 +119,7 @@ class CollectiveContext : public CommunicationHandle { #endif break; case UCC: - #ifdef ENABLE_UCX + #ifdef MTCL_ENABLE_UCX coll = new GatherUCC(participants, size, root, rank, uniqtag); #endif break; @@ -137,7 +137,7 @@ class CollectiveContext : public CommunicationHandle { coll = new AllGatherGeneric(participants, size, root, rank, uniqtag); break; case MPI: - #ifdef ENABLE_MPI + #ifdef MTCL_ENABLE_MPI void *max_tag; int flag; MPI_Comm_get_attr( MPI_COMM_WORLD, MPI_TAG_UB, &max_tag, &flag); @@ -145,7 +145,7 @@ class CollectiveContext : public CommunicationHandle { #endif break; case UCC: - #ifdef ENABLE_UCX + #ifdef MTCL_ENABLE_UCX coll = new AllGatherUCC(participants, size, root, rank, uniqtag); #endif break; @@ -163,7 +163,7 @@ class CollectiveContext : public CommunicationHandle { coll = new AlltoallGeneric(participants, size, root, rank, uniqtag); break; case MPI: - #ifdef ENABLE_MPI + #ifdef MTCL_ENABLE_MPI void *max_tag; int flag; MPI_Comm_get_attr( MPI_COMM_WORLD, MPI_TAG_UB, &max_tag, &flag); @@ -171,7 +171,7 @@ class CollectiveContext : public CommunicationHandle { #endif break; case UCC: - #ifdef ENABLE_UCX + #ifdef MTCL_ENABLE_UCX coll = new AlltoallUCC(participants, size, root, rank, uniqtag); #endif break; diff --git a/include/manager.hpp b/include/manager.hpp index eb65bda..bbb81fd 100644 --- a/include/manager.hpp +++ b/include/manager.hpp @@ -28,23 +28,23 @@ #endif #endif -#ifdef ENABLE_MPI +#ifdef MTCL_ENABLE_MPI #include "protocols/mpi.hpp" #endif -#ifdef ENABLE_MPIP2P +#ifdef MTCL_ENABLE_MPIP2P #include "protocols/mpip2p.hpp" #endif -#ifdef ENABLE_MQTT +#ifdef MTCL_ENABLE_MQTT #include "protocols/mqtt.hpp" #endif -#ifdef ENABLE_UCX +#ifdef MTCL_ENABLE_UCX #include "protocols/ucx.hpp" #endif -#ifdef ENABLE_SHM +#ifdef MTCL_ENABLE_SHM #include "protocols/shm.hpp" #endif namespace MTCL { @@ -75,7 +75,9 @@ class Manager { inline static std::map, std::vector>> components; #endif - REMOVE_CODE_IF(inline static std::thread t1); +#ifndef SINGLE_IO_THREAD + inline static std::thread t1; +#endif inline static bool end; inline static bool initialized = false; @@ -340,23 +342,23 @@ class Manager { // default transports protocol registerType("TCP"); -#ifdef ENABLE_SHM +#ifdef MTCL_ENABLE_SHM registerType("SHM"); #endif -#ifdef ENABLE_MPI +#ifdef MTCL_ENABLE_MPI registerType("MPI"); #endif -#ifdef ENABLE_MPIP2P +#ifdef MTCL_ENABLE_MQTT registerType("MPIP2P"); #endif -#ifdef ENABLE_MQTT +#ifdef MTCL_ENABLE_MQTT registerType("MQTT"); #endif -#ifdef ENABLE_UCX +#ifdef MTCL_ENABLE_UCX registerType("UCX"); #endif @@ -389,8 +391,9 @@ class Manager { } #endif - REMOVE_CODE_IF(t1 = std::thread([&](){Manager::getReadyBackend();})); - +#ifndef SINGLE_IO_THREAD + t1 = std::thread([&](){Manager::getReadyBackend();}); +#endif initialized = true; return 0; } @@ -406,8 +409,9 @@ class Manager { */ static void finalize(bool blockflag=false) { end = true; - REMOVE_CODE_IF(t1.join()); - +#ifndef SINGLE_IO_THREAD + t1.join(); +#endif //while(!handleReady.empty()) handleReady.pop(); #ifndef MTCL_DISABLE_COLLECTIVES for(auto& [ctx, _] : contexts) { @@ -438,8 +442,8 @@ class Manager { // if us is not multiple of the IO_THREAD_POLL_TIMEOUT we wait a bit less.... // if the poll timeout is 0, we just iterate us times size_t niter = us.count(); // in case IO_THREAD_POLL_TIMEOUT is set to 0 - if constexpr (IO_THREAD_POLL_TIMEOUT) - niter = us/std::chrono::milliseconds(IO_THREAD_POLL_TIMEOUT); + if constexpr (!!IO_THREAD_POLL_TIMEOUT) + niter = us/std::chrono::microseconds(IO_THREAD_POLL_TIMEOUT); if (niter==0) niter++; size_t i=0; do { @@ -465,7 +469,7 @@ class Manager { } if (i >= niter) break; ++i; - if constexpr (IO_THREAD_POLL_TIMEOUT) + if constexpr (!!IO_THREAD_POLL_TIMEOUT) std::this_thread::sleep_for(std::chrono::microseconds(IO_THREAD_POLL_TIMEOUT)); } while(true); return HandleUser(nullptr, true, true); diff --git a/include/mtcl.hpp b/include/mtcl.hpp index 2a4409e..e563454 100644 --- a/include/mtcl.hpp +++ b/include/mtcl.hpp @@ -3,24 +3,36 @@ namespace MTCL { + #if defined(ENABLE_MPI) const bool MPI_ENABLED = true; +#define MTCL_ENABLE_MPI #else const bool MPI_ENABLED = false; #endif -#if defined(ENABLE_MPIP2P) +#if defined(ENABLE_MPIP2P) && !defined(NO_MTCL_MULTITHREADED) const bool MPIP2P_ENABLED = true; +#define MTCL_ENABLE_MPIP2P #else const bool MPIP2P_ENABLED = false; #endif #if defined(ENABLE_UCX) const bool UCX_ENABLED = true; const bool UCC_ENABLED = true; +#define MTCL_ENABLE_UCX #else const bool UCX_ENABLED = false; const bool UCC_ENABLED = false; #endif +#ifdef ENABLE_SHM +#define MTCL_ENABLE_SHM +#endif + +#ifdef ENABLE_MQTT +#define MTCL_ENABLE_MQTT +#endif + } // namespace diff --git a/include/protocols/mpi.hpp b/include/protocols/mpi.hpp index 86ed2dc..61cae78 100644 --- a/include/protocols/mpi.hpp +++ b/include/protocols/mpi.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -157,6 +158,7 @@ class ConnMPI : public ConnType { // => std::map, std::pair> connections; std::shared_mutex shm; + std::atomic tag_counter_even = 100, tag_counter_odd = 101; public: @@ -201,14 +203,14 @@ class ConnMPI : public ConnType { } int tag; - try { + /* try { tag = stoi(dest.substr(dest.find(":") + 1, dest.length())); } catch(std::invalid_argument&) { MTCL_MPI_PRINT(100, "ConnMPI::connect rank must be an integer greater than 0\n"); errno = EINVAL; return nullptr; - } + }*/ if(rank < 0) { MTCL_MPI_PRINT(100, "ConnMPI::connect the connection rank must be greater or equal than 0\n"); @@ -216,12 +218,23 @@ class ConnMPI : public ConnType { return nullptr; } - if (tag <= (int)MPI_CONNECTION_TAG){ + /*if (tag <= (int)MPI_CONNECTION_TAG){ MTCL_MPI_PRINT(100, "ConnMPI::connect the connection tag must be greater than 0\n"); errno = EINVAL; return nullptr; } - + + if (connections.count({rank, tag})){ + MTCL_MPI_PRINT(100, "ConnMPI::connect: connection already done use the previous handler!\n"); + errno = EINVAL; + return nullptr; + }*/ + + if (this->rank < rank) + tag = tag_counter_even.fetch_add(2); + else + tag = tag_counter_odd.fetch_add(2); + int header[1]; header[0] = tag; if (MPI_Send(header, 1, MPI_INT, rank, MPI_CONNECTION_TAG, MPI_COMM_WORLD) != MPI_SUCCESS) { diff --git a/include/protocols/mpip2p.hpp b/include/protocols/mpip2p.hpp index 19158f2..dd9d119 100644 --- a/include/protocols/mpip2p.hpp +++ b/include/protocols/mpip2p.hpp @@ -227,11 +227,9 @@ class ConnMPIP2P : public ConnType { for(int i=0; i connections; // Active connections for this Connector -#if !defined(SINGLE_IO_THREAD) +#if defined(NO_MTCL_MULTITHREADED) std::shared_mutex shm; #endif diff --git a/include/protocols/tcp.hpp b/include/protocols/tcp.hpp index 530db02..76b93fb 100644 --- a/include/protocols/tcp.hpp +++ b/include/protocols/tcp.hpp @@ -151,7 +151,7 @@ class ConnTcp : public ConnType { fd_set set, tmpset; int listen_sck; -#if defined(SINGLE_IO_THREAD) +#if defined(NO_MTCL_MULTITHREADED) int fdmax; #else std::atomic fdmax; diff --git a/include/protocols/ucx.hpp b/include/protocols/ucx.hpp index bb9f1cd..dc40b2c 100644 --- a/include/protocols/ucx.hpp +++ b/include/protocols/ucx.hpp @@ -270,7 +270,7 @@ class ConnUCX : public ConnType { fd_set set, tmpset; int listen_sck; -#if defined(SINGLE_IO_THREAD) +#if defined(NO_MTCL_MULTITHREADED) int fdmax; #else std::atomic fdmax; diff --git a/include/utils.hpp b/include/utils.hpp index 9961a8b..6a0a588 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -179,10 +179,11 @@ static inline int internal_connect(const std::string& address, int retry, unsign } // namespace -// if SINGLE_IO_THREAD is defined, we do not use locking for accessing +// if NO_MTCL_MULTITHREADED is defined, we do not use locking for accessing // internal data structures, thus some code can be removed. // A different case is for the MPIP2P transport protocol. -#if defined(SINGLE_IO_THREAD) +#if defined(NO_MTCL_MULTITHREADED) +#define SINGLE_IO_THREAD #define REMOVE_CODE_IF(X) #define ADD_CODE_IF(X) X #else diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..9963527 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,89 @@ +ifndef CXX +CXX = g++ +endif + +MTCL_DIR=../ + +CXXFLAGS += -std=c++17 +INCS = -I . -I $(MTCL_DIR)/include + +ifdef DEBUG + OPTIMIZE_FLAGS += -g -fno-inline-functions +else + OPTIMIZE_FLAGS += -O3 -finline-functions -DNDEBUG +endif + +ifdef SINGLE_IO_THREAD + CXXFLAGS +=-DSINGLE_IO_THREAD +endif + +ifeq ($(findstring SHM,$(TPROTOCOL)),SHM) + CXXFLAGS += -DENABLE_SHM +endif + +ifeq ($(findstring MPI,$(TPROTOCOL)),MPI) + CXX = mpicxx + CXXFLAGS += -DENABLE_MPI + TARGET = $(MTCL_DIR)protocols/stop_accept +ifdef MPI_HOME + INCS += `pkg-config --cflags-only-I $(MPI_HOME)/lib/pkgconfig/ompi-cxx.pc` + LIBS += `pkg-config --libs $(MPI_HOME)/lib/pkgconfig/ompi-cxx.pc` +endif +endif + +ifeq ($(findstring MQTT, $(TPROTOCOL)),MQTT) + CXXFLAGS += -DENABLE_MQTT +ifndef PAHO_HOME +$(error PAHO_HOME env variable not defined!); +endif + INCS += -I${PAHO_HOME}/include + LIBS += -L${PAHO_HOME}/lib -Wl,-rpath,${PAHO_HOME}/lib -lpaho-mqttpp3 -lpaho-mqtt3as -lpaho-mqtt3a +endif + +ifeq ($(findstring TCP, $(TPROTOCOL)),TCP) + CXXFLAGS += -DENABLE_TCP +endif + +ifeq ($(findstring UCX, $(TPROTOCOL)),UCX) +ifndef UCC_HOME +$(error UCC_HOME env variable not defined!); +endif + CXXFLAGS += -DENABLE_UCX +ifndef UCX_HOME +$(error UCX_HOME env variable not defined!); +endif + INCS += -I$(UCX_HOME)/include -I$(UCC_HOME)/include + LIBS += -L$(UCX_HOME)/lib -Wl,-rpath,${UCX_HOME}/lib -lucp -luct -lucs -lucm -L${UCC_HOME}/lib -Wl,-rpath,${UCC_HOME}/lib -lucc +endif + +CXXFLAGS += -Wall +LIBS += -I ${RAPIDJSON_HOME}/include -pthread +INCLUDES = $(INCS) + +SOURCES = $(wildcard *.cpp) +TARGET += $(SOURCES:.cpp=) + +.PHONY: all clean cleanall +.SUFFIXES: .c .cpp .o + +%.d: %.cpp + @set -e; $(CXX) -MM $(INCLUDES) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1 $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ +%.d: %.c + @set -e; $(CC) -MM $(INCLUDES) $(CFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1 $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ +%.o: %.c + $(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $< +%: %.cpp + $(CXX) $(INCLUDES) $(CXXFLAGS) $(OPTIMIZE_FLAGS) -o $@ $< $(LDFLAGS) $(LIBS) + +all: $(TARGET) + +clean: + -rm -fr $(TARGET) *~ +cleanall: clean + -rm -fr *.d uri_file.txt $(MTCL_DIR)/protocols/stop_accept + +include $(SOURCES:.cpp=.d) diff --git a/tests/test_connect.cpp b/tests/test_connect.cpp index b2264f4..63d8485 100644 --- a/tests/test_connect.cpp +++ b/tests/test_connect.cpp @@ -3,7 +3,7 @@ #include #include #include "mtcl.hpp" - +using namespace MTCL; const std::string str{"hello world!"}; //...........................................................................................abcdef.............................................................................ghijk..........................................................................................................................................................................................................012345..........................................................................................................................................................................................................6789.............................................................xywz................................................bye!"}; std::string address{"TCP:localhost:13000"}; diff --git a/tests/test_mpi_disconnect.cpp b/tests/test_mpi_disconnect.cpp index e197c7e..e1459cb 100644 --- a/tests/test_mpi_disconnect.cpp +++ b/tests/test_mpi_disconnect.cpp @@ -1,25 +1,25 @@ #include -#include "../commlib.hpp" - +#include "mtcl.hpp" +using namespace MTCL; int main(int argc, char** argv){ #ifdef EXCLUDE_MPI std::cerr << "You must compile with MPI support this test\n"; return 1; #endif - Manager::init(); + Manager::init(""); int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank == 0){ - Manager::connect("MPI:1:2"); + Manager::connect("MPI:1"); while(true){ std::cout << "0: get an handle!\n"; auto h = Manager::getNext(); std::cout << "0: handle received!\n"; char tmp; - if (h.read(&tmp, 1) == 0){ + if (h.receive(&tmp, 1) == 0){ std::cout << "0: Peer closed connection\n"; h.close(); break; diff --git a/tests/test_mpi_disconnect2.cpp b/tests/test_mpi_disconnect2.cpp index fc4fb0a..53ea984 100644 --- a/tests/test_mpi_disconnect2.cpp +++ b/tests/test_mpi_disconnect2.cpp @@ -1,12 +1,12 @@ #include -#include "../commlib.hpp" - +#include "mtcl.hpp" +using namespace MTCL; int main(int argc, char** argv){ #ifdef EXCLUDE_MPI std::cerr << "You must compile with MPI support this test\n"; return 1; #endif - Manager::init(); + Manager::init(""); int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -16,7 +16,7 @@ int main(int argc, char** argv){ std::cout << "0: handle received!\n"; while(true){ char tmp; - if (h.read(&tmp, 1) == 0){ + if (h.receive(&tmp, 1) == 0){ std::cout << "0: Peer closed connection\n"; h.close(); break; diff --git a/tests/test_mpi_disconnect3.cpp b/tests/test_mpi_disconnect3.cpp index d1aa449..67c51fc 100644 --- a/tests/test_mpi_disconnect3.cpp +++ b/tests/test_mpi_disconnect3.cpp @@ -1,5 +1,6 @@ #include -#include "../commlib.hpp" +#include "mtcl.hpp" +using namespace MTCL; int main(int argc, char** argv){ #ifdef EXCLUDE_MPI @@ -7,7 +8,7 @@ int main(int argc, char** argv){ return 1; #endif - Manager::init(); + Manager::init(""); int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -17,7 +18,7 @@ int main(int argc, char** argv){ std::cout << "0: handle received!\n"; while(true){ char tmp; - if (h.read(&tmp, 1) == 0){ + if (h.receive(&tmp, 1) == 0){ std::cout << "0: Peer closed connection\n"; h.close(); break; @@ -33,9 +34,11 @@ int main(int argc, char** argv){ std::cout << "1: Received new connection!\n"; h.close(); std::cout << "1: connection closed!\n"; - // should be an error here! - h.send("a", 1); - std::cout << "1: sended a\n"; + // should be an error here since we send after closing connection! + if (h.send("a", 1) < 0) + std::cerr << "1: Error in sending!\n"; + else + std::cout << "1: sended a\n"; } } diff --git a/tests/test_mpi_multiconnect.cpp b/tests/test_mpi_multiconnect.cpp new file mode 100644 index 0000000..2f949db --- /dev/null +++ b/tests/test_mpi_multiconnect.cpp @@ -0,0 +1,65 @@ +#include +#include "mtcl.hpp" + +int main(int argc, char** argv){ +#ifdef EXCLUDE_MPI + std::cerr << "You must compile with MPI support this test\n"; + return 1; +#endif + + MTCL::Manager::init("e"); + + int rank; + sleep(5); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + if (rank == 0){ + auto h1 = MTCL::Manager::connect("MPI:1"); + auto h2 = MTCL::Manager::connect("MPI:1"); + + std::cout << "First connection id: " << h1.getID() << std::endl; + std::cout << "Second connection id: " << h2.getID() << std::endl; + sleep(1); + int dummy = 1000; + h1.send(&dummy, sizeof(dummy)); + sleep(1); + h2.send(&dummy, sizeof(dummy)); + sleep(1); + auto hr = MTCL::Manager::getNext(); + std::cout << "Received message from rank 0 of id: " << hr.getID() << std::endl; + + } else { + int dummy; + ///MTCL::Manager::listen("MPI:1:2"); + auto h = MTCL::Manager::getNext(); + if (h.isNewConnection()) { + std::cout << "Receiver id: " << h.getID() << std::endl; + } + h.yield(); + h = MTCL::Manager::getNext(); + if (h.isNewConnection()) { + std::cout << "Receiver id: " << h.getID() << std::endl; + } + h.yield(); + h = MTCL::Manager::getNext(); + std::cout << "Receiver id: " << h.getID() << std::endl; + size_t sz; + h.probe(sz); + assert(sz == sizeof(dummy)); + h.receive(&dummy, sz); + h.yield(); + h = MTCL::Manager::getNext(); + std::cout << "Receiver id: " << h.getID() << std::endl; + h.probe(sz); + assert(sz == sizeof(dummy)); + h.receive(&dummy, sz); + + auto hr = MTCL::Manager::connect("MPI:0:1"); + std::cout << "Backwards connect id: " << hr.getID() << std::endl; + + } + + MTCL::Manager::finalize(); + return 0; + +} \ No newline at end of file diff --git a/tests/test_non-matching_comm.cpp b/tests/test_non-matching_comm.cpp index 31d5456..cfca60a 100644 --- a/tests/test_non-matching_comm.cpp +++ b/tests/test_non-matching_comm.cpp @@ -26,8 +26,8 @@ * */ #include -#include "../mtcl.hpp" - +#include "mtcl.hpp" +using namespace MTCL; const int max_msg_size=100; // max message size const std::string bye{"Bye!"}; // bye bye message const std::string welcome{"Hello!"}; // welcome message @@ -53,7 +53,7 @@ int main(int argc, char** argv){ Manager::init(argv[2]); if (rank == 0){ - Manager::listen("MPI:0:10"); + Manager::listen("MPI:0"); // can be omitted Manager::listen("UCX:0.0.0.0:21000"); char *buff = new char[maxsize]; @@ -78,7 +78,7 @@ int main(int argc, char** argv){ else { auto handle = []() { - auto h = Manager::connect("MPI:0:10"); + auto h = Manager::connect("MPI:0"); if (!h.isValid()) { auto h = Manager::connect("UCX:0.0.0.0:21000"); assert(h.isValid()); diff --git a/tests/test_probe-nb.cpp b/tests/test_probe-nb.cpp index 2417200..b4dd5af 100644 --- a/tests/test_probe-nb.cpp +++ b/tests/test_probe-nb.cpp @@ -3,7 +3,7 @@ #include #include #include "mtcl.hpp" - +using namespace MTCL; int main(int argc, char** argv){ pid_t pid = fork(); diff --git a/tests/test_probe.cpp b/tests/test_probe.cpp index 729868f..7c78498 100644 --- a/tests/test_probe.cpp +++ b/tests/test_probe.cpp @@ -3,7 +3,7 @@ #include #include #include "mtcl.hpp" - +using namespace MTCL; int main(int argc, char** argv){ pid_t pid = fork();