Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Regarding Fortran 90 subroutines with MPI
From: Eugene Loh (Eugene.Loh_at_[hidden])
Date: 2009-12-31 11:17:22


It would help if you would include the error messages you encounter.

You need to call MPI_Init(ierr) before you can call (just about) any
other MPI call. E.g., add "call MPI_Init(ierr)" as the first executable
statement of your "program prog".

The error I get with your program is

*** An error occurred in MPI_Comm_f2c
*** before MPI was initialized
*** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)

I suppose that message could be clearer.

If I add the MPI_Init call, things work fine.

Arunkumar C R wrote:

> I have encountered some run time errors in the general purpose program
> given below. Could you please assist me in correcting this.
> The MPI code is written in Fortran 90. The concept of subroutine is
> used because I want to write program for another scientific problem.
>
> module data
> use mpi
> implicit none
> integer::np, ierr, irank
> end module
>
> program prog
> use data
> implicit none
>
> integer::trial, ntrials

insert "call mpi_init(ierr)" here

> ntrials=10
>
> do trial=1, ntrials
> call mpi_comm_rank(mpi_comm_world, irank, ierr)
> call mpi_comm_size(mpi_comm_world, np, ierr)
> write(1, *) 'trial no=', trial
> write(1, *) 'irank np'
> call
> process
> !subroutine call
> end do
> print*,'Program completed!'
> call mpi_finalize(ierr)
> end
>
> subroutine
> process
> !subroutine
> use data
> implicit none
>
> if(irank.eq.0) then
> write(10, *) irank, np
> end if
> end subroutine process
>
> Could you please run the program and let e know the error?