Skip to content

Commit 0f65eed

Browse files
Add tuner config for MCCL (#282)
1 parent 23a5bc5 commit 0f65eed

4 files changed

Lines changed: 48 additions & 1 deletion

File tree

flagcx/adaptor/tuner/mccl_tuner.cc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "tuner/tuner_util.h"
2+
3+
#ifdef USE_METAX_ADAPTOR
4+
static EnvVar algo("MCCL_ALGO", {"ring", "tree"}, "ring");
5+
6+
static EnvVar proto("MCCL_PROTO", {"LL", "LL128", "Simple"}, "Simple");
7+
8+
static EnvVar minChannels("MCCL_MIN_NCHANNELS", {"2", "4", "8", "16", "32"},
9+
"2");
10+
11+
static EnvVar maxChannels("MCCL_MAX_NCHANNELS", {"8", "16", "32", "64"}, "32");
12+
13+
static EnvVar rwkBuffer("MCCL_DISABLE_CACHEABLE_BUFFER", {"0", "1"}, "0");
14+
15+
static EnvVar minP2PChannels("MCCL_MIN_P2P_NCHANNELS", {"1", "4", "8", "16"},
16+
"1");
17+
18+
static EnvVar maxP2PChannels("MCCL_MAX_P2P_NCHANNELS", {"16", "32", "64"},
19+
"64");
20+
21+
static EnvVar cacheFastWriteBack("MCCL_FAST_WRITE_BACK", {"-2", "1"}, "-2");
22+
23+
static EnvVar cacheEarlyWriteBack("MCCL_EARLY_WRITE_BACK",
24+
{"-2", "1", "4", "8", "15"}, "-2");
25+
26+
std::vector<EnvVar> mcclTunerVars = {algo,
27+
proto,
28+
minChannels,
29+
maxChannels,
30+
rwkBuffer,
31+
minP2PChannels,
32+
maxP2PChannels,
33+
cacheFastWriteBack,
34+
cacheEarlyWriteBack};
35+
#endif

flagcx/adaptor/tuner/nccl_tuner.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ static EnvVar minChannel("NCCL_MIN_NCHANNELS", {"16", "32"}, "16");
1212

1313
static EnvVar chunkSize("NCCL_P2P_NVL_CHUNKSIZE", {"1024", "2048"}, "1024");
1414

15-
std::vector<EnvVar> vars = {algo, proto, thread, minChannel, chunkSize};
15+
std::vector<EnvVar> ncclTunerVars = {algo, proto, thread, minChannel,
16+
chunkSize};
1617

1718
#endif

flagcx/adaptor/tuner/tuner.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "tuner/tuner_util.h"
2+
3+
#ifdef USE_NVIDIA_ADAPTOR
4+
std::vector<EnvVar> vars = ncclTunerVars;
5+
#elif USE_METAX_ADAPTOR
6+
std::vector<EnvVar> vars = mcclTunerVars;
7+
#else
8+
std::vector<EnvVar> vars = {};
9+
#endif

flagcx/adaptor/tuner/tuner_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ struct EnvVar {
2020
flagcxResult_t generateCandidate(std::vector<struct flagcxEnvConfig> &cfgList);
2121
static void safeStrCopy(char *dst, size_t dstSize, const std::string &src);
2222

23+
extern std::vector<EnvVar> ncclTunerVars;
24+
extern std::vector<EnvVar> mcclTunerVars;
2325
extern std::vector<EnvVar> vars;
2426

2527
#endif // end include guard

0 commit comments

Comments
 (0)