Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/nccl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Sigg <chsigg@users.noreply.github.com>2019-12-06 20:14:55 +0300
committerSylvain Jeaugey <sjeaugey@nvidia.com>2019-12-06 20:14:55 +0300
commit8c564e9b57dc0fb913ce31de99c6ad556ae04fa7 (patch)
treeaf172a5f9d88a7635af0c2b6078569129a8e2664
parent299c554dccf923230321ad7495946543f3e9b457 (diff)
Fix clang build (#271)
Clang doesn't understand `optimize("O0")`. It has `noopt`, which GCC doesn't understand. Wrap the difference in a macro.
-rw-r--r--src/init.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/init.cc b/src/init.cc
index 1ee2a73..15a9e7c 100644
--- a/src/init.cc
+++ b/src/init.cc
@@ -124,10 +124,18 @@ ncclResult_t ncclGetUniqueId(ncclUniqueId* out) {
}
// Prevent compiler from optimizing out these operations
-void __attribute__((optimize("O0"))) commPoison(ncclComm_t comm) {
+#ifdef __clang__
+#define NCCL_NO_OPTIMIZE __attribute__((noopt)))
+#else
+#define NCCL_NO_OPTIMIZE __attribute__((optimize("O0")))
+#endif
+
+void NCCL_NO_OPTIMIZE commPoison(ncclComm_t comm) {
comm->rank = comm->cudaDev = comm->busId = comm->nRanks = -1;
}
+#undef NCCL_NO_OPTIMIZE
+
static ncclResult_t commFree(ncclComm_t comm) {
if (comm == NULL)
return ncclSuccess;