MPJ does not have the status of an official language binding for MPI. But, as a matter of interest, this section will compare some surface features of the Java API with standard MPI language bindings.
All MPJ classes belong to the package mpj. Conventions for capitalization, etc, in class and member names generally follow the recommendations of Sun's Java code conventions . In general these conventions are consistent with the naming conventions of the MPI 2.0 C++ standard. Exceptions to this rule include the use of lower case for the first letters of method names, and avoidance of underscore in variable names.
With MPI opaque objects replaced by Java objects, MPI destructors can be absorbed into Java object destructors (finalize methods), called automatically by the Java garbage collector. MPJ adopts this strategy as the general rule. Explicit calls to destructor functions are typically omitted from the Java user code. An exception is made for the Comm classes. In MPI the destructor for a communicator is a collective operation, and the user must ensure that calls are made at consistent times on all processors involved. Automatic garbage collection would not guarantee this. Hence the MPJ Comm class has an explicit free method.
Some options allowed for derived data types in the C and Fortran bindings are absent from MPJ. In particular, the Java virtual machine does not support any concept of a global linear address space. Therefore, physical memory displacements between fields in objects are unavailable or ill-defined. This puts some limits on the possible uses of any analogues of the MPI_TYPE_STRUCT type constructor. In practice the MPJ struct data type constructor has been further restricted in a way that makes it impossible to send mixed basic data types in a single message. However, this should not be a serious problem, since the set of basic data types in MPJ is extended to include serializable Java objects.
Array size arguments are often omitted in MPJ, because they can be picked up within the function by reading the length member of the array argument. A crucial exception is for message buffers, where an explicit count is always given. Message buffers aside, typical array arguments to MPI functions (e.g., vectors of request structures) are small arrays. If subsections of these must be passed to an MPI function, the sections can be copied to smaller arrays at little cost. In contrast, message buffers are typically large and copying them is expensive, so it is worthwhile to pass an extra size argument to select a subset. (Moreover, if derived data types are being used, the required value of the count argument is always different to the buffer length.) C and Fortran both have ways of treating a section of an array, offset from the beginning of the array, as if it was an array in its own right. Java does not have any such mechanism. To provide the same flexibility in MPJ, an explicit integer offset parameter also accompanies any buffer argument. This defines the position in the Java array of the first element actually treated as part of the buffer.
The C and Fortran languages define a straightforward mapping (or ``sequence association'') between their multidimensional arrays and equivalent one-dimensional arrays. In MPI a multidimensional array passed as a message buffer argument is generally treated like a one-dimensional array with the same element type. Offsets in the buffer (such as offsets occurring in derived data types) behave like offsets in the effective one-dimensional array. In Java the relationship between multidimensional arrays and one dimensional arrays is different. An ``-dimensional array'' is equivalent to a one-dimensional array of -dimensional arrays. In the MPJ interface message buffers are always treated as one-dimensional arrays. The element type may be an object, which may have array type. Hence, multidimensional arrays can appear as message buffers, but the interpretation and behaviour is significantly different.
Unlike the standard MPI interfaces, MPJ methods do not return explicit error codes. Instead, the Java exception mechanism is used to report errors.