We assume that an MPJ program will be written as a class that extends MPJApplication. To simplify downloading we assume that the user class also implements the Serializable interface. The main program will be implemented as an instance method main:
class MyMPJApp extends MPJApplication { public void main(String [] args, Comm world) {...} }
The default communicator is passed as an argument to main.
Note there is no equivalent of MPI_INIT or MPI_FINALIZE.
Their functionality is absorbed into code executed before and after
the user's main method is called.
In a perfect world we might execute MyMPJApp by a command like
java MyMPJApp -np 8
where the -np option specifies the number of processors on which
the program is to execute. This isn't quite practical, because there is
no obvious way for a generic static main method (defined in the
base class MPJApplication) to discover the actual subclass that
the java command was started with. So it cannot dispatch instances of
MyMPJApp to remote machines. Probably we have to settle instead for
java MPJClient MyMPJApp -np 8
where now MPJClient is a separate library class that is responsible for starting instances of the MyMPJApp on 8 remote machines.