Greetings Siegmar; sorry for the horrid delay in replying. :-( Ralph opened a ticket about this a while ago (https://svn.open-mpi.org/trac/ompi/ticket/3351). I answered it this morning -- see the ticket for the details.
Short version: I don't think that your program is correct. On Oct 11, 2012, at 7:40 AM, Siegmar Gross wrote: > Hi, > > I have built openmpi-1.9a1r27380 with Java support and try some small > programs. When I try to scatter an object, I get a ClassCastException. > I use the following object. > > public class MyData implements java.io.Serializable > { > static final long serialVersionUID = -5243516570672186644L; > > private int age; > private String name; > private double salary; > > public MyData () > { > age = 0; > name = ""; > salary = 0.0; > } > > public void setAge (int newAge) > { > age = newAge; > } > ... > } > > > I use the following main program. > > import mpi.*; > > public class ObjectScatterMain > { > public static void main (String args[]) throws MPIException > { > int mytid; /* my task id > */ > MyData dataItem, objBuffer; > String processor_name; /* name of local machine */ > > MPI.Init (args); > processor_name = MPI.Get_processor_name (); > mytid = MPI.COMM_WORLD.Rank (); > dataItem = new MyData (); > objBuffer = new MyData (); > if (mytid == 0) > { > /* initialize data item */ > dataItem.setAge (35); > dataItem.setName ("Smith"); > dataItem.setSalary (2545.75); > } > MPI.COMM_WORLD.Scatter (dataItem, 0, 1, MPI.OBJECT, > objBuffer, 0, 1, MPI.OBJECT, 0); > /* Each process prints its received data item. The outputs > * can intermingle on the screen so that you must use > * "-output-filename" in Open MPI. > */ > System.out.printf ("\nProcess %d running on %s.\n" + > " Age: %d\n" + > " Name: %s\n" + > " Salary: %10.2f\n", > mytid, processor_name, > objBuffer.getAge (), > objBuffer.getName (), > objBuffer.getSalary ()); > MPI.Finalize(); > } > } > > > I get the following error, when I compile and run the program. > > tyr java 218 mpijavac ObjectScatterMain.java > tyr java 219 mpiexec java ObjectScatterMain > Exception in thread "main" java.lang.ClassCastException: > MyData cannot be cast to [Ljava.lang.Object; > at mpi.Intracomm.copyBuffer(Intracomm.java:119) > at mpi.Intracomm.Scatter(Intracomm.java:389) > at ObjectScatterMain.main(ObjectScatterMain.java:45) > -------------------------------------------------------------------------- > mpiexec has exited due to process rank 0 with PID 25898 on > ... > > > Has anybody an idea why I get a ClassCastException or how I must define > an object, which I can use in a scatter operation? Thank you very much > for any help in advance. > > > Kind regards > > Siegmar > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/