locked
Building 64 bit .dll using MPI RRS feed

  • Question

  • Hi !

    I am trying to call MS-MPI from with in Java through JNI. This is part of an effort to provide native MPI library support for MPJ Express. Its developed and works on Linux but we want to provide support for windows too.

    I have installed MS-MPI and have successfully ran it. Some how on my visual studio MPI programs compile only for 32 bit while my system is 64 bit. The linker accepts C:\Program Files\Microsoft MPI\Lib\i386 and compiles but when I put C:\Program Files\Microsoft MPI\Lib\amd64 it throws the following errors:

    1>simpleJNI_MPI.obj : error LNK2019: unresolved external symbol _MPI_Init@8 referenced in function _Java_simpleJNI_1MPI_nativeInit@12
    1>simpleJNI_MPI.obj : error LNK2019: unresolved external symbol _MPI_Finalize@0 referenced in function _Java_simpleJNI_1MPI_nativeFinish@8
    1>simpleJNI_MPI.obj : error LNK2019: unresolved external symbol _MPI_Comm_rank@8 referenced in function _Java_simpleJNI_1MPI_rank@16
    1>simpleJNI_MPI.obj : error LNK2019: unresolved external symbol _MPI_Comm_size@8 referenced in function _Java_simpleJNI_1MPI_size@16
    1>C:\Users\xx\Documents\Visual Studio 2010\Projects\dlltest\Debug\simpleJNI_MPI.dll : fatal error LNK1120: 4 unresolved external

    I also tried to configure my Visual Studio with 64 bit compilation by following :

    http://msdn.microsoft.com/en-us/library/9yb4317s.aspx

    but it happens to be that my VS doesn't have 64 bit support.

    Anyways I moved on to build my apps in 32 bit and they work. But when I build a simple .dll library to call MPI from Java it throws the following error:

    C:\Users\xx\Downloads\JNI_to_MPI>mpiexec -np 2 java -cp . -Djava.library.path=C:\jnimpi\ simpleJNI_MPI
    java.lang.UnsatisfiedLinkError: C:\jnimpi\simpleJNI_MPI.dll: Can't load IA 32-bi
    t .dll on a AMD 64-bit platform
            at java.lang.ClassLoader$NativeLibrary.load(Native Method)
            at java.lang.ClassLoader.loadLibrary0(Unknown Source)
            at java.lang.ClassLoader.loadLibrary(Unknown Source)
            at java.lang.Runtime.loadLibrary0(Unknown Source)
            at java.lang.System.loadLibrary(Unknown Source)
            at simpleJNI_MPI.<clinit>(simpleJNI_MPI.java:13)
    Could not find the main class: simpleJNI_MPI.  Program will exit.

    So any solution?

    regards,

    Bibrak Qamar


    • Edited by Bibrak Friday, March 28, 2014 6:51 AM
    Friday, March 28, 2014 6:23 AM

All replies

  • Hi Bibrak,

    What version of Visual Studio are you using?  I'm surprised you don't have 64-bit support.

    It sounds like your DLL project (or your Java runtime) is 64-bit only, and you are trying to load a 32-bit DLL, which isn't supported.  Is three a 32-bit JRE that you could use (sorry if this sounds like a dumb question, I know next to nothing about Java).

    Basically, you either need to run every part of your application as 32-bit, or everything as 64-bit - you can't mix and match.

    -Fab

    Saturday, March 29, 2014 6:33 PM
  • Thanks, I sorted it out. My visual Studio had no support for 64bit compilation. I installed a newer version of visual studio.
    Wednesday, April 2, 2014 3:35 PM