Skip to content

Commit 538d2de

Browse files
authored
Merge pull request #7566 from rhc54/topic/up2
Update PMIx and PRRTE
2 parents 5dcd1f4 + 556b3fc commit 538d2de

File tree

5 files changed

+77
-49
lines changed

5 files changed

+77
-49
lines changed

config/ompi_setup_prrte.m4

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#
2525

2626
AC_DEFUN([OMPI_SETUP_PRRTE],[
27-
OPAL_VAR_SCOPE_PUSH([opal_prrte_save_CPPFLAGS opal_prrte_save_CFLAGS opal_prrte_save_LDFLAGS opal_prrte_save_LIBS opal_prrte_args opal_prrte_save_enable_dlopen opal_prrte_save_enable_mca_dso opal_prrte_save_enable_mca_static])
27+
OPAL_VAR_SCOPE_PUSH([opal_prrte_save_CPPFLAGS opal_prrte_save_CFLAGS opal_prrte_save_LDFLAGS opal_prrte_save_LIBS opal_prrte_args opal_prrte_save_enable_dlopen opal_prrte_save_enable_mca_dso opal_prrte_save_enable_mca_static opal_prrte_extra_libs opal_prrte_extra_ltlibs opal_prrte_extra_ldflags])
2828

2929
opal_prrte_save_CFLAGS=$CFLAGS
3030
opal_prrte_save_CPPFLAGS=$CPPFLAGS
@@ -59,29 +59,29 @@ AC_DEFUN([OMPI_SETUP_PRRTE],[
5959
if test "$enable_internal_rte" != "no"; then
6060
AC_MSG_RESULT([yes])
6161
ompi_want_prrte=yes
62-
if test -z $with_libevent || test "$with_libevent" = "internal" || test "$with_libevent" = "yes"; then
63-
opal_prrte_libevent_arg="--with-libevent-header=$OMPI_TOP_SRCDIR/opal/mca/event/event.h"
64-
elif test "$with_libevent" = "external"; then
65-
opal_prrte_libevent_arg=""
66-
else
67-
opal_prrte_libevent_arg="--with-libevent=$with_libevent"
62+
opal_prrte_extra_libs=$OMPI_TOP_BUILDDIR/opal/libopen-pal.la
63+
opal_prrte_extra_ltlibs=$OMPI_TOP_BUILDDIR/opal/libopen-pal.la
64+
65+
if test "$opal_event_external_support" = "yes"; then
66+
opal_prrte_extra_libs="$opal_prrte_extra_libs $opal_event_external_LIBS"
67+
opal_prrte_extra_ltlibs="$opal_prrte_extra_ltlibs $opal_event_external_LIBS"
6868
fi
69+
# specifying --with-libevent-header causes prrte to ignore the with_libevent and with_libevent_libdir options
70+
opal_prrte_libevent_arg="--with-libevent-header=$OMPI_TOP_SRCDIR/opal/mca/event/event.h"
6971

70-
if test -z $with_hwloc || test "$with_hwloc" = "internal" || test "$with_hwloc" = "yes"; then
71-
opal_prrte_hwloc_arg="--with-hwloc-header=$OMPI_TOP_SRCDIR/opal/mca/hwloc/hwloc-internal.h"
72-
elif test "$with_hwloc" = "external"; then
73-
opal_prrte_hwloc_arg=""
74-
else
75-
opal_prrte_hwloc_arg="--with-hwloc=$with_hwloc"
72+
if test "$opal_hwloc_external_support" = "yes"; then
73+
opal_prrte_extra_libs="$opal_prrte_extra_libs $opal_hwloc_external_LIBS"
74+
opal_prrte_extra_ltlibs="$opal_prrte_extra_ltlibs $opal_hwloc_external_LIBS"
7675
fi
76+
# specifying --with-hwloc-header causes prrte to ignore the with_hwloc and with_hwloc_libdir options
77+
opal_prrte_hwloc_arg="--with-hwloc-header=$OMPI_TOP_SRCDIR/opal/mca/hwloc/hwloc-internal.h"
7778

78-
if test -z $with_pmix || test "$with_pmix" = "internal" || test "$with_pmix" = "yes"; then
79-
opal_prrte_pmix_arg="--with-pmix-header=$OMPI_TOP_SRCDIR/opal/mca/pmix/pmix-internal.h"
80-
elif test "$with_pmix" = "external"; then
81-
opal_prrte_pmix_arg=""
82-
else
83-
opal_prrte_pmix_arg="--with-pmix=$with_pmix"
79+
if test "$opal_external_pmix_happy" = "yes"; then
80+
opal_prrte_extra_libs="$opal_prrte_extra_libs $opal_pmix_external_LIBS"
81+
opal_prrte_extra_ltlibs="$opal_prrte_extra_ltlibs $opal_pmix_external_LIBS"
8482
fi
83+
# specifying --with-pmix-header causes prrte to ignore the with_pmix and with_pmix_libdir options
84+
opal_prrte_pmix_arg="--with-pmix-header=$OMPI_TOP_SRCDIR/opal/mca/pmix/pmix-internal.h"
8585

8686
if test -z $enable_prte_prefix_by_default || test "$enable_prte_prefix_by_default" = "yes" ||
8787
test "$enable_orterun_prefix_given" = "yes"; then
@@ -102,7 +102,7 @@ AC_DEFUN([OMPI_SETUP_PRRTE],[
102102
opal_prrte_args="$opal_prrte_args --with-platform=$with_prrte_platform"
103103
fi
104104
# add the extra libs
105-
opal_prrte_args="$opal_prrte_args --with-prrte-extra-lib=$OMPI_TOP_BUILDDIR/opal/libopen-pal.la --with-prrte-extra-ltlib=$OMPI_TOP_BUILDDIR/opal/libopen-pal.la"
105+
opal_prrte_args="$opal_prrte_args --with-prrte-extra-lib=\"$opal_prrte_extra_libs\" --with-prrte-extra-ltlib=\"$opal_prrte_extra_ltlibs\""
106106

107107
AC_MSG_CHECKING([final prrte configure args])
108108
AC_MSG_RESULT([$opal_prrte_args])

opal/mca/pmix/base/pmix_base_fns.c

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -110,48 +110,70 @@ int opal_pmix_convert_jobid(pmix_nspace_t nspace, opal_jobid_t jobid)
110110
/* zero out the nspace */
111111
PMIX_LOAD_NSPACE(nspace, NULL);
112112

113-
if (opal_process_info.nativelaunch) {
114-
opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
115-
return OPAL_SUCCESS;
116-
} else {
117-
/* cycle across our list of known jobids */
118-
OPAL_LIST_FOREACH(nptr, &localnspaces, opal_nptr_t) {
119-
if (jobid == nptr->jobid) {
120-
PMIX_LOAD_NSPACE(nspace, nptr->nspace);
121-
return OPAL_SUCCESS;
122-
}
113+
/* cycle across our list of known jobids */
114+
OPAL_LIST_FOREACH(nptr, &localnspaces, opal_nptr_t) {
115+
if (jobid == nptr->jobid) {
116+
PMIX_LOAD_NSPACE(nspace, nptr->nspace);
117+
return OPAL_SUCCESS;
123118
}
124119
}
120+
125121
return OPAL_ERR_NOT_FOUND;
126122
}
127123

128124
int opal_pmix_convert_nspace(opal_jobid_t *jobid, pmix_nspace_t nspace)
129125
{
130126
opal_nptr_t *nptr;
131127
opal_jobid_t jid;
128+
uint16_t jobfam;
129+
uint32_t hash32, localjob = 0;
130+
char *p = NULL;
132131

133132
/* set a default */
134133
*jobid = OPAL_JOBID_INVALID;
135134

136-
if (opal_process_info.nativelaunch) {
137-
return opal_convert_string_to_jobid(jobid, nspace);
138-
} else {
139-
/* cycle across our list of known jobids */
140-
OPAL_LIST_FOREACH(nptr, &localnspaces, opal_nptr_t) {
141-
if (PMIX_CHECK_NSPACE(nspace, nptr->nspace)) {
142-
*jobid = nptr->jobid;
143-
return OPAL_SUCCESS;
144-
}
135+
/* if the nspace is empty, there is nothing more to do */
136+
if (0 == strlen(nspace)) {
137+
return OPAL_SUCCESS;
138+
}
139+
if (NULL != strstr(nspace, "JOBID_WILDCARD")) {
140+
*jobid = OPAL_JOBID_WILDCARD;
141+
return OPAL_SUCCESS;
142+
}
143+
if (NULL != strstr(nspace, "JOBID_INVALID")) {
144+
*jobid = OPAL_JOBID_INVALID;
145+
return OPAL_SUCCESS;
146+
}
147+
148+
/* cycle across our list of known jobids */
149+
OPAL_LIST_FOREACH(nptr, &localnspaces, opal_nptr_t) {
150+
if (PMIX_CHECK_NSPACE(nspace, nptr->nspace)) {
151+
*jobid = nptr->jobid;
152+
return OPAL_SUCCESS;
145153
}
146-
/* if we get here, we don't know this nspace */
147-
OPAL_HASH_STR(nspace, jid);
148-
jid &= ~(0x8000);
149-
*jobid = jid;
150-
nptr = OBJ_NEW(opal_nptr_t);
151-
nptr->jobid = jid;
152-
PMIX_LOAD_NSPACE(nptr->nspace, nspace);
153-
opal_list_append(&localnspaces, &nptr->super);
154154
}
155+
/* if we get here, we don't know this nspace */
156+
/* find the "." at the end that indicates the child job */
157+
if (NULL != (p = strrchr(nspace, '.'))) {
158+
*p = '\0';
159+
}
160+
OPAL_HASH_STR(nspace, hash32);
161+
if (NULL != p) {
162+
*p = '.';
163+
++p;
164+
localjob = strtoul(p, NULL, 10);
165+
}
166+
167+
/* now compress to 16-bits */
168+
jobfam = (uint16_t)(((0x0000ffff & (0xffff0000 & hash32) >> 16)) ^ (0x0000ffff & hash32));
169+
jid = (0xffff0000 & ((uint32_t)jobfam << 16)) | (0x0000ffff & localjob);
170+
*jobid = jid;
171+
/* save this jobid/nspace pair */
172+
nptr = OBJ_NEW(opal_nptr_t);
173+
nptr->jobid = jid;
174+
PMIX_LOAD_NSPACE(nptr->nspace, nspace);
175+
opal_list_append(&localnspaces, &nptr->super);
176+
155177
return OPAL_SUCCESS;
156178
}
157179

opal/mca/pmix/pmix-internal.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,11 @@ OPAL_DECLSPEC int opal_pmix_convert_nspace(opal_jobid_t *jobid, pmix_nspace_t ns
599599
OPAL_DECLSPEC void opal_pmix_setup_nspace_tracker(void);
600600
OPAL_DECLSPEC void opal_pmix_finalize_nspace_tracker(void);
601601

602+
/* convert jobid to nspace */
602603
#define OPAL_PMIX_CONVERT_JOBID(n, j) \
603604
opal_pmix_convert_jobid((n), (j))
604605

606+
/* convert vpid to rank */
605607
#define OPAL_PMIX_CONVERT_VPID(r, v) \
606608
do { \
607609
if (OPAL_VPID_WILDCARD == (v)) { \
@@ -611,16 +613,19 @@ OPAL_DECLSPEC void opal_pmix_finalize_nspace_tracker(void);
611613
} \
612614
} while(0)
613615

616+
/* convert opal_process_name_t to pmix_proc_t */
614617
#define OPAL_PMIX_CONVERT_NAME(p, n) \
615618
do { \
616619
OPAL_PMIX_CONVERT_JOBID((p)->nspace, (n)->jobid); \
617620
OPAL_PMIX_CONVERT_VPID((p)->rank, (n)->vpid); \
618621
} while(0)
619622

620623

624+
/* convert nspace to jobid */
621625
#define OPAL_PMIX_CONVERT_NSPACE(r, j, n) \
622626
(r) = opal_pmix_convert_nspace((j), (n))
623627

628+
/* convert pmix rank to opal vpid */
624629
#define OPAL_PMIX_CONVERT_RANK(v, r) \
625630
do { \
626631
if (PMIX_RANK_WILDCARD == (r)) { \
@@ -632,6 +637,7 @@ OPAL_DECLSPEC void opal_pmix_finalize_nspace_tracker(void);
632637
} \
633638
} while(0)
634639

640+
/* convert pmix_proc_t to opal_process_name_t */
635641
#define OPAL_PMIX_CONVERT_PROCT(r, n, p) \
636642
do { \
637643
OPAL_PMIX_CONVERT_NSPACE((r), &(n)->jobid, (p)->nspace); \

0 commit comments

Comments
 (0)