Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

MPICH linking

jgoicoch
Beginner
825 Views
Hi, I am new in the linux world. I just wanted to link the MPICH fortran 90 examples that come with the implementation using the Intel Fortran 90 (ifort).

I tried the following:

ifort -L/usr/local/mpich-1.2.4/lib/ libfmpich.a pi3f90.f90

but the compiler does not find the mpi module, i.e. at the pi3f90.f90 there is a module call (use mpi).

I am invoking the fortran compiler from my personal folder, where the file pi3f90.f90 is located.

Thanks in advance for your further help, Javier
0 Kudos
3 Replies
ctierney42
Beginner
825 Views
You should use the mpich wrapper functions (mpif77,mpif90) when compiling and linking. It will take care of any include and library path issue.

If you don't want to do that, rewrite your command so that
you link -lfmpich, and then the library path you specified with
-L will be honored.

Use the wrapper scripts though, as there will be more libraries
that get linked in.

Craig
0 Kudos
jgoicoch
Beginner
825 Views
This is the error message:

jgoico@fp21 ~/mpiTest$ ifort -L/usr/local/mpich-1.2.4/lib libmpich.a pi3f90.f90

fortcom: Error: pi3f90.f90, line 23: Error in opening the Library module file. [MPI]
use mpi
.....^
compilation aborted for pi3f90.f90 (code 1)

I would like to compile and link the example, only using the intel compiler and switches.

I have also try to do the compilation with libfmpich.a but I get the same message.

Any suggestions. By the way I do not understand the previous mail.
Thanks in advance. Javier
0 Kudos
ctierney42
Beginner
825 Views
It is sometimes possible to link libraries from Fortran 77 compiled from one compiler to another. However, Fortran 90/95 modules
are a completely different think. You must compile mpich with
ifort if you plan to compile/link Fortran 90/95 applications.

From my experience (I could be wrong though) that you cannot
even share Intel Fortran 7.1 and Intel Fortran 8.0 modules.

What should you do? Get the sys admin to recompile mpich
using the intel compilers. If you are the admin, or the
admins aren't willing to do it, do it yourself. Check
the docs for complete details, but off the top of my head, this
should work.

1) Download the latest mpich (1.2.5.2) from ANL's website.
2) Assuming you are using bash and that ssh is used to
start the mpi programs:

#> export CC=icc
#> export FC=ifort
#> export F90=ifort
#> export CXX=icc
#> export RSHCOMMAND=ssh

3) Build and install. If you are root, you can install
it into a system directory like /usr/local/mpich-1.2.5.2.
If you are building as yourself (not root) put it in
your home directory (ex. /home/javier/mpich-1.2.5.2).
You do not need root permission to build or run mpich.

#> ./configure --prefix=/home/javier/mpich-1.2.5.2
#> make
#> make install

4) Add /home/javier/mpich-1.2.5.2/bin to your path and
start building applications.

Craig
0 Kudos
Reply