PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

WIN32+MPICH2

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
akanaev



Joined: 05 Apr 2012
Posts: 3

PostPosted: Fri Apr 06, 2012 1:08 pm    Post subject: WIN32+MPICH2 Reply with quote

Hello, i'm sorry i'm new to that - trying to compile a simple mpi code

program hello
include 'mpif.h'
integer ierr, myproc
call mpi_init(ierr)
call mpi_comm_rank(MPI_COMM_WORLD, myproc, ierr)
print *, "Hello world! I'm node", myproc
call mpi_finalize(ierr)
end

using precompiled mpich2 libraries on windows 32 machine:

PGI$ pgf95 -I "C:\Program Files\MPICH2\include" -L "C:\Program Files\MPICH2\lib" -Mfree hellompi.f -l fmpitch2.lib

It comes with 7 severes about mpifcmb1,has not been explicitly declared(C:\Program Files\MPICH2\include\mpif.h: 494) etc.

What is the right way to compile that?
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5815
Location: The Portland Group Inc.

PostPosted: Fri Apr 06, 2012 3:28 pm    Post subject: Reply with quote

Quote:
using precompiled mpich2 libraries on windows 32 machine
Where did get the MPICH2 libraries from? Were they compiled for use the PGI Fortran?

Quote:
It comes with 7 severes about mpifcmb1,has not been explicitly declared
mpifcmb1 is a common block so I suspect that your MPICH2 library was not compiled for use with PGI and differing name decoration is causing the error. Though, this is just a guess. An example of the error would be helpful.

Since you're using F90 and MPICH2, try using the mpi module instead of including the header file. (i.e. replace "include 'mpif.h'" with "use mpi"). Granted, you'll still have problems if your MPICH2 was compiled for PGI.

- Mat
Back to top
View user's profile
akanaev



Joined: 05 Apr 2012
Posts: 3

PostPosted: Fri Apr 06, 2012 4:49 pm    Post subject: Reply with quote

mkcolg wrote:
Where did get the MPICH2 libraries from? Were they compiled for use the PGI Fortran?


They are from here
http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads

MPICH2 Windows IA32 (binary)
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5815
Location: The Portland Group Inc.

PostPosted: Mon Apr 09, 2012 12:52 pm    Post subject: Reply with quote

Hi akanaev,

I downloaded the MPICH2 package and found that the error was being caused by several misplaced "!DEC$" declarations in "mpif.h". To fix, I simply moved these declaration below the common blocks. Because the symbols used in the "DEC" declarations hadn't been declared yet, the compiler complained.

Example:
Code:
       CHARACTER*1 PADS_A(3), PADS_B(3)
       COMMON /MPIFCMB1/ MPI_STATUS_IGNORE
       COMMON /MPIFCMB2/ MPI_STATUSES_IGNORE
       COMMON /MPIFCMB3/ MPI_BOTTOM
       COMMON /MPIFCMB4/ MPI_IN_PLACE
       COMMON /MPIFCMB5/ MPI_UNWEIGHTED
       COMMON /MPIFCMB6/ MPI_ERRCODES_IGNORE
       COMMON /MPIFCMB7/ MPI_ARGVS_NULL, PADS_A
       COMMON /MPIFCMB8/ MPI_ARGV_NULL, PADS_B
       SAVE /MPIFCMB1/,/MPIFCMB2/
       SAVE /MPIFCMB3/,/MPIFCMB4/,/MPIFCMB5/,/MPIFCMB6/
       SAVE /MPIFCMB7/,/MPIFCMB8/
!DEC$ ATTRIBUTES DLLIMPORT::/MPIFCMB1/
!DEC$ ATTRIBUTES DLLIMPORT::/MPIFCMB2/
!DEC$ ATTRIBUTES DLLIMPORT::/MPIFCMB3/
!DEC$ ATTRIBUTES DLLIMPORT::/MPIFCMB4/
!DEC$ ATTRIBUTES DLLIMPORT::/MPIFCMB5/
!DEC$ ATTRIBUTES DLLIMPORT::/MPIFCMB7/
!DEC$ ATTRIBUTES DLLIMPORT::/MPIFCMB8/


Because this build of the library was not built with PGI, to link, you need to add the flag "-Miface=cref". Also, the "-l" flag will add a "lib" before the name of the library, so you need to instead put the fully qualified PATH to fmpich2.lib.

Example:
Code:
PGI$ pgf95 -I "C:\Program Files\MPICH2\include" "C:\Program Files\MPICH2\lib\fmpich2.lib" -Mfree hello.f  -Miface=cref -o hello.exe
hello.f:
PGI$ hello.exe
 Hello world! I'm node            0


Hope this helps,
Mat
Back to top
View user's profile
akanaev



Joined: 05 Apr 2012
Posts: 3

PostPosted: Tue Apr 10, 2012 5:46 pm    Post subject: Reply with quote

Hi,Mat
It works this way, thanks for the help!
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group