mirror of
https://github.com/NVIDIA/nccl-tests.git
synced 2026-04-23 16:08:20 +08:00
Add extra reserved space during maxBytes calculation
Also, don't allow minBytes > maxBytes
This commit is contained in:
parent
e041d901e6
commit
598fc0060e
@ -16,6 +16,9 @@
|
||||
|
||||
#include "../verifiable/verifiable.h"
|
||||
|
||||
#define DIVUP(x, y) \
|
||||
(((x)+(y)-1)/(y))
|
||||
|
||||
int test_ncclVersion = 0; // init'd with ncclGetVersion()
|
||||
|
||||
#if NCCL_MAJOR >= 2
|
||||
@ -1025,10 +1028,14 @@ testResult_t run() {
|
||||
PRINT("%s", line);
|
||||
#endif
|
||||
|
||||
// Reserve 1GiB of memory for each 16GiB installed, but limit to a max of 4GiB
|
||||
const size_t GB = (1ULL << 30);
|
||||
size_t reserveMem = std::min(DIVUP(maxMem, 16*GB) * 1*GB, 4*GB);
|
||||
// We need sendbuff, recvbuff, expected (when datacheck enabled), plus 1G for the rest.
|
||||
size_t memMaxBytes = (maxMem - (1<<30)) / (datacheck ? 3 : 2);
|
||||
size_t memMaxBytes = (maxMem - reserveMem - 1*GB) / (datacheck ? 3 : 2);
|
||||
if (maxBytes > memMaxBytes) {
|
||||
maxBytes = memMaxBytes;
|
||||
if (minBytes > maxBytes) minBytes = maxBytes;
|
||||
if (proc == 0) printf("#\n# Reducing maxBytes to %ld due to memory limitation\n", maxBytes);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user