diff --git a/ompi/mca/common/cuda/common_cuda.c b/ompi/mca/common/cuda/common_cuda.c index 6e8dfdefb1..0535b37bda 100644 --- a/ompi/mca/common/cuda/common_cuda.c +++ b/ompi/mca/common/cuda/common_cuda.c @@ -71,18 +71,33 @@ void mca_common_cuda_init(void) mca_common_cuda_warning = OPAL_INT_TO_BOOL(value); /* Check to see if this process is running in a CUDA context. If - * so, all is good. If not, then disable CUDA support. */ + * so, all is good. If not, then disable registration of memory. */ res = cuCtxGetCurrent(&cuContext); if (CUDA_SUCCESS != res) { if (mca_common_cuda_warning) { - orte_show_help("help-mpi-common-cuda.txt", "cuCtxGetCurrent failed", - true, res); + /* Check for the not initialized error since we can make suggestions to + * user for this error. */ + if (CUDA_ERROR_NOT_INITIALIZED == res) { + orte_show_help("help-mpi-common-cuda.txt", "cuCtxGetCurrent failed not initialized", + true); + } else { + orte_show_help("help-mpi-common-cuda.txt", "cuCtxGetCurrent failed", + true, res); + } + } + mca_common_cuda_enabled = false; + mca_common_cuda_register_memory = false; + } else if ((CUDA_SUCCESS == res) && (NULL == cuContext)) { + if (mca_common_cuda_warning) { + orte_show_help("help-mpi-common-cuda.txt", "cuCtxGetCurrent returned NULL", + true); } mca_common_cuda_enabled = false; mca_common_cuda_register_memory = false; - initialized = true; - return; } else { + /* All is good. mca_common_cuda_register_memory will retain its original + * value. Normally, that is 1, but the user can override it to disable + * registration of the internal buffers. */ mca_common_cuda_enabled = true; opal_output_verbose(20, mca_common_cuda_output, "CUDA: cuCtxGetCurrent succeeded"); diff --git a/ompi/mca/common/cuda/help-mpi-common-cuda.txt b/ompi/mca/common/cuda/help-mpi-common-cuda.txt index 3fcde6a581..399dec77cc 100644 --- a/ompi/mca/common/cuda/help-mpi-common-cuda.txt +++ b/ompi/mca/common/cuda/help-mpi-common-cuda.txt @@ -7,11 +7,32 @@ # # $HEADER$ # +[cuCtxGetCurrent failed not initialized] +WARNING: The call to cuCtxGetCurrent() failed while attempting to register +internal memory with the CUDA environment. The program will continue to run, +but the performance of GPU memory transfers may be reduced. This failure +indicates that the CUDA environment is not yet initialized. To eliminate +this warning, ensure that CUDA is initialized prior to calling MPI_Init. + +NOTE: You can turn off this warning by setting the MCA parameter + mpi_common_cuda_warning to 0. +# [cuCtxGetCurrent failed] -WARNING: The call to cuCtxGetCurrent() failed while initializing the -CUDA support. Support for CUDA registered memory is disabled. +WARNING: The call to cuCtxGetCurrent() failed while attempting to register +internal memory with the CUDA environment. The program will continue to run, +but the performance of GPU memory transfers may be reduced. cuCtxGetCurrent return value: %d +NOTE: You can turn off this warning by setting the MCA parameter + mpi_common_cuda_warning to 0. +# +[cuCtxGetCurrent returned NULL] +WARNING: The call to cuCtxGetCurrent() failed while attempting to register +internal memory with the CUDA environment. The program will continue to run, +but the performance of GPU memory transfers may be reduced. This failure +indicates that there is no CUDA context yet. To eliminate this warning, +ensure that there is a CUDA context prior to calling MPI_Init. + NOTE: You can turn off this warning by setting the MCA parameter mpi_common_cuda_warning to 0. #