Improve INFO message when external network is not found.

Fix #162
This commit is contained in:
Sylvain Jeaugey 2018-12-04 11:57:35 -08:00
parent 5fe2618c0e
commit cdae05b277

View File

@ -86,7 +86,14 @@ ncclResult_t initNet(ncclNet_t* net) {
ncclResult_t initNetPlugin(ncclNet_t** net) {
void* netPluginLib = dlopen("libnccl-net.so", RTLD_NOW | RTLD_LOCAL);
if (netPluginLib == NULL) {
INFO(NCCL_INIT, "Unable to load libnccl-net.so : %s", dlerror());
// dlopen does not guarantee to set errno, but dlerror only gives us a
// string, so checking errno doesn't hurt to try to provide a better
// error message
if (errno == ENOENT) {
INFO(NCCL_INIT, "No network plugin found.");
} else {
INFO(NCCL_INIT, "Unable to load libnccl-net.so : %s", dlerror());
}
return ncclSuccess;
}
ncclNet_t* extNet = (ncclNet_t*) dlsym(netPluginLib, STR(NCCL_PLUGIN_SYMBOL));
@ -109,7 +116,7 @@ ncclResult_t initNet() {
NCCLCHECK(initNetPlugin(&ncclNet));
if (ncclNet != NULL) {
INFO(NCCL_INIT, "Using external Network %s", ncclNetName());
INFO(NCCL_INIT, "Using network plugin %s", ncclNetName());
return ncclSuccess;
}
if (initNet(&ncclNetIb) == ncclSuccess) {
@ -117,7 +124,7 @@ ncclResult_t initNet() {
} else {
ncclNet = &ncclNetSocket;
}
INFO(NCCL_INIT,"Using internal Network %s", ncclNetName());
INFO(NCCL_INIT,"Using network %s", ncclNetName());
return ncclSuccess;
}