1
+ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
1
2
/*
2
3
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
3
4
* All rights reserved.
7
8
* reserved.
8
9
* Copyright (c) 2014-2018 Cisco Systems, Inc. All rights reserved
9
10
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
11
+ * Copyright (c) 2018 Triad National Security, LLC. All rights
12
+ * reserved.
10
13
* $COPYRIGHT$
11
14
*/
12
15
#include "ompi_config.h"
@@ -500,7 +503,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
500
503
opal_proc_t * myproc ;
501
504
int u32 , * u32ptr ;
502
505
uint16_t u16 , * u16ptr ;
503
- char * * peers = NULL , * mycpuset ;
506
+ char * * peers = NULL ;
504
507
char * envar , * ev1 , * ev2 ;
505
508
opal_value_t * kv ;
506
509
char * val ;
@@ -684,9 +687,9 @@ int ompi_rte_init(int *pargc, char ***pargv)
684
687
OPAL_MODEX_RECV_VALUE_OPTIONAL (ret , OPAL_PMIX_LOCALITY_STRING ,
685
688
& pmix_process_info .my_name , & val , OPAL_STRING );
686
689
if (OPAL_SUCCESS == ret && NULL != val ) {
687
- mycpuset = val ;
690
+ pmix_process_info . cpuset = val ;
688
691
} else {
689
- mycpuset = NULL ;
692
+ pmix_process_info . cpuset = NULL ;
690
693
}
691
694
pname .jobid = pmix_process_info .my_name .jobid ;
692
695
for (i = 0 ; NULL != peers [i ]; i ++ ) {
@@ -699,7 +702,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
699
702
OPAL_MODEX_RECV_VALUE_OPTIONAL (ret , OPAL_PMIX_LOCALITY_STRING ,
700
703
& pname , & val , OPAL_STRING );
701
704
if (OPAL_SUCCESS == ret && NULL != val ) {
702
- u16 = opal_hwloc_compute_relative_locality (mycpuset , val );
705
+ u16 = opal_hwloc_compute_relative_locality (pmix_process_info . cpuset , val );
703
706
free (val );
704
707
} else {
705
708
/* all we can say is that it shares our node */
@@ -718,24 +721,31 @@ int ompi_rte_init(int *pargc, char ***pargv)
718
721
if (OPAL_SUCCESS != ret ) {
719
722
error = "local store of locality" ;
720
723
opal_argv_free (peers );
721
- if (NULL != mycpuset ) {
722
- free (mycpuset );
724
+ if (NULL != pmix_process_info . cpuset ) {
725
+ free (pmix_process_info . cpuset );
723
726
}
724
727
goto error ;
725
728
}
726
729
OBJ_RELEASE (kv );
727
730
}
728
731
opal_argv_free (peers );
729
- if (NULL != mycpuset ) {
730
- free (mycpuset );
731
- }
732
732
}
733
733
734
734
/* poor attempt to detect we are bound */
735
735
if (NULL != getenv ("SLURM_CPU_BIND_TYPE" )) {
736
736
pmix_proc_is_bound = true;
737
737
}
738
738
739
+ /* set the remaining opal_process_info fields. Note that
740
+ * the OPAL layer will have initialized these to NULL, and
741
+ * anyone between us would not have strdup'd the string, so
742
+ * we cannot free it here */
743
+ opal_process_info .job_session_dir = pmix_process_info .job_session_dir ;
744
+ opal_process_info .proc_session_dir = pmix_process_info .proc_session_dir ;
745
+ opal_process_info .num_local_peers = (int32_t )pmix_process_info .num_local_peers ;
746
+ opal_process_info .my_local_rank = (int32_t )pmix_process_info .my_local_rank ;
747
+ opal_process_info .cpuset = pmix_process_info .cpuset ;
748
+
739
749
/* push our hostname so others can find us, if they need to - the
740
750
* native PMIx component will ignore this request as the hostname
741
751
* is provided by the system */
@@ -807,6 +817,10 @@ int ompi_rte_finalize(void)
807
817
false, check_file );
808
818
free (pmix_process_info .job_session_dir );
809
819
}
820
+
821
+ free (pmix_process_info .cpuset );
822
+ pmix_process_info .cpuset = NULL ;
823
+
810
824
return OMPI_SUCCESS ;
811
825
}
812
826
0 commit comments