From cdae05b27728b1b5b25b3a4f294334df9fb5164d Mon Sep 17 00:00:00 2001 From: Sylvain Jeaugey Date: Tue, 4 Dec 2018 11:57:35 -0800 Subject: [PATCH] Improve INFO message when external network is not found. Fix #162 --- src/init.cu | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/init.cu b/src/init.cu index c9700a8..a8c8011 100644 --- a/src/init.cu +++ b/src/init.cu @@ -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; }