Bart Vandewoestyne
2007-10-31 11:58:24 UTC
I am trying to compile a simple MPI testprogram on a Kubuntu 7.10
(Gutsy Gibbon) Linux machine. We are using the OpenMPI and gfortran
packages from our Kubuntu installation for both OpenMPI and gfortran:
***@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
***@kortrijk:~$ dpkg --list | grep gfortran
ii gfortran 4.1.2-1ubuntu1 The GNU Fortran 95 compiler
ii gfortran-4.1 4.1.2-0ubuntu4 The GNU Fortran 95 compiler
ii libgfortran1 4.1.2-0ubuntu4 Runtime library for GNU Fortran applications
ii libgfortran1-dev 4.1.2-0ubuntu4 GNU Fortran library development
The testprogram I'm using is the following:
program test_mpi
use mpi
implicit none
integer :: rank, nb, ierr
print *,"right before mpi_init"
call mpi_init( ierr )
print *, "right before mpi_comm_rank"
call mpi_comm_rank(MPI_COMM_WORLD, rank, ierr)
print *,"Hello, I'm processor ", rank
print *,"right before mpi_finalize"
call mpi_finalize(ierr)
end program test_mpi
I get undefined reference errors when I simply compile with mpif90 without
any additional flags:
***@kortrijk:~/mpi_test$ mpif90 test_mpi.f90
/tmp/ccNMqzGg.o: In function `MAIN__':
test_mpi.f90:(.text+0x9c): undefined reference to `mpi_init_'
test_mpi.f90:(.text+0x11e): undefined reference to `mpi_comm_rank_'
test_mpi.f90:(.text+0x210): undefined reference to `mpi_finalize_'
collect2: ld returned 1 exit status
So I therefore add the -fsecond-underscore flag and things seem to compile
fine:
***@kortrijk:~/mpi_test$ mpif90 test_mpi.f90 -fsecond-underscore
***@kortrijk:~/mpi_test$
Now, as I try to run this, the program silently exits somewhere in the
mpi_init subroutine and it doesn't seem to proceed beyond that routine:
***@kortrijk:~/mpi_test$ mpirun -np 4 a.out
right before mpi_init
right before mpi_init
right before mpi_init
right before mpi_init
***@kortrijk:~/mpi_test$
And this is where we are stuck :-( Why doesn't the program continue until
the end?
Does anybody see what I'm possibly doing wrong?
Regards,
Bart
(Gutsy Gibbon) Linux machine. We are using the OpenMPI and gfortran
packages from our Kubuntu installation for both OpenMPI and gfortran:
***@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
***@kortrijk:~$ dpkg --list | grep gfortran
ii gfortran 4.1.2-1ubuntu1 The GNU Fortran 95 compiler
ii gfortran-4.1 4.1.2-0ubuntu4 The GNU Fortran 95 compiler
ii libgfortran1 4.1.2-0ubuntu4 Runtime library for GNU Fortran applications
ii libgfortran1-dev 4.1.2-0ubuntu4 GNU Fortran library development
The testprogram I'm using is the following:
program test_mpi
use mpi
implicit none
integer :: rank, nb, ierr
print *,"right before mpi_init"
call mpi_init( ierr )
print *, "right before mpi_comm_rank"
call mpi_comm_rank(MPI_COMM_WORLD, rank, ierr)
print *,"Hello, I'm processor ", rank
print *,"right before mpi_finalize"
call mpi_finalize(ierr)
end program test_mpi
I get undefined reference errors when I simply compile with mpif90 without
any additional flags:
***@kortrijk:~/mpi_test$ mpif90 test_mpi.f90
/tmp/ccNMqzGg.o: In function `MAIN__':
test_mpi.f90:(.text+0x9c): undefined reference to `mpi_init_'
test_mpi.f90:(.text+0x11e): undefined reference to `mpi_comm_rank_'
test_mpi.f90:(.text+0x210): undefined reference to `mpi_finalize_'
collect2: ld returned 1 exit status
So I therefore add the -fsecond-underscore flag and things seem to compile
fine:
***@kortrijk:~/mpi_test$ mpif90 test_mpi.f90 -fsecond-underscore
***@kortrijk:~/mpi_test$
Now, as I try to run this, the program silently exits somewhere in the
mpi_init subroutine and it doesn't seem to proceed beyond that routine:
***@kortrijk:~/mpi_test$ mpirun -np 4 a.out
right before mpi_init
right before mpi_init
right before mpi_init
right before mpi_init
***@kortrijk:~/mpi_test$
And this is where we are stuck :-( Why doesn't the program continue until
the end?
Does anybody see what I'm possibly doing wrong?
Regards,
Bart
--
"Share what you know. Learn what you don't."
"Share what you know. Learn what you don't."