diff --git a/Makefile b/Makefile index 0ebc2796..e9d1f45c 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ OBJDIR := obj BINDIR := bin LIBSRCS := $(addprefix src/,debug.cc utils.cc param.cc) -LIBSRCS += $(addprefix src/bootstrap/,init.cc bootstrap.cc socket.cc proxy.cc shmutils.cc) +LIBSRCS += $(addprefix src/bootstrap/,init.cc bootstrap.cc socket.cc proxy.cc) LIBOBJS := $(patsubst %.cc,%.o,$(LIBSRCS)) LIBOBJTARGETS := $(LIBOBJS:%=$(BUILDDIR)/$(OBJDIR)/%) diff --git a/src/bootstrap/init.cc b/src/bootstrap/init.cc index 2c7b5d85..b8142ed7 100644 --- a/src/bootstrap/init.cc +++ b/src/bootstrap/init.cc @@ -1,7 +1,6 @@ #include "mscclpp.h" #include "bootstrap.h" #include "core.h" -#include "shmutils.h" #include #include @@ -65,9 +64,9 @@ MSCCLPP_API(mscclppResult_t, mscclppCommInitRank, mscclppComm_t* comm, int nrank mscclppResult_t mscclppCommInitRank(mscclppComm_t* comm, int nranks, int rank, const char* ip_port_pair){ mscclppResult_t res = mscclppSuccess; mscclppComm_t _comm = NULL; - uint64_t hash = getHostHash(); - uint64_t *hashes; - std::map hashToNode; + // uint64_t hash = getHostHash(); + // uint64_t *hashes; + // std::map hashToNode; MSCCLPPCHECKGOTO(mscclppCalloc(&_comm, 1), res, fail); _comm->rank = rank; diff --git a/src/bootstrap/shmutils.cc b/src/bootstrap/shmutils.cc deleted file mode 100644 index eebe4e52..00000000 --- a/src/bootstrap/shmutils.cc +++ /dev/null @@ -1,80 +0,0 @@ -#include "shmutils.h" -#include "debug.h" -#include -#include -#include -#include - -#define SHM_MODE 0666 - -// Open a shme file and create an mmap. -static mscclppResult_t shmutilsMapOpen(const char *name, size_t size, int *fd, void **map, int flag) -{ - int _fd = shm_open(name, flag, SHM_MODE); - if (_fd == -1) { - WARN("Failed to open shm file %s (flag: %d)", name, flag); - return mscclppInternalError; - } - void *_map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, _fd, 0); - if (_map == MAP_FAILED) { - WARN("Failed to mmap shm file %s", name); - goto fail; - } - if (flag & O_CREAT) { - if (ftruncate(_fd, 0) == -1) { - WARN("Failed to ftruncate shm file %s", name); - goto fail; - } - } - if (ftruncate(_fd, size) == -1) { - WARN("Failed to ftruncate shm file %s", name); - goto fail; - } - *fd = _fd; - *map = _map; - return mscclppSuccess; -fail: - close(_fd); - shm_unlink(name); - return mscclppInternalError; -} - -// Open or create a shm file. -mscclppResult_t mscclppShmutilsMapCreate(const char *name, size_t size, int *fd, void **map) -{ - return shmutilsMapOpen(name, size, fd, map, O_CREAT | O_RDWR); -} - -// Open an existing shm file. -mscclppResult_t mscclppShmutilsMapOpen(const char *name, size_t size, int *fd, void **map) -{ - return shmutilsMapOpen(name, size, fd, map, O_RDWR); -} - -// Close a shm mmap. -mscclppResult_t mscclppShmutilsMapClose(const char *name, size_t size, int fd, void *map) -{ - int err = 0; - if (munmap(map, size) == -1) { - WARN("Failed to munmap shm file %s", name); - err = 1; - } - close(fd); - return err ? mscclppInternalError : mscclppSuccess; -} - -// Close a shm mmap and destroy a shm file. -mscclppResult_t mscclppShmutilsMapDestroy(const char *name, size_t size, int fd, void *map) -{ - int err = 0; - if (munmap(map, size) == -1) { - WARN("Failed to munmap shm file %s", name); - err = 1; - } - close(fd); - if (shm_unlink(name) == -1) { - WARN("Failed to unlink shm file %s: errno %d", name, errno); - err = 1; - } - return err ? mscclppInternalError : mscclppSuccess; -} diff --git a/src/include/shmutils.h b/src/include/shmutils.h deleted file mode 100644 index 21dfa011..00000000 --- a/src/include/shmutils.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef MSCCLPP_SHMUTILS_H_ -#define MSCCLPP_SHMUTILS_H_ - -#include "mscclpp.h" - -mscclppResult_t mscclppShmutilsMapCreate(const char *name, size_t size, int *fd, void **map); -mscclppResult_t mscclppShmutilsMapOpen(const char *name, size_t size, int *fd, void **map); -mscclppResult_t mscclppShmutilsMapClose(const char *name, size_t size, int fd, void *map); -mscclppResult_t mscclppShmutilsMapDestroy(const char *name, size_t size, int fd, void *map); - -#endif