none
How to link msMPI with intel fortran? RRS feed

  • Question

  • aHi every one:
    I am tried to compile a simple MPI (fpi) program using MSMPI in VS2008 and intel fortran.
    The code is the example code named "fpi.f" in MPICH2 installation folder.
    The compiler is intel fortran 11 which integrated in VS 2008.
    Before I start compile the program, several steps of setting are made:
    1. set "C:\Program Files\Microsoft HPC Pack 2008 SDK\Include" as additional include directories in Fortran tab.
    2. set "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64" as additional library directories in Link tab.
    3. set "msmpi.lib  msmpifec.lib" as additional dependencies in link tab.
    Then I compiled the program to X64 program. but the compiler reported following errors:
    Error    1     error LNK2019: unresolved external symbol MPI_INIT referenced in function MAIN__    fpi.obj   
    Error    2     error LNK2019: unresolved external symbol MPI_COMM_RANK referenced in function MAIN__    fpi.obj   
    Error    3     error LNK2019: unresolved external symbol MPI_COMM_SIZE referenced in function MAIN__    fpi.obj   
    Error    4     error LNK2019: unresolved external symbol MPI_BCAST referenced in function MAIN__    fpi.obj   
    Error    5     error LNK2019: unresolved external symbol MPI_FINALIZE referenced in function MAIN__    fpi.obj   
    Error    6     error LNK2019: unresolved external symbol MPI_REDUCE referenced in function MAIN__    fpi.obj  
    It looks like the program can not link with the "msmpi.lib" . I also tried to link the program to  "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\i386". the compiler also report the above errors. By the way, if I link the program with MPCIH2 then everything is fine.
    Can any can tell me how to set the link library for Fortran?
    Many thanks.
    Friday, July 10, 2009 5:57 AM

Answers

  • Hi,

    please try:
    "msmpifmc.lib" "msmpi.lib" instead of just msmpi.lib in the Input of the fortran linker.
    This worked for my testprogram.
    Otherwise I had the same problems as described by you above.

    Some people also suggest to have "ws2_32.lib" for winsock as well. It was not necessary in my testprogram.

    Pure msmpi.lib is enough for C/C++ programs. So obviously the other ones are for fortran or at least needed as well.



    Johannes
    JH
    Friday, July 10, 2009 11:34 AM
  • Hi,

    Johannes is correct you also need to link one of the msmpi fortran libraries.

    see http://social.microsoft.com/Forums/en-AU/windowshpcmpi/thread/0ffde564-8bc8-4ccd-8991-217278237ed8 for more info.
    you don't need ws2_32.lib unless your application is using sockets directly.

    .Erez
    Sunday, July 12, 2009 12:31 AM
  • The problem is solved.
    I just create a new Fortran project instead my old one, and did as below:
    1. set "C:\Program Files\Microsoft HPC Pack 2008 SDK\Include" as additional include directories in Fortran tab.
    2. set "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64" as additional library directories in Link tab.
    3. set "msmpi.lib msmpifmc.lib" as additional dependencies in link tab.
    I don't know why my previous Fortran project can not work.
    Monday, July 13, 2009 7:42 AM

All replies

  • Hi,

    please try:
    "msmpifmc.lib" "msmpi.lib" instead of just msmpi.lib in the Input of the fortran linker.
    This worked for my testprogram.
    Otherwise I had the same problems as described by you above.

    Some people also suggest to have "ws2_32.lib" for winsock as well. It was not necessary in my testprogram.

    Pure msmpi.lib is enough for C/C++ programs. So obviously the other ones are for fortran or at least needed as well.



    Johannes
    JH
    Friday, July 10, 2009 11:34 AM
  • Hi,

    Johannes is correct you also need to link one of the msmpi fortran libraries.

    see http://social.microsoft.com/Forums/en-AU/windowshpcmpi/thread/0ffde564-8bc8-4ccd-8991-217278237ed8 for more info.
    you don't need ws2_32.lib unless your application is using sockets directly.

    .Erez
    Sunday, July 12, 2009 12:31 AM
  • Thanks for you reply.
    I tried to add "msmpi.lib msmpifmc.lib" in the additional dependencies, and other settings are the same as my above described. However, The compiler also report the following errors. By the way the MPI I installed is "Microsoft HPC Pack 2008 SDK", which is downloaded form "http://www.microsoft.com/downloads/details.aspx?FamilyID=12887DA1-9410-4A59-B903-693116BFD30E&displaylang=en".

    Error    1     error LNK2019: unresolved external symbol MPI_INIT referenced in function MAIN__    fpi.obj   
    Error    2     error LNK2019: unresolved external symbol MPI_COMM_RANK referenced in function MAIN__    fpi.obj   
    Error    3     error LNK2019: unresolved external symbol MPI_COMM_SIZE referenced in function MAIN__    fpi.obj   
    Error    4     error LNK2019: unresolved external symbol MPI_BCAST referenced in function MAIN__    fpi.obj   
    Error    5     error LNK2019: unresolved external symbol MPI_FINALIZE referenced in function MAIN__    fpi.obj   
    Error    6     error LNK2019: unresolved external symbol MPI_REDUCE referenced in function MAIN__    fpi.obj   
    Error    7     error LNK2001: unresolved external symbol MPI_DUP_FN    fpi.obj   
    Error    8     error LNK2001: unresolved external symbol MPI_NULL_DELETE_FN    fpi.obj   
    Error    9     error LNK2001: unresolved external symbol MPI_NULL_COPY_FN    fpi.obj   
    Error    10     error LNK2001: unresolved external symbol MPI_COMM_DUP_FN    fpi.obj   
    Error    11     error LNK2001: unresolved external symbol MPI_COMM_NULL_DELETE_FN    fpi.obj   
    Error    12     error LNK2001: unresolved external symbol MPI_COMM_NULL_COPY_FN    fpi.obj   
    Error    13     error LNK2001: unresolved external symbol MPI_WIN_DUP_FN    fpi.obj   
    Error    14     error LNK2001: unresolved external symbol MPI_WIN_NULL_DELETE_FN    fpi.obj   
    Error    15     error LNK2001: unresolved external symbol MPI_WIN_NULL_COPY_FN    fpi.obj   
    Error    16     error LNK2001: unresolved external symbol MPI_TYPE_DUP_FN    fpi.obj   
    Error    17     error LNK2001: unresolved external symbol MPI_TYPE_NULL_DELETE_FN    fpi.obj   
    Error    18     error LNK2001: unresolved external symbol MPI_TYPE_NULL_COPY_FN    fpi.obj   
    Error    19     error LNK2001: unresolved external symbol MPI_CONVERSION_FN_NULL    fpi.obj   
    Monday, July 13, 2009 5:16 AM
  • Somehow your compiler does not see the mpi libraries.
    Are you using the amd64 libs again? Otherwise the compiler might skip the x86 libs....


    JH
    Monday, July 13, 2009 7:02 AM
  • The problem is solved.
    I just create a new Fortran project instead my old one, and did as below:
    1. set "C:\Program Files\Microsoft HPC Pack 2008 SDK\Include" as additional include directories in Fortran tab.
    2. set "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64" as additional library directories in Link tab.
    3. set "msmpi.lib msmpifmc.lib" as additional dependencies in link tab.
    I don't know why my previous Fortran project can not work.
    Monday, July 13, 2009 7:42 AM
  • The problem is solved.
    I just create a new Fortran project instead my old one, and did as below:
    1. set "C:\Program Files\Microsoft HPC Pack 2008 SDK\Include" as additional include directories in Fortran tab.
    2. set "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64" as additional library directories in Link tab.
    3. set "msmpi.lib msmpifmc.lib" as additional dependencies in link tab.
    I don't know why my previous Fortran project can not work.

    Sometimes my linker gets confused by "lib1 lib2" and what does then work is: "lib1" "lib2" (theres a space between!)

    JH
    Monday, July 13, 2009 7:47 AM