920dbe5b35
Optimization for Tree allreduce on A100. Improve aggregation performance. Use shared buffers for inter-node send/recv. Add NVTX profiling hooks. Accelerate alltoall connections by merging communication for all channels. Add support for one hop communication through NVLink, for faster send/recv communication on cubemesh topologies like DGX-1. Improve alltoall scheduling to better balance intra/inter node communication. Increase send/recv parallelism by 8x, each warp sending or receiving to a different peer. Net: move to v4. Net: make flush operation asynchronous to accelerate alltoall. Net: define maximum number of requests. Fix hang when using LL128 protocol after 2^31 steps. Fix #379 : topology injection failing when using less GPUs than described in the XML. Fix #394 : protocol mismatch causing hangs or crashes when using one GPU per node.
62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
/*************************************************************************
|
|
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* See LICENSE.txt for license information
|
|
************************************************************************/
|
|
|
|
#ifndef NCCL_CPUSET_H_
|
|
#define NCCL_CPUSET_H_
|
|
|
|
// Convert local_cpus, e.g. 0003ff,f0003fff to cpu_set_t
|
|
|
|
static int hexToInt(char c) {
|
|
int v = c - '0';
|
|
if (v < 0) return -1;
|
|
if (v > 9) v = 10 + c - 'a';
|
|
if ((v < 0) || (v > 15)) return -1;
|
|
return v;
|
|
}
|
|
|
|
#define CPU_SET_N_U32 (sizeof(cpu_set_t)/sizeof(uint32_t))
|
|
|
|
static ncclResult_t ncclStrToCpuset(const char* str, cpu_set_t* mask) {
|
|
uint32_t cpumasks[CPU_SET_N_U32];
|
|
int m = CPU_SET_N_U32-1;
|
|
cpumasks[m] = 0;
|
|
for (int o=0; o<strlen(str); o++) {
|
|
char c = str[o];
|
|
if (c == ',') {
|
|
m--;
|
|
cpumasks[m] = 0;
|
|
} else {
|
|
int v = hexToInt(c);
|
|
if (v == -1) break;
|
|
cpumasks[m] <<= 4;
|
|
cpumasks[m] += v;
|
|
}
|
|
}
|
|
// Copy cpumasks to mask
|
|
for (int a=0; m<CPU_SET_N_U32; a++,m++) {
|
|
memcpy(((uint32_t*)mask)+a, cpumasks+m, sizeof(uint32_t));
|
|
}
|
|
return ncclSuccess;
|
|
}
|
|
|
|
static ncclResult_t ncclCpusetToStr(cpu_set_t* mask, char* str) {
|
|
int c = 0;
|
|
uint8_t* m8 = (uint8_t*)mask;
|
|
for (int o=sizeof(cpu_set_t)-1; o>=0; o--) {
|
|
if (c == 0 && m8[o] == 0) continue;
|
|
sprintf(str+c, "%02x", m8[o]);
|
|
c+=2;
|
|
if (o && o%4 == 0) {
|
|
sprintf(str+c, ",");
|
|
c++;
|
|
}
|
|
}
|
|
str[c] = '\0';
|
|
return ncclSuccess;
|
|
}
|
|
|
|
#endif
|