Hello Oscar,
your comments and code was very helpful! Thanks a lot for your help.
Cheers
2014-10-09 22:42 GMT+01:00 Oscar Vega-Gisbert :
> Hello Atsugua,
>
> You can only send contiguous data, i.e. arrays of basic datatypes (byte,
> char, short, boolean, int, long, float and double) or direct buffers. If
> you need to send complex data, then you must serialize into an array or a
> direct buffer. This is made using using the mpi.Struct class, which
> represents the MPI_STRUCT datatype.
>
> A user-defined struct must be a subclass of Struct and it must have three
> parts:
> 1. A number of data fields defined using the add[Type]() methods, that
> return the corresponding offsets according to the size of the type. The
> offsets must be stored because they will be necessary to access data.
> 2. A subclass of Struct.Data with get/put methods to access data. These
> methods will need the previously stored offsets.
> 3. The implementation of the method newData() in order to tell the library
> how to create Data objects.
>
> Another question is the String class. It is not supported because it is a
> variable sized object. When it is necessary sending strings you must use
> char arrays.
>
> I attached a similar example to what you want.
> Instead of defining two strings you have an int and a string.
>
> Regards,
> Oscar
>
> El 09/10/14 16:27, Atsugua Ada escribió:
>
>> Hello, I am using Open-MPI 1.8.3 for Java. I would like to know how to
>> create a derived datatype that enables the sending of an array of complex
>> data (objects, strings, etc.) to each processor. In fact, I want to create
>> an array of string or objects and sending a part of this array to each
>> proccess.
>>
>> E.g., I created the next class:
>>
>> |/class Data{
>> String data1;
>> String data2;
>>
>> public Data(String d1, String d2)
>> {
>> this.data1= d1;
>> this.data2= d2;
>> }
>> }/|
>> |and then a array of Data objects is created|
>> |
>> |/ Data[] myData= new Data[4];myData[0] = new
>> Data("d1", "this is a test");
>>
>> myData[3] = new Data("the third data", "this is another
>> test");/||
>> |How can I create the datatype to send, e.g., myData[0] and [1] to proc#1
>> and the remaining to the proc#2?|
>> |Thanks.|
>>
>>
>> ___
>> users mailing list
>> us...@open-mpi.org
>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
>> Link to this post: http://www.open-mpi.org/community/lists/users/2014/10/
>> 25480.php
>>
>
>
> ___
> users mailing list
> us...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
> Link to this post:
> http://www.open-mpi.org/community/lists/users/2014/10/25482.php
>