Skip to content

Commit

Permalink
Merge pull request #6258 from hzhou/2211_yaksa_pack
Browse files Browse the repository at this point in the history
datatype: fix builtin_element_size at MPIR_Typerep_unflatten

Approved-by: Ken Raffenetti
  • Loading branch information
hzhou committed Nov 10, 2022
2 parents c06659e + b0cef14 commit a6d3064
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/mpi/datatype/typerep/src/typerep_flatten.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ int MPIR_Typerep_unflatten(MPIR_Datatype * datatype_ptr, void *flattened_type)
datatype_ptr->true_lb = flatten_hdr->true_lb;
datatype_ptr->contents = NULL;
datatype_ptr->flattened = NULL;
if (datatype_ptr->basic_type != MPI_DATATYPE_NULL) {
datatype_ptr->builtin_element_size = MPIR_Datatype_get_basic_size(datatype_ptr->basic_type);
} else {
datatype_ptr->builtin_element_size = 0;
}

#if (MPICH_DATATYPE_ENGINE == MPICH_DATATYPE_ENGINE_YAKSA)
int rc = yaksa_unflatten(&datatype_ptr->typerep.handle, flattened_typerep);
Expand Down
5 changes: 1 addition & 4 deletions src/mpi/datatype/typerep/src/typerep_yaksa_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ static int typerep_do_pack(const void *inbuf, MPI_Aint incount, MPI_Datatype dat
MPIR_Datatype *dtp;
MPIR_Datatype_get_ptr(datatype, dtp);
is_contig = dtp->is_contig;
/* NOTE: dtp->element_size may not be set if dtp is from a flattened type */
if (dtp->basic_type != MPI_DATATYPE_NULL) {
element_size = MPIR_Datatype_get_basic_size(datatype);
}
element_size = dtp->builtin_element_size;
inbuf_ptr = MPIR_get_contig_ptr(inbuf, dtp->true_lb);
total_size = incount * dtp->size;
}
Expand Down

0 comments on commit a6d3064

Please sign in to comment.