diff options
author | David Addison <daddison@nvidia.com> | 2019-08-14 02:32:07 +0300 |
---|---|---|
committer | David Addison <daddison@nvidia.com> | 2019-08-14 02:32:07 +0300 |
commit | 7f2b337e703d73ed369937c9996e1f3d5f664ad0 (patch) | |
tree | 1bf2c54a0d16a0bf11eb8b662b0c10e37152fc34 | |
parent | bfb39215199bf6b0cd29631441f0a345d5f1d869 (diff) |
Make use of SO_REUSEPORT conditional
Fixes: #244
SO_RESUEPORT was introduced in Linux 3.9 and later.
This change allows NCCL to compile against older releases.
The functionality is only required if the user is specifying
a NCCL bootstrap address via an environment variable.
-rw-r--r-- | src/include/socket.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/socket.h b/src/include/socket.h index 68ce235..b4f09b9 100644 --- a/src/include/socket.h +++ b/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) |