Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NVIDIA/nccl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7ed5d252a07ad2b90f7f369c58687cf4fb8b9bf5
Choose a base ref
..
head repository: NVIDIA/nccl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bfdb006f5aa1485897af4b9838d3150f82f0443d
Choose a head ref
Showing with 14 additions and 12 deletions.
  1. +14 −12 src/misc/param.cc
26 changes: 14 additions & 12 deletions src/misc/param.cc
Original file line number Diff line number Diff line change
@@ -69,19 +69,21 @@ void ncclLoadParam(char const* env, int64_t deftVal, int64_t uninitialized, int6
if (__atomic_load_n(cache, __ATOMIC_RELAXED) == uninitialized) {
const char* str = ncclGetEnv(env);
int64_t value = deftVal;
if (str && strlen(str) > 0) {
errno = 0;
value = strtoll(str, nullptr, 0);
// To prevent deadlock issues caused by logging in a loop,
// so cache the value before the log operation.
__atomic_store_n(cache, errno ? deftVal : value, __ATOMIC_RELAXED);
if (errno) {
INFO(NCCL_ALL,"Invalid value %s for %s, using default %lld.", str, env, (long long)deftVal);
} else {
INFO(NCCL_ENV,"%s set by environment to %lld.", env, (long long)value);
}
if (!str || strlen(str) <= 0) {
__atomic_store_n(cache, value, __ATOMIC_RELAXED);
pthread_mutex_unlock(&mutex);
return;
}
errno = 0;
value = strtoll(str, nullptr, 0);
// To prevent deadlock issues caused by logging in a loop,
// so cache the value before the log operation.
__atomic_store_n(cache, errno ? deftVal : value, __ATOMIC_RELAXED);
if (errno) {
INFO(NCCL_ALL,"Invalid value %s for %s, using default %lld.", str, env, (long long)deftVal);
} else {
INFO(NCCL_ENV,"%s set by environment to %lld.", env, (long long)value);
}
__atomic_store_n(cache, value, __ATOMIC_RELAXED);
}
pthread_mutex_unlock(&mutex);
}