Repository navigation
feat(rccl-tests): enable socket encryption with NCCL_TESTS_TLS_PSK #13369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
f969853
e915fda
1513581
dcb5427
fb69a98
a8f2ef6
35ef704
7d9ae6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2539,6 +2539,37 @@ testResult_t run() { | |
| if (proc == 0) printf("#\n# Reducing maxBytes to %ld due to memory limitation\n", maxBytes); | ||
| } | ||
|
|
||
| const char* tlsPsk = getenv(NCCL_TESTS_TLS_PSK_ENV); | ||
| if (tlsPsk) { | ||
| #if NCCL_VERSION_CODE >= NCCL_VERSION(2,32,0) | ||
| typedef ncclResult_t (*ncclSetEncryption_t)(const ncclEncryptionConfig_t*); | ||
| #ifdef RCCL_TESTS_STATIC_RCCL | ||
| ncclSetEncryption_t setEncryption = ncclSetEncryption; | ||
| #else | ||
| // Looked up at run time: a direct reference would keep the binary from loading against | ||
| // an older librccl when it is linked with -z now or run with LD_BIND_NOW. | ||
| ncclSetEncryption_t setEncryption = (ncclSetEncryption_t) dlsym(RTLD_DEFAULT, "ncclSetEncryption"); | ||
|
i-kosarev marked this conversation as resolved.
Resolved
|
||
| if (setEncryption == NULL) { | ||
| fprintf(stderr, NCCL_TESTS_TLS_PSK_ENV " is set, but the RCCL library (%d) has no ncclSetEncryption; 2.32 or newer is required.\n", | ||
| test_ncclVersion); | ||
| return testInvalidUsage; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This return sits after
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's keep return: the condition is uniform across ranks, like the existing check above. Uneven key propagation hangs in bootstrap instead |
||
| } | ||
| #endif | ||
| ncclEncryptionConfig_t encryption = NCCL_ENCRYPTION_CONFIG_INITIALIZER; | ||
| encryption.mode = NCCL_ENCRYPTION_MODE_PSK; | ||
| encryption.psk = tlsPsk; | ||
| NCCLCHECK(setEncryption(&encryption)); | ||
| // RCCL keeps its own copy of the key. Dropping the variable keeps it out of RCCL's RAS | ||
| // environment report, which collects every NCCL_* entry, and out of child processes. | ||
| unsetenv(NCCL_TESTS_TLS_PSK_ENV); | ||
| if (proc == 0) printf("# Socket encryption: TLS (PSK)\n"); | ||
| #else | ||
| fprintf(stderr, NCCL_TESTS_TLS_PSK_ENV " is set, but rccl-tests was built against RCCL %d headers; 2.32 or newer is required.\n", | ||
| NCCL_VERSION_CODE); | ||
| return testInvalidUsage; | ||
| #endif | ||
| } | ||
|
|
||
| ncclUniqueId ncclId; | ||
| if (ncclProc == 0) { | ||
| NCCLCHECK(ncclGetUniqueId(&ncclId)); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.