Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the runtime version of PMIx #2

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/runtime/prte_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif

#include "src/util/error.h"
#include "src/util/error_strings.h"
Expand Down Expand Up @@ -127,16 +130,53 @@ static bool check_exist(char *path)
return false;
}

static void print_error(unsigned major,
unsigned minor,
unsigned release)
{
fprintf(stderr, "************************************************\n");
fprintf(stderr, "We have detected that the runtime version\n");
fprintf(stderr, "of the PMIx library we were given is binary\n");
fprintf(stderr, "incompatible with the version we were built against:\n\n");
fprintf(stderr, " Runtime: 0x%x%02x%02x\n", major, minor, release);
fprintf(stderr, " Build: 0x%0x\n\n", PMIX_NUMERIC_VERSION);
fprintf(stderr, "Please update your LD_LIBRARY_PATH to point\n");
fprintf(stderr, "us to the same PMIx version used to build PRRTE.\n");
fprintf(stderr, "************************************************\n");
}

int prte_init_minimum(void)
{
int ret;
char *path = NULL;
const char *rvers;
char token[100];
unsigned int major, minor, release;

if (min_initialized) {
return PRTE_SUCCESS;
}
min_initialized = true;

/* check to see if the version of PMIx we were given in the
* library path matches the version we were built against.
* Because we are using PMIx internals, we cannot support
* cross version operations from inside of PRRTE.
*/
rvers = PMIx_Get_version();
ret = sscanf(rvers, "%s %u.%u.%u", token, &major, &minor, &release);

/* check the version triplet - we know that version
* 5 and above are not runtime compatible with version
* 4 and below. Since PRRTE has a minimum PMIx requirement
* in the v4.x series, we only need to check v4 vs 5
* and above */
if ((PMIX_VERSION_MAJOR > 4 && 4 == major) ||
(PMIX_VERSION_MAJOR == 4 && 5 <= major)) {
print_error(major, minor, release);
return PRTE_ERR_SILENT;
}

/* carry across the toolname */
pmix_tool_basename = prte_tool_basename;

Expand Down
Loading