diff --git a/projects/rocshmem/src/rocshmem.cpp b/projects/rocshmem/src/rocshmem.cpp index 9353f70136..fb22aee7fb 100644 --- a/projects/rocshmem/src/rocshmem.cpp +++ b/projects/rocshmem/src/rocshmem.cpp @@ -93,9 +93,21 @@ static BackendType select_backend_type() { if (!envstr.empty()) { DPRINTF("Found environment variable ROCSHMEM_BACKEND, value is %s\n", envstr.c_str()); if (envstr.find("gda") != std::string::npos) { + if (GDABackend::backend_can_run() != ROCSHMEM_SUCCESS) { + fprintf(stderr, "Error: ROCSHMEM_BACKEND=gda requested but GDA backend cannot run.\n" + "No active RDMA interface found for the requested provider.\n" + "Check that the correct NIC hardware is present and the link is active.\n"); + exit(1); + } return BackendType::GDA_BACKEND; } if (envstr.find("ro") != std::string::npos) { + if (ROBackend::backend_can_run() != ROCSHMEM_SUCCESS) { + fprintf(stderr, "Error: ROCSHMEM_BACKEND=ro requested but RO backend cannot run.\n" + "MPI library could not be loaded.\n" + "Check that MPI is properly installed and accessible.\n"); + exit(1); + } return BackendType::RO_BACKEND; } if (envstr.find("ipc") != std::string::npos) {