Community
cancel
Showing results for 
Search instead for 
Did you mean: 
balabi_b_
Beginner
228 Views

mpi calling external mpi program failed

I tried to use MPI to parallel running external command line program.
 
So I write `run.f90`
 
    program run
          use mpi
          implicit none
          integer::num_process,rank,ierr;
    
          call MPI_Init(ierr);
    
          call MPI_Comm_rank(MPI_COMM_WORLD, rank,ierr);
          call MPI_Comm_size(MPI_COMM_WORLD, num_process,ierr);
    
          call execute_command_line('./a.out')

          call MPI_Finalize(ierr);
          
    end program 

 

 
I compile it using intel compiler like
 
   
 mpiifort run.f90 -o run.out
 
Now if `./a.out` is normal non-MPI program like
 
    
program test
    implicit none
    print*,'hello'
    end
then 
 
    mpiexec.hydra -n 4 ./run.out
 
works fine.
 
However, if `./a.out` is also a MPI program like
 
    program mpi_test
              use mpi
              implicit none
              integer::num_process,rank,ierr;
        
              call MPI_Init(ierr);
        
              call MPI_Comm_rank(MPI_COMM_WORLD, rank,ierr);
              call MPI_Comm_size(MPI_COMM_WORLD, num_process,ierr);
        
              print*,rank
    
              call MPI_Finalize(ierr);
              
        end program 

Then, I got error after running "mpiexec.hydra -n 4 ./run.out"

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 19519 RUNNING AT i02n18
=   EXIT CODE: 13
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
 
===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 19522 RUNNING AT i02n18
=   EXIT CODE: 13
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
   Intel(R) MPI Library troubleshooting guide:
What is wrong?
0 Kudos
0 Replies
Reply