I'm new to parallel programming and I want to do it in java. I am wondering if it is possible to send and receive more complex ojects via MPI. I'm using MPJ express. However whenever I want to send a object I get a ClassCastException.
MPI.Init(args);
myrank = MPI.COMM_WORLD.Rank();
numprocs = MPI.COMM_WORLD.Size();
Vector<CustomClass> chr = new Vector<CustomClass>();
if (myrank == 0 ) { //am I the master?
for (int i = 1; i < numprocs; i++) {
MPI.COMM_WORLD.Send(chr, 0, chr.size(), MPI.OBJECT, i, 99); //Here's where the
exception occurs
}
}
else {
Vector<BasicRegion> chr_received = new Vector<BasicRegion>();
MPI.COMM_WORLD.Recv(chr_received, 0, 1, MPI.OBJECT, 0, 99 );
}
Exception:
mpi.MPIException: mpi.MPIException: java.lang.ClassCastException: java.util.Vector cannot be cast to [Ljava.lang.Object;
So my questions are: - is it possible to send/receive more complex objects with MPJ Express? - if so: what am I doing wrong?