Problem with OpenMPI

Marco Atzeri marco.atzeri@gmail.com
Thu Oct 1 19:29:48 GMT 2020


On 01.10.2020 16:47, Rudnei Dias da Cunha via Cygwin wrote:
> Hi,
> I have installed all the relevant OpenMPI packages to develop programs in
> Fortran but found a problem when compiling programs in Fortran 90 with the
> clause
> 
> use mpi
> 
> as mpifort then complains:
> 
> $ mpifort hello_usempi.f90
> hello_usempi.f90:13:9:
> 
>     13 |     use mpi
>        |         1
> Fatal Error: Cannot open module file ‘mpi.mod’ for reading at (1): No such
> file or directory
> 
> The workaround was to use
> 
> mpifort -J/usr/lib
> 
> as /usr/lib is the directory where mpi.mod resides after the installation
> of the OpenMPI packages.
> 
> Has anyone found this before? Shouldn't the flag -J/usr/lib be issued as
> part of the string issued by mpifort?
> 
> Regards
> Rudnei

there are not so many user of mpifort
but I do not see the problem building the examples:


$ make
mpicc -g  hello_c.c  -o hello_c
mpicc -g  ring_c.c  -o ring_c
mpicc -g  connectivity_c.c  -o connectivity_c
make[1]: Entering directory '/pub/devel/openmpi/examples64'
make[2]: Entering directory '/pub/devel/openmpi/examples64'
mpifort -g  hello_mpifh.f  -o hello_mpifh
mpifort -g  ring_mpifh.f  -o ring_mpifh
make[2]: Leaving directory '/pub/devel/openmpi/examples64'
make[2]: Entering directory '/pub/devel/openmpi/examples64'
mpifort -g  hello_usempi.f90  -o hello_usempi
mpifort -g  ring_usempi.f90  -o ring_usempi
make[2]: Leaving directory '/pub/devel/openmpi/examples64'
make[2]: Entering directory '/pub/devel/openmpi/examples64'
mpifort -g  hello_usempif08.f90  -o hello_usempif08
mpifort -g  ring_usempif08.f90  -o ring_usempif08
make[2]: Leaving directory '/pub/devel/openmpi/examples64'
make[1]: Leaving directory '/pub/devel/openmpi/examples64'


$ cat hello_usempi.f90
!
! Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
!                         University Research and Technology
!                         Corporation.  All rights reserved.
! Copyright (c) 2004-2005 The Regents of the University of California.
!                         All rights reserved.
! Copyright (c) 2006-2015 Cisco Systems, Inc.  All rights reserved.
! $COPYRIGHT$
!
! Sample MPI "hello world" application using the Fortran mpi module
! bindings.
!
program main
     use mpi
     implicit none
     integer :: ierr, rank, size, len
     character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: version

     call MPI_INIT(ierr)
     call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
     call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr)
     call MPI_GET_LIBRARY_VERSION(version, len, ierr)

     write(*, '("Hello, world, I am ", i2, " of ", i2, ": ", a)') &
           rank, size, version

     call MPI_FINALIZE(ierr)
end





More information about the Cygwin mailing list