| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A set of helper classes to enable Asynchronous Message Receiving (Event Driven) with Open MPI Java Binding.
The goal is to provide a simple interface on top of MPI (Java binding) to program applications using events for receiving messages. For example:
Each MPI process:
Notice:
// initialize threads
EZMPJ.initThreads(args);
// Start receiver threads with listener interface
EZMPJ.startReceiverThread(this);
// We could use MPI.COMM_WORLD.getRank()
if (EZMPJ.getRank() == 0) {
String message = new String("Hello World !");
// send to process 1
EZMPJ.send(message, 1, tag);
//Stop receiving threads in proc 0 since it will not receive msg
EZMPJ.shutdownReceiverThread();
}
// Wait for all receiver threads
EZMPJ.waitFinalizeThreads();
//receiver listener
/*
This method is called when a message is received
*/
@Override
public void onMessage(EZStatus ezStatus) throws MPIException {
System.out.println("processor#" + EZMPJ.getRank() + " Received message from: " + ezStatus.getSender()
+ ", tag=" + ezStatus.getTag() + ", data=" + ezStatus.getDataObject());
//stop receiving
EZMPJ.shutdownReceiverThread();
}First we need to generate a jar file:
To compile your application:
mpijavac -cp .:/path/to/ezmpj.jar examples/HelloWorld.javaTo run your application:
mpirun -np 4 java -cp .:/path/to/ezmpj.jar examples.HelloWorld| Back | FazBrowse Home | New Git URL |