Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

mpif90 problem

mohseng
Beginner
2,792 Views
I keep getting the following message when I try to compile my code by mpif90:
/usr/local/mpich/bin/mpif90: line 332: eval: -c: invalid option
eval: usage: eval [arg ...]

I have included in my fortran code the lines:

include 'mpif.h'
include 'ifortvars.sh'

but it makes no difference. Can someone help me out please?
Thanks,
Mohsen

0 Kudos
7 Replies
Steven_L_Intel1
Employee
2,792 Views
This is a problem in the mpif90 script, it's not a compiler message.
0 Kudos
TimP
Honored Contributor III
2,792 Views
The ifortvars.sh script is not intended to be included in your program. You should source it as a shell command, to get the PATH and LD_LIBRARY_PATH set up, before running mpif90. You are likely also to need /usr/local/mpich/bin in the PATH environment variable.
0 Kudos
mohseng
Beginner
2,792 Views
MyPATH and LD_LIBRARY_PATH are setup and ifort works. Also I sourced the *.sh file and checked /usr/local/mpich/bin is already in my PATH. Still same message. I guess steve is right and there's something wrong with the mpif90 scripts. But I can't find it.
Any ideas please?
0 Kudos
Steven_L_Intel1
Employee
2,792 Views
Well, Tim is correct that the include of ifortvars.sh is wrong, but you're not getting that far. The mpif90 script is not even running the compiler. It looks as if there's an eval command on line 332 of the mpif90 script with a syntax error. Either that, or it assumes some version of Linux different from the one you are running. (Linux: A maze of twisty little passages, all different)
0 Kudos
mohseng
Beginner
2,792 Views
I set the environment variable
export MPICH_F90=ifort
I guess now it compiles but it makes a *.o file which needs to be linked, as I suppose. The attempt to link mpif90 -o mtest mtest.o or mpif90 -o mtest.f90 mtest.o returns the following message:
/usr/local/mpich/bin/mpif90: line 396: eval: -L: invalid option
eval: usage: eval [arg ...]
I am trying to understand what other env variables I should set.(MPICH_F90LINKER, etc.)

I have attached the mpif90 file. it's not a zipped file.
0 Kudos
mohseng
Beginner
2,792 Views
Well I did the same thing for MPICH_F90LINKER
export MPICH_F90LINKER=ifort
and now I get this message:
$mpif90 -echo mtest.f90
+ '[' 0 = 1 ']'
+ allargs= mtest.f90
+ '[' -s mtest.f90 ']'
+ compileargs= mtest.f90
+ linkargs= mtest.f90
+ '[' 0 -lt 2 ']'
+ moduledir=/usr/local/mpich/include/f90choice
+ modulelib=mpichf90
+ '[' -n '' ']'
+ '[' -n '' ']'
+ added_link=0
+ '[' -z '' ']'
+ '[' '!' -r mpif.h ']'
+ status=0
+ '[' 0 = 1 -o 0 = 1 ']'
+ '[' 1 = 1 -o 0 = 1 ']'
+ '[' -z '' ']'
+ LDFLAGS=
+ '[' mpich = mpich ']'
+ mpilibs=-lmpich
+ '[' -n '' -o '!' -s /usr/local/mpich/lib/libpmpich.a ']'
+ '[' yes = yes -a '' '!=' yes ']'
+ proflib=
+ '[' -n '' ']'
+ '[' ignore '!=' ignore -a no = yes -a -s /usr/local/mpich/lib/libmpichfarg.a ']'
+ eval ifort -L/usr/local/mpich/lib mtest.f90 -lmpich
++ ifort -L/usr/local/mpich/lib mtest.f90 -lmpich
fortcom: Severe: No such file or directory
... file is 'mtest.f90'
compilation aborted for mtest.f90 (code 1)
+ status=1
+ '[' 0 = 1 ']'
+ exit 1
I have done the test given in the followingquotation and I think I need to recompile the mpich libraries but I don't know how.
"
you may be having problems with GNU g77's *INSANE* practice of appending
double underscore suffixes to symbols instead of singles underscores. To
confirm this, do this:

$ nm /usr/local/MPICH/lib/libmpich.a | grep mpi_init

You *should* see something like

0000000000000000 T mpi_init_

However, you may see:

0000000000000000 T mpi_init__

If so, you'll need to recompile your MPICH library using the intel compilers
instead of the GNU compilers. Unfortunately, the Intel compilers do not provide
a flag that will automatically append a second underscore to symbol names (as
other compilers do, like Portland Group).

Randy

--
Randy Crawford http://www.ruf.rice.edu/~rand rand AT rice DOT edu


Greg LindahlSep 30 2004, 2:14pm show options
Newsgroups: comp.parallel.mpiFrom: lind...@pbm.com (Greg Lindahl) - Find messages by this authorDate: 30 Sep 2004 11:14:58 -0700Local: Thurs, Sep 30 2004 2:14pm Subject: Re: Question on linking MPI programs with ifcReply to Author | Forward | Print | Individual Message | Show original | Report Abuse

In article ...@joe.rice.edu>, Randy ...@burgershack.com> wrote:
>Or you may be having problems with GNU g77's *INSANE* practice of appending
>double underscore suffixes to symbols instead of singles underscores.

You could argue that the insane practice of ignoring the platform
de-facto ABI (AND not providing a switch for compatibility) is worse
than the g2c style of mangling, but I digress. BTW, the actual g2c
algorithm appends one _ to symbols without any _'s.

-- greg


andreyOct 1 2004, 6:30am show options
Newsgroups: comp.parallel.mpiFrom: andrey ...@physics.susu.ac.ru> - Find messages by this authorDate: Fri, 01 Oct 2004 16:30:02 +0600Local: Fri, Oct 1 2004 6:30am Subject: Re: Question on linking MPI programs with ifcReply to Author | Forward | Print | Individual Message | Show original | Report Abuse

Thanks a lot!

It was because of the second underscore in the MPI libraries. I
recompiled them using switch -fc=ifc, and everything is ok now with
compiling and linking :)

Andrey

"
0 Kudos
Steven_L_Intel1
Employee
2,792 Views
Yes, the Intel compiler does provide such an option to append an underscore. In fact, there are two of them, to compensate for g77's strangeness:

[no]underscore Determines whether the compiler appends an underscore character to external user-defined names.
[no]2underscores
Determines whether the compiler appends two underscore characters to external user-defined names.

(The actual implementation is the same as g77s, where two underscores are appended if the name contains an underscore - I think.. This particular issue always makes my head spin...)
0 Kudos
Reply