[mpich-discuss] About using g95 to compile MPICH2 problem

Jayesh Krishna jayesh at mcs.anl.gov
Mon Oct 1 09:19:38 CDT 2012


Hi,
 You seem to be using specific compiler options (like "-fno-second-underscore") when you are compiling your code. Did you specify the same options when building MPICH2 ?

Regards,
Jayesh

----- Original Message -----
From: "謝奇哲" <991546107 at stu.nkmu.edu.tw>
To: "Jayesh Krishna" <jayesh at mcs.anl.gov>, mpich-discuss at mcs.anl.gov
Sent: Monday, October 1, 2012 8:30:54 AM
Subject: About using g95 to compile MPICH2 problem

Dear MPICH2 users, 

I'm sorry if I'm asking too many times. 

My case will need using mpi_init, so I install the MPICH2-1.4.1p1 
I'm using WindosXP, Cygwin, and g95 to compile. 

And I Used the command 
User at 980622-05 /cygdrive/c/cygwin/mpich2-1.4.1p1 
$./configure F77=g95 FC=g95 --prefix=/MPICH2/ 2>&1 | tee c.txt 
User at 980622-05 /cygdrive/c/cygwin/mpich2-1.4.1p1 
$make 2>&1 | tee m.txt 
User at 980622-05 /cygdrive/c/cygwin/mpich2-1.4.1p1 
$make install 2>&1 | tee mi.txt 

I added right path in cygwin/etc/prfile 
MPI_BINDIR=/MPICH2/bin 
export MPI_BINDIR 
MPI_INCDIR=/MPICH2/include 
export MPI_INCDIR 
MPI_LIBDIR=/MPICH2/lib 
export MPI_LIBDIR 

Then, I try to run the examples hellw and cpi 
User at 980622-05 /cygdrive/c/cygwin/mpich2-1.4.1p1/examples 
$ make hellow 
CC hellow.c 
../bin/mpicc -o hellow hellow.o 

User at 980622-05 /cygdrive/c/cygwin/mpich2-1.4.1p1/examples 
$ mpirun -n 5 ./hellow 
Hello world from process 0 of 5 
Hello world from process 1 of 5 
Hello world from process 2 of 5 
Hello world from process 3 of 5 
Hello world from process 4 of 5 

User at 980622-05 /cygdrive/c/cygwin/mpich2-1.4.1p1/examples 
$ mpirun -n 5 ./cpi 
Process 0 of 5 is on 980622-05 
Process 1 of 5 is on 980622-05 
Process 2 of 5 is on 980622-05 
Process 3 of 5 is on 980622-05 
Process 4 of 5 is on 980622-05 
pi is approximately 3.1415926544231230, Error is 0.0000000008333298 
wall clock time = 0.000000 

I thought that I finish installing. 
And then, I compiled my program, set build.bash 
USE_MPI = on 
USE_MPIF90 = on 
I got some undefined reference about MPI (detail saved in make_sh_mpif90_on_0928.txt) 

cd /cygdrive/d/ROMS_for_Square_Harbor/trunk/Build; 
/MPICH2/bin/mpif90 -c -fno-second-underscore -O3 -ffast-math master.f90 
mpif90 -fno-second-underscore -O3 -ffast-math 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/master.o 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/ocean_control.o 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/ocean_coupler.o 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/propagator.o -o 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/oceanM.exe 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/libNLM.a 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/libANA.a 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/libICE.a 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/libUTIL.a 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/libMODS.a -L/usr/local/lib -lnetcdf 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/master.o:master.f90:(.text+0xe): undefined reference to `mpi_init_' 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/master.o:master.f90:(.text+0x34): undefined reference to `mpi_comm_rank_' 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/master.o:master.f90:(.text+0x5d): undefined reference to `mpi_finalize_' 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/ocean_control.o:ocean_control.f90:(.text+0x3e6): undefined reference to `mpi_comm_rank_' 
/cygdrive/d/ROMS_for_Square_Harbor/trunk/Build/ocean_control.o:ocean_control.f90:(.text+0x3fd): undefined reference to `mpi_comm_size_' 

Can anyone give me some advices to solved this problem? 

Best regards, 
Chi-Che Hsieh 


More information about the mpich-discuss mailing list