All MPI functions with choice arguments associate actual arguments of
different datatypes with the same dummy argument. This is not allowed by
Java. In C, the
void* formal arguments avoid these problems.
The following code fragment is technically illegal and may generate a compile-time error.
float f = new float; double r = new double; MPI.COMM_WORLD.Send(f, *); MPI.COMM_WORLD.Send(r, *);Technically, we will have to use methods overload with different argument datatype or methods with different identifier.
The methods overload implementation in native method will cause problem. Because the methods that has the same name will have the same sub initialization function generated by javah.
The methods with different identifier will implement as following.
MPI.COMM_WORLD.SendFloat(f, *); MPI.COMM_WORLD.SendDouble(r, *);But, there are many MPI communication functions, eg.
MPI_Rsend, etc. If we use this approach, than we are going to have tons of native methods for each functions and datatypes. Which we believe is quite a waste. So we introduce a Java Datatype class which perform the polymorphism between different Java datatypes.