Fortran bindings for OpenMPI not working in Kubuntu 7.04 and 7.10?

Bart Vandewoestyne Bart.Vandewoestyne at cs.kuleuven.be
Mon Nov 5 15:59:19 GMT 2007


Dear Ubuntu MOTU-team,
Dear Florian,

I'm not sure who is actually responsible for the openmpi-* 
packages in Kubuntu, so I decided to send this email to the 
addresses I have found in the package descriptions and I kindly 
ask you to forward this mail to whoever you think can help us.

We are trying to get the Fortran bindings for OpenMPI working. 
Our system is a Kubuntu 7.04 Feisty machine.  We are using the 
packaged versions of both OpenMPI and the gfortran compiler which 
have the following version numbers:

bartv at kortrijk:~$ dpkg --list | grep openmpi
ii  openmpi-bin                                1.1-2.3 
                      high performance message passing library
ii  openmpi-common                             1.1-2.3 
                      high performance message passing library
ii  openmpi-dev                                1.1-2.3 
                      high performance message passing library
ii  openmpi-libs0                              1.1-2.3 
                      high performance message passing library

bartv at kortrijk:~$ gfortran --version | head -1
GNU Fortran 95 (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)


To test if the mpif90 and mpirun commands are working, we used 
the following testprogram:

----------------> begin testprogram <---------------

program test_mpi

use mpi

implicit none

integer :: numprocs, rank, nb, ierr


print *, "Before MPI_Init"
call MPI_Init(ierr)

print *, "Before MPI_Comm_size"
call MPI_Comm_size(MPI_COMM_WORLD, numprocs, ierr)

print *, "Before MPI_Comm_rank"
call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)

print *,"I am process", rank, "out of ", numprocs

print *, "Before MPI_Finalize"
call MPI_Finalize(ierr)

end program test_mpi

------------------> end testprogram <--------------

If we compile this simply with mpif90, we get undefined references:

bartv at kortrijk:~/mpi_test$ mpif90 test_mpi.f90
/tmp/cc2xO6Dg.o: In function `MAIN__':
test_mpi.f90:(.text+0x9c): undefined reference to `mpi_init_'
test_mpi.f90:(.text+0x11e): undefined reference to `mpi_comm_size_'
test_mpi.f90:(.text+0x1a0): undefined reference to `mpi_comm_rank_'
test_mpi.f90:(.text+0x2d0): undefined reference to `mpi_finalize_'
collect2: ld returned 1 exit status

so we therefore add the -fsecond-underscore option which solves 
the problem:

bartv at kortrijk:~/mpi_test$ mpif90 -fsecond-underscore test_mpi.f90
bartv at kortrijk:~/mpi_test$

However, if we now try to run the binary, our testprogram 
silently exits somewhere in the MPI_Init subroutine without any 
error messages at all:

bartv at kortrijk:~/mpi_test$ mpirun -np 4 a.out
  Before MPI_Init
  Before MPI_Init
  Before MPI_Init
  Before MPI_Init
bartv at kortrijk:~/mpi_test$

and considering the print-statements in our test-program, this is 
not the output that one would expect.


I have also tried to compile this testprogram on a freshly 
installed Kubuntu 7.10 machine and there the problem is even worse:

mc303 at azw:~/test_mpi$ mpif90 test_mpi.f90
mc303 at azw:~/test_mpi$ ls -al a.out
ls: a.out: No such file or directory

The mpif90 command simply doesn't seem to do anything!  No binary 
output is generated and no error messages are shown to the user.


Can somebody from the crew take a look at this and hopefully 
provide us with a solution?


Thanks for helping us out,
Bart Vandewoestyne



More information about the Ubuntu-motu mailing list