Merge remote-tracking branch 'nccl/master' into develop
This commit is contained in:
+18
-2
@@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
* Modifications Copyright (c) 2019-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
|
||||
* Modifications Copyright (c) 2019-2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* See LICENSE.txt for license information
|
||||
************************************************************************/
|
||||
@@ -168,3 +168,19 @@ void ncclDebugLog(ncclDebugLogLevel level, unsigned long flags, const char *file
|
||||
}
|
||||
pthread_mutex_unlock(&ncclDebugLock);
|
||||
}
|
||||
|
||||
NCCL_PARAM(SetThreadName, "SET_THREAD_NAME", 0);
|
||||
|
||||
void ncclSetThreadName(pthread_t thread, const char *fmt, ...) {
|
||||
// pthread_setname_np is nonstandard GNU extension
|
||||
// needs the following feature test macro
|
||||
#ifdef _GNU_SOURCE
|
||||
if (ncclParamSetThreadName() != 1) return;
|
||||
char threadName[NCCL_THREAD_NAMELEN];
|
||||
va_list vargs;
|
||||
va_start(vargs, fmt);
|
||||
vsnprintf(threadName, NCCL_THREAD_NAMELEN, fmt, vargs);
|
||||
va_end(vargs);
|
||||
pthread_setname_np(thread, threadName);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user