From a4b99485a91919abe8501aaff36292fe0c3a3752 Mon Sep 17 00:00:00 2001 From: "Kutovoi, Vadim" Date: Mon, 22 Dec 2025 10:54:33 +0000 Subject: [PATCH] gda/ro: validate and exit cleanly when forced GDA config is invalid (#354) * gda: validate and exit cleanly when forced GDA config is invalid * ro: validate and exit cleanly when forced RO config is invalid [ROCm/rocshmem commit: 80a710ac0a588510987adc7aa0fdd638546860eb] --- projects/rocshmem/src/rocshmem.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) {