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

ifort mpif90 compile mpi program error

xiaoming_l_
Beginner
1,832 Views

the program is

program main
use mpi
character *(MPI_MAX_PROCESSOR_NAME) processor_name
integer myid,numprocs,namelen,rc,ierr
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD,myid,ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD,numprocs,ierr)
call MPI_GET_PROCESSOR_NAME(processor_name,namelen,ierr)
print *,"Hello World ! Process "!,myid,"of",numprocs,"on",processor_name
call MPI_FINALIZE(rc)
end

I got errors

test.f90(2): error #7013: This module file was not generated by any release of this compiler. [MPI]
use mpi
----^
test.f90(3): error #6279: A specification expression object must be a dummy argument, a COMMON block object, or an object accessible through host or use association [MPI_MAX_PROCESSOR_NAME]
character *(MPI_MAX_PROCESSOR_NAME) processor_name
------------^
test.f90(3): error #6591: An automatic object is invalid in a main program. [PROCESSOR_NAME]
character *(MPI_MAX_PROCESSOR_NAME) processor_name
------------------------------------^
compilation aborted for test.f90 (code 1)

mpif90 -v :   ifort version 13.0.0

mpif90 -V

Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.0.0.079 Build 20120731
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY

mpif90 --showme

ifort -I/opt/openmpi-icc/include -I/opt/openmpi-icc/lib -L/opt/openmpi-icc/lib -lmpi_f90 -lmpi_f77 -lmpi -ldl -lm -Wl,--export-dynamic -lrt -lnsl -lutil

I want compile with ifort ,how should I do ?

0 Kudos
3 Replies
TimP
Honored Contributor III
1,832 Views

As you are using OpenMPI, but it seems you don't have mpif90 fully enabled, you must refer to their FAQ on how to build MPI using ifort as the Fortran compiler.

0 Kudos
Casey
Beginner
1,832 Views

Your OpenMPI installation is not correct.  The code your supplied compiles and runs fine with OpenMPI (tested with OpenMPI 1.6.4 and ifort 13.1.1).  It looks like ifort is complaining that your mpi.mod was not built with the intel compiler and the default fortran compiler on your system is not compatible with ifort.  When you build OpenMPI you can specify the fortran compiler used to build the fortran modules and libraries using "F77=ifort FC=ifort" in the configure script.  In case it helps, this is configure invocation I used to build OpenMPI:

[bash]./configure --prefix=/opt/openmpi CC=icc CXX=icpc F77=ifort FC=ifort --with-mpi-f90-size=medium[/bash]

0 Kudos
xiaoming_l_
Beginner
1,832 Views

Thanks , I believe that the sysadmin alwalys will be correct, Now I don't think so .....,

0 Kudos
Reply