Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] bug in mpif90? OMPI_FC envvar does not work with 'use mpi'
From: Dominik Goeddeke (dominik.goeddeke_at_[hidden])
Date: 2013-03-12 17:31:48


Dear OMPI folks,

according to this FAQ entry

http://www.open-mpi.org/faq/?category=mpi-apps#override-wrappers-after-v1.0

one way to use the mpif90 compiler wrapper with another compiler than
Open-MPI was built with is to set the envvar OMPI_FC to the other compiler.

Using this simple toy code

> program test
> implicit none
> include 'mpif.h'
> integer :: ierr
> call MPI_Init(ierr)
> print *, "Hello"
> call MPI_Finalize(ierr)
> end program test

I indeed see the expected (and documented) behaviour:

> bash$ export OMPI_FC=ifort
> bash$ mpif90 test.f90
> bash$ mpirun -np 3 ./a.out

Now, If I replace these two lines in the reproducer

> implicit none
> include 'mpif.h'

with these two lines (which is actually the MPI-2 way of doing things,
as Jeff himself praises in this blog entry:
http://blogs.cisco.com/performance/a-bucket-full-of-new-mpi-fortran-features)

> use mpi
> implicit none

I get this as the output of mpif90:

> test.f90(7): error #7013: This module file was not generated by any
> release of this compiler. [MPI]
> use mpi
> ----^
> compilation aborted for test.f90 (code 1)

There seems to be no language on this particular problem in the FAQs, so
I assume this is either a documentation bug or an actual bug in the
compiler wrappers. The approach is clearly marked as "not recommended",
but actually, this problem can be quite a showstopper because on
laptops, people (like me) are often too lazy to compile Open-MPI (and
consequently, valgrind and friends) multiple times, especially since the
FAQ says that this should work :)

I am using the system gcc of ubuntu 12.04 (4.6.3-1ubuntu5) and OMPI
1.6.3. Of course everything works if I use a properly installed machine
that provides OpenMPI-builds for different compilers via modules, and
also the oldish "include 'mpif.h'" approach is a sufficient workaround.

Thanks for any clarification, hope this reproducer helps,

Cheers,

Dominik

-- 
Jun.-Prof. Dr. Dominik Göddeke
Hardware-orientierte Numerik für große Systeme
Institut für Angewandte Mathematik (LS III)
Fakultät für Mathematik, Technische Universität Dortmund
http://www.mathematik.tu-dortmund.de/~goeddeke
Tel. +49-(0)231-755-7218  Fax +49-(0)231-755-5933