diff --git a/projects/rccl/pkg/redhat/nccl.spec.in b/projects/rccl/pkg/redhat/nccl.spec.in index f9d83a30df..5fad346f4a 100644 --- a/projects/rccl/pkg/redhat/nccl.spec.in +++ b/projects/rccl/pkg/redhat/nccl.spec.in @@ -7,6 +7,7 @@ Group: Development/Libraries License: BSD URL: http://developer.nvidia.com/nccl Source0: nccl_${nccl:Major}.${nccl:Minor}.${nccl:Patch}${nccl:Suffix}-${pkg:Revision}+cuda${cuda:Major}.${cuda:Minor}_${pkg:Arch}.txz +Prereq: /sbin/ldconfig %description NCCL (pronounced "Nickel") is a stand-alone library of standard collective @@ -50,6 +51,12 @@ ln -s libnccl.so.${nccl:Major} $RPM_BUILD_ROOT/%{_libdir}/libnccl.so # static install -m 644 lib/libnccl_static.a $RPM_BUILD_ROOT/%{_libdir} +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%post devel -p /sbin/ldconfig +%postun devel -p /sbin/ldconfig + %clean rm -rf $RPM_BUILD_ROOT diff --git a/projects/rccl/src/include/socket.h b/projects/rccl/src/include/socket.h index 68ce235d62..b4f09b9cc1 100644 --- a/projects/rccl/src/include/socket.h +++ b/projects/rccl/src/include/socket.h @@ -327,7 +327,11 @@ static ncclResult_t createListenSocket(int *fd, union socketAddress *localAddr) if (socketToPort(&localAddr->sa)) { // Port is forced by env. Make sure we get the port. int opt = 1; +#if defined(SO_REUSEPORT) SYSCHECK(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)), "setsockopt"); +#else + SYSCHECK(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)), "setsockopt"); +#endif } // localAddr port should be 0 (Any port) diff --git a/projects/rccl/src/include/utils.h b/projects/rccl/src/include/utils.h index 2282f5cce3..4f03d409e9 100644 --- a/projects/rccl/src/include/utils.h +++ b/projects/rccl/src/include/utils.h @@ -12,7 +12,7 @@ #include ncclResult_t getHostName(char* hostname, int maxlen, const char delim); -uint64_t getnHash(const char* string, int n); +uint64_t getHash(const char* string, int n); uint64_t getHostHash(); uint64_t getPidHash(); diff --git a/projects/rccl/src/init.cc b/projects/rccl/src/init.cc index 320b5d4f35..3e9c793bbe 100644 --- a/projects/rccl/src/init.cc +++ b/projects/rccl/src/init.cc @@ -765,8 +765,8 @@ static ncclResult_t initTransportsRank(struct ncclComm* comm, ncclUniqueId* comm int rank = comm->rank; int nranks = comm->nRanks; - uint64_t commHash = getnHash(commId->internal, NCCL_UNIQUE_ID_BYTES); - TRACE(NCCL_INIT, "comm %p, commHash %lu, rank %d nranks %d - BEGIN", comm, commHash, rank, nranks); + uint64_t commHash = getHash(commId->internal, NCCL_UNIQUE_ID_BYTES); + TRACE(NCCL_INIT, "comm %p, commHash %lx, rank %d nranks %d - BEGIN", comm, commHash, rank, nranks); NCCLCHECK(bootstrapInit(commId, rank, nranks, &comm->bootstrap)); // AllGather1 - begin diff --git a/projects/rccl/src/misc/utils.cc b/projects/rccl/src/misc/utils.cc index 614c78b936..e18b9b1b75 100644 --- a/projects/rccl/src/misc/utils.cc +++ b/projects/rccl/src/misc/utils.cc @@ -88,10 +88,10 @@ void ncclDebugLog(ncclDebugLogLevel level, unsigned long flags, const char *file } } -uint64_t getHash(const char* string) { +uint64_t getHash(const char* string, int n) { // Based on DJB2, result = result * 33 + char uint64_t result = 5381; - for (int c = 0; string[c] != '\0'; c++) { + for (int c = 0; c < n; c++) { result = ((result << 5) + result) + string[c]; } return result; @@ -130,7 +130,7 @@ uint64_t getHostHash(void) { uname[offset]='\0'; TRACE(NCCL_INIT,"unique hostname '%s'", uname); - return getHash(uname); + return getHash(uname, strlen(uname)); } /* Generate a hash of the unique identifying string for this process @@ -150,7 +150,7 @@ uint64_t getPidHash(void) { pname[plen+len]='\0'; TRACE(NCCL_INIT,"unique PID '%s'", pname); - return getHash(pname); + return getHash(pname, strlen(pname)); } int parseStringList(const char* string, struct netIf* ifList, int maxList) {