George,
at first glance, it seems GHtyp is initialized too early with
uninitialized types MPHdr and MPBlk.
can you try to initialize GHtyp *after* both types are commited ?
if it still does not work, could you please post a self contained and
simple reproducer ?
Cheers,
Gilles
On 1/31/2017 6:31 AM, George Reeke wrote:
Dear colleagues,
I am trying MPI_Type_create_struct for the first time.
I want to combine a small structure (two ints) with a vector of
variable length to send in a single message. Here is a simplified
extract of the relevant C code. The MPI_Type_create_struct call
gives a segfault. The nearest I can see to what is wrong is that
the argument I called GHtyp has as its first element a small
integer (0x53) which the function ompi_datatype_create_struct
is trying to use as a pointer. But I thought I created it with
an MPI_Type_contiguous call:
/* The next three variables are passed in from other
* calculations and have reasonable values per gdb. */
char *pv = /* Pointer to my data array */
int lblk = /* Length of one element of my data array */
int nblks = /* Number of these blocks in the data vector */
MPI_Datatype MPHdr,MPBlk,MPPkt;
struct GHdr_t {
int odat, nblk; /* Code to set these values not shown */
} sGHdr;
int GHect[2] = { 1, 0 }; /* Second count inserted below */
MPI_Datatype GHtyp[2] = { MPHdr, MPBlk };
MPI_Aint GHoff[2];
/* Executable code */
MPI_Type_contiguous(2, MPI_UNSIGNED, &MPHdr);
MPI_Type_commit(&MPHdr);
MPI_Type_contiguous(lblk, MPI_UNSIGNED_CHAR, &MPBlk);
MPI_Type_commit(&MPBlk);
GHect[1] = nblks;
MPI_Get_address(pv, GHoff+1);
MPI_Get_address(&sGHdr, GHoff);
MPI_Type_create_struct(2, GHect, GHoff, GHtyp, &MPPkt);
----segfault on this call-never gets to the following commit----
Any suggestions would be most welcome.
Thanks,
George Reeke
_______________________________________________
users mailing list
users@lists.open-mpi.org
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@lists.open-mpi.org
https://rfd.newmexicoconsortium.org/mailman/listinfo/users