[Beowulf] Compiling mpiJava on Amd64.

Giuseppe Vitillaro giuseppe at vitillaro.org
Thu Jul 20 05:08:55 EDT 2006


Sorry to jump just in the middle of an existing thread,
but I was addressed here from Bernard Lee, that proposed
to me to help on the problem to have mpiJava on the 
x86_64 architecture.

I'm relativily new to this topic, so the solution I got
may look naive to you ... sorry to have bothered the list
if this is the case.

I found a couple of problems trying to compile mpiJava 1.2.5
under RHEL 4.2 on a x86_64 machine.

 (1) unknown architecture to the configure script

      the config/config.guess reports the machine
      as "x86_64-unknown-linuxoldld" that is not recognized
      from the configure script and not handled correctly
      for what I see

      I solved this problem just using the --target=i686-linux
      forcing the configure script to act in the same way
      it works for a i686 machine


 (2) -fPIC Posisition Indipendent Code problem

      for what I understand mpiJava is essentially
      a JNI wrapper to an MPI C library, so, it needs
      to get compiled in the shape of a shared library,
      at least under Linux, i.e. a ".so" library, that
      gets loaded into a running Java Virtual Machine

      so the mpiJava shared library libmpijava.so "must" be
      linked with the -shared option under Linux

      while on the i686 architecture a shared library can
      be linked mixing pic and nonpic objects on the x86_64
      architecture that is not possible, at least for what
      I understand; if you try, you get this error:

        relocation R_X86_64_32 against `a local symbol' can not be used 
            when making a shared object; recompile with -fPIC

      that imply that all the mpiJava objects for the libmpijava.so
      library "must" be compiled using -fPIC option ... otherwise
      ... well it doesn't link ...

      so I actually met two problems: I had to recompile
      the mpi library I was using (the RH default lam-7.0.6 was not pic)
      with the -fPIC flag to get a pic mpi library and be sure
      that libmpijava.so objects get compiled with -fPIC too;

      to achieve the first goal I just downloaded and recompiled
      the lam library 7.1.2 using a default ./configure --prefix
      configuration;

      the second one was easily solved with a "minor hack"
      to the mpiJava configure script: I used the DEFPINS
      mpiJava macro (that is used for other purpouses, but
      not used in my framework) to be sure that -fPIC flag
      go to mpiJava makefiles (I do not like to touch source
      code if I can)

      the complete solution looks like calling the mpiJava
      configure script in this way:

           CFLAGS=-fPIC DEFPINS=-fPIC ./configure --with-MPI=lam 
                  --target=i686-linux

     once the -fPIC lam (read your preferred sup[ported MPI 
     implementation) is the first in your path


 (3) Java Virtual Machine implementation
    
     on my machine I have two versions of the Java SUN installed
     j2sdk1.4.2_10 (1.4 i686 32 bits) and jdk1.5.0_06 (1.5 x86_64 64 bits)

     the reason is easy to understand: for what I know SUN doesn't have
     an x86_64 1.4 implementation or at least ... it didn't have one
     at the time I installed Java on my machine

     if I try to compile mpiJava with the 1.4-i686 version ... using
     the defailt x86_64 gcc compiler ... what I get is that I'm trying
     to build an x86_64 shared library that a i686 Java Virtual Machine
     cannot load ... the JVM will simply report that it cannot find
     the file when "System.loadLibrary()" method is called

     so,  again there are two posibilities here:
 
        (a) using a i686 JVM and the gcc32 (gcc -m32) C compiler
            and essentially get a 32 bits i686 environment
            running on a x86_64 machine;

        (b) using an x86_64 JVM and the gcc C compiler
            and get a 64 bits x86_64 environment;

     I choosed to go through (a): it was easier and I think
     most of the mpiJava users would have a preference to
     have a complete x86_64 64 bits solution.

     Unfortunately I had not a JDK 1.4 x86_64 java environment
     available ... probably there are a non SUN around or perhaps
     SUN has or will publish one. I'm saying this because ... well
     I used a JDK 1.5 environment with a tools that declare to
     be tested just against a 1.4 JDK.


So my personal solution consists of these steps:

  (1) be sure to have an x86_64 JVM first in my path
      (it was 1.5 for me);

  (2) be sure to have a -fPIC x86_64 MPI implementation
      first in my path (it was LAM 7.1.2 fresh compiled for me);

  (3) use a "minor hack" on the mpiJava configure script
      called as:
 
         CFLAGS=-fPIC DEFPINS=-fPIC ./configure --with-MPI=lam
                     --target=i686-linux

  (4) just following the guidelines in mpiJava README file.


I followed this path with mpiJava 1.2.5 and got it compiled
on RHEL 4.2 x86_64.

Problems are not over tough: the "make check" regression
test doesn't look good. Not all tests are passed correctly:
some test fail (although for what I see it passes the
basic ones).

This may depend from my Java version 1.5 (probably it would
be better to try with 1.4 x86_64 version first) or from others
subtle x86_64 from i686 porting problems that may manifest in this way.

I hope this may be useful to others to solve the problem,
sorry to have bothered the list with a so long message,

   Regards, G. Vitillaro
      
    

           


   
    


_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf



More information about the Beowulf mailing list