Greetings Chuck,
I tend to agree with Doug.  It hope to be able to test soon OpenMPI under Lion/Mountain Lion.  If someone has already done so, especially with Java, that could be quite handy.

V/R,

Daniel Beatty, Ph.D.
Computer Scientist, Detonation Sciences Branch
Code 474300D
1 Administration Circle M/S 1109
China Lake, CA 93555
daniel.beatty@navy.mil
(LandLine) (760)939-7097
(iPhone) (806)438-6620

 


On 1/3/13 9:49 AM, "Ralph Castain" <rhc@open-mpi.org> wrote:

Hi Doug

What modules software do you use on the Mac? Would be nice to know :-)


On Jan 3, 2013, at 8:34 AM, Doug Reeder <dlr1@centurylink.net> wrote:

Chuck,

In step 4 you might want to consider the following

--prefix=/usr/local/openmpi-1.7rc5

and use the modules software to select which version of openmpi to use. I have to have multiple versions of openmpi available on my macs and this approach has worked well for me.

Doug Reeder
On Jan 3, 2013, at 9:22 AM, Chuck Mosher wrote:

Hi,

I've been trying to get a working version of the MPI java bindings on Mac OSX (10.6.8 with Java 1.6.0_37).

I ran into a number of issues along the way that I thought I would record here for others who might be foolish enough to try the same ;-)

The issues I had to spend time with were:

1. Installing a C compiler that can run from the command line
2. Finding and installing an appropriate Java JDK for my OS version
3. Building and installing OpenMPI for the first time on a Mac
4. Conflicts with the existing OpenMPI version 1.2.8 that was installed already on my Mac
5. Figuring out syntax for using the mpirun command line to run java
6. Odd behavior when trying to use "localhost" or the output from `hostname` on the command line or in a hostfile

Resolution for each of these in order:

1. Installing a C compiler for the command line
Found a good resource here:
http://www.macobserver.com/tmo/article/install_the_command_line_c_compilers_in_os_x_lion <http://www.macobserver.com/tmo/article/install_the_command_line_c_compilers_in_os_x_lion>
The solution is to install XCode, then enable command line compilers from the XCode console.

2. Finding and installing an appropriate Java JDK for my OS version
Used this resource to eventually figure out what to do:
http://www.wikihow.com/Install-the-JDK-(Java-Development-Kit)-on-Mac-OS-X <http://www.wikihow.com/Install-the-JDK-(Java-Development-Kit)-on-Mac-OS-X>
It didn't exactly match my setup, but had enough clues.
The solution is to first find your java version (java -version, 1.6.0_37 in my case) and then match that version number to the Apple Java update version (11 in my case).
The key document is:
http://developer.apple.com/library/mac/#technotes/tn2002/tn2110.html
Which is a table relating java version numbers to the appropriate "Java for Mac OS X xx.x Update xx".
Once you know the update number, you can download the JDK installer from
https://developer.apple.com/downloads/index.action
where you of course have to have an Apple developer ID to access.
Enter "java" in the search bar on the left and find the matching java update, and you're good to go.

3. Building and installing OpenMPI for the first time on a Mac
After the usual false starts with a new installation on a new OS, I managed to get a working build of openmpi-1.7rc5 with Java bindings.
I could only find the java bindings in the 1.7 pre-release.
I used the defaults as much as possible.

After downloading from:
http://www.open-mpi.org/software/ompi/v1.7/
and unarchiving to Downloads, open a Terminal window.

cd Downloads/openmpi-1.7rc5
./configure --enable-java --prefix=/usr/local
make all
sudo make install

Verify that you can run the commands and examples:

chuck-> /usr/local/bin/mpirun -version
mpirun (Open MPI) 1.7rc5

chuck-> cd examples
chuck-> make
chuck-> /usr/local/bin/mpirun -np 2 hello_c
Hello, world, I am 0 of 2, (Open MPI v1.7rc5, package: Open MPI chuck@chucks-iMac.local Distribution, ident: 1.7rc5, Oct 30, 2012, 111)
Hello, world, I am 1 of 2, (Open MPI v1.7rc5, package: Open MPI chuck@chucks-iMac.local Distribution, ident: 1.7rc5, Oct 30, 2012, 111)

4. Conflicts with the existing OpenMPI version 1.2.8 that was installed already on my Mac
OpenMPI Version 1.2.8 was already installed for my OS in /usr/bin
So, if you accidentally type:

chuck-> mpirun -np 2 hello_c
--------------------------------------------------------------------------
A requested component was not found, or was unable to be opened
...

you picked up the wrong "mpirun" and you will get a bunch of error output complaining about sockets or mis-matched shared library versions.

I dealt with this moving the existing OpenMPI related commands to a subdirectory, and then created symbolic links from /usr/local/bin to /usr/bin for the commands I needed.

5. Figuring out syntax for using the mpirun command line to run java
First be sure you can run Java

chuck-> /usr/bin/java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-10M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

Then be sure you can run your java class from the command line as well. To figure this out I created a couple of simple java files in a temp directory:

chuck-> cd ~/tmp
chuck-> mkdir classes
chuck -> cat HelloWorld.java

public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello World, from Java !");
  }
}

chuck-> javac -d classes HelloWorld.java
chuck-> java -cp ./classes HelloWorld

Hello World, from Java !

No sense going further until you can get the code above to run.
If you have that working, then you can try the MPI version of HelloWorld:

chuck-> cat HelloWorldMPI.java

import mpi.*;
class HelloWorldMPI {
  public static void main(String[] args) throws MPIException {
    MPI.Init(args);
    System.out.println("Hello world from rank " +
      MPI.COMM_WORLD.Rank() + " of " +
      MPI.COMM_WORLD.Size() );
    MPI.Finalize();
  }
}

chuck-> /usr/local/bin/mpijavac -d classes HelloWorldMPI.java
/usr/local/bin/mpirun -np 2 /usr/bin/java -cp ./classes HelloWorldMPI

Hello world from rank 0 of 2
Hello world from rank 1 of 2

And you're ready to go !
Except for one last thing ...

6. Odd behavior when trying to use "localhost" or the output from `hostname` on the command line or in a hostfile
You will note in the examples above no host names, hostifle, or appfile was used.
I found that trying to use "-host localhost" or "-hostfile hostfile" which contained "localhost" would not work:

mpirun -host localhost -np 2 ...

in the examples above would not work, returning:

chuck$ /usr/local/bin/mpirun -host localhost -np 2 /usr/bin/java -cp ./classes HelloWorldMPI
--------------------------------------------------------------------------
All nodes which are allocated for this job are already filled.
--------------------------------------------------------------------------

I posted this in a previous e-mail to this list, and it looks like a bug.
You can get around it by using the output from `hostname -s` which provides a trimmed name:

chuck-> /usr/local/bin/mpirun -host `hostname -s` -np 2 /usr/bin/java -cp ./classes HelloWorldMPI
Hello world from rank 0 of 2
Hello world from rank 1 of 2

You will also need to use this name in any hostfiles or appfiles as well until the bug is fixed.

Thanks to all for this great product !

Chuck Mosher for JavaSeis.org <http://javaseis.org/>


_______________________________________________
users mailing list
users@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users

_______________________________________________
users mailing list
users@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users



_______________________________________________
users mailing list
users@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users