@@ -659,6 +659,54 @@ void orte_odls_base_spawn_proc(int fd, short sd, void *cbdata)
659
659
child -> rml_uri = NULL ;
660
660
}
661
661
662
+ /* setup the rest of the environment with the proc-specific items - these
663
+ * will be overwritten for each child
664
+ */
665
+ if (ORTE_SUCCESS != (rc = orte_schizo .setup_child (jobdat , child , app , & cd -> env ))) {
666
+ ORTE_ERROR_LOG (rc );
667
+ state = ORTE_PROC_STATE_FAILED_TO_LAUNCH ;
668
+ goto errorout ;
669
+ }
670
+
671
+ /* Search for the OMPI_exec_path and PATH settings in the environment. */
672
+ for (argvptr = app -> env ; * argvptr != NULL ; argvptr ++ ) {
673
+ if (0 == strncmp ("OMPI_exec_path=" , * argvptr , 15 )) {
674
+ mpiexec_pathenv = * argvptr + 15 ;
675
+ }
676
+ if (0 == strncmp ("PATH=" , * argvptr , 5 )) {
677
+ pathenv = * argvptr + 5 ;
678
+ }
679
+ }
680
+
681
+ /* If OMPI_exec_path is set (meaning --path was used), then create a
682
+ temporary environment to be used in the search for the executable.
683
+ The PATH setting in this temporary environment is a combination of
684
+ the OMPI_exec_path and PATH values. If OMPI_exec_path is not set,
685
+ then just use existing environment with PATH in it. */
686
+ if (NULL != mpiexec_pathenv ) {
687
+ argvptr = NULL ;
688
+ if (pathenv != NULL ) {
689
+ asprintf (& full_search , "%s:%s" , mpiexec_pathenv , pathenv );
690
+ } else {
691
+ asprintf (& full_search , "%s" , mpiexec_pathenv );
692
+ }
693
+ opal_setenv ("PATH" , full_search , true, & argvptr );
694
+ free (full_search );
695
+ } else {
696
+ argvptr = app -> env ;
697
+ }
698
+
699
+ rc = orte_util_check_context_app (app , argvptr );
700
+ /* do not ERROR_LOG - it will be reported elsewhere */
701
+ if (NULL != mpiexec_pathenv ) {
702
+ opal_argv_free (argvptr );
703
+ }
704
+ if (ORTE_SUCCESS != rc ) {
705
+ opal_output (0 , "%s:%d" , __FILE__ , __LINE__ );
706
+ state = ORTE_PROC_STATE_FAILED_TO_LAUNCH ;
707
+ goto errorout ;
708
+ }
709
+
662
710
/* did the user request we display output in xterms? */
663
711
if (NULL != orte_xterm && !ORTE_FLAG_TEST (jobdat , ORTE_JOB_FLAG_DEBUGGER_DAEMON )) {
664
712
opal_list_item_t * nmitem ;
@@ -719,53 +767,6 @@ void orte_odls_base_spawn_proc(int fd, short sd, void *cbdata)
719
767
cd -> argv = opal_argv_copy (app -> argv );
720
768
}
721
769
722
- /* setup the rest of the environment with the proc-specific items - these
723
- * will be overwritten for each child
724
- */
725
- if (ORTE_SUCCESS != (rc = orte_schizo .setup_child (jobdat , child , app , & cd -> env ))) {
726
- ORTE_ERROR_LOG (rc );
727
- state = ORTE_PROC_STATE_FAILED_TO_LAUNCH ;
728
- goto errorout ;
729
- }
730
-
731
- /* Search for the OMPI_exec_path and PATH settings in the environment. */
732
- for (argvptr = app -> env ; * argvptr != NULL ; argvptr ++ ) {
733
- if (0 == strncmp ("OMPI_exec_path=" , * argvptr , 15 )) {
734
- mpiexec_pathenv = * argvptr + 15 ;
735
- }
736
- if (0 == strncmp ("PATH=" , * argvptr , 5 )) {
737
- pathenv = * argvptr + 5 ;
738
- }
739
- }
740
-
741
- /* If OMPI_exec_path is set (meaning --path was used), then create a
742
- temporary environment to be used in the search for the executable.
743
- The PATH setting in this temporary environment is a combination of
744
- the OMPI_exec_path and PATH values. If OMPI_exec_path is not set,
745
- then just use existing environment with PATH in it. */
746
- if (NULL != mpiexec_pathenv ) {
747
- argvptr = NULL ;
748
- if (pathenv != NULL ) {
749
- asprintf (& full_search , "%s:%s" , mpiexec_pathenv , pathenv );
750
- } else {
751
- asprintf (& full_search , "%s" , mpiexec_pathenv );
752
- }
753
- opal_setenv ("PATH" , full_search , true, & argvptr );
754
- free (full_search );
755
- } else {
756
- argvptr = app -> env ;
757
- }
758
-
759
- rc = orte_util_check_context_app (app , argvptr );
760
- /* do not ERROR_LOG - it will be reported elsewhere */
761
- if (NULL != mpiexec_pathenv ) {
762
- opal_argv_free (argvptr );
763
- }
764
- if (ORTE_SUCCESS != rc ) {
765
- state = ORTE_PROC_STATE_FAILED_TO_LAUNCH ;
766
- goto errorout ;
767
- }
768
-
769
770
/* if we are indexing the argv by rank, do so now */
770
771
if (cd -> index_argv && !ORTE_FLAG_TEST (jobdat , ORTE_JOB_FLAG_DEBUGGER_DAEMON )) {
771
772
char * param ;
0 commit comments