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

Anthony Chan chan at mcs.anl.gov
Tue Oct 2 10:34:57 CDT 2012


Since you set both F77 and FC to the same compiler g95.
Whatever compiler behavior changing flag you set for F77
should be set for FC during configure as well, i.e. if
you set FFLAGS=-fno-second-underscore, you should set 
FCFLAGS=-fno-second-underscore.  If you do that, you don't
need to use -fno-second-underscore with mpif90 in compiling
your code.

However, I don't get why would want to change the default
name mangling behavior of the Fortran compiler.  Based on
the compiling output of your app, it appears your app is
pure Fortran90 code.  Would it be easier just not setting
-fno-second-underscore at all in compiling mpich2 and your
app ?

A.Chan

----- Original Message -----
> Dear Jayesh:
> I had trying to re-install MPICH2.
> And using the command
> ./configure F77=g95 FC=g95 FFLAGS=-fno-second-underscore
> --prefix=/MPICH2/ 2>&1 | tee c.txt
> 
> When I finished installing, I didn't find the mpif90 in bin file.
> What's problem with me?Can anyon give me some advices?
> 
> Best regards,
> Chi-Che Hsieh
> 
> 2012/10/2 Jayesh Krishna <jayesh at mcs.anl.gov>
> 
> > Dear Jayesh:
> > In my program compiler opions
> > FFLAGS := -fno-second-underscore
> >
> > But, when I configured MPICH2 just using F77=g95 FC=g95
> > --prefix=/MPICH2/
> > So, Should I set FFLAGS=-fno-second-underscore when I configure
> > MPICH2?
> >
> > Best regards,
> > Chi-Che Hsieh
> >
> >
> > 2012/10/1 Jayesh Krishna < jayesh at mcs.anl.gov >
> >
> >
> > 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
> >
> >
> 
> _______________________________________________
> mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss


More information about the mpich-discuss mailing list