[mpich-discuss] Create derived data type structure with C++ bindings syntax

Marc levesqm at emt.inrs.ca
Wed Apr 29 10:46:30 CDT 2009


Hi,

I'm trying to make a derived data type which consists of 4 integers and
9 doubles. I'm using the C++ bindings and I got the following error
while running mpirun:

0 - MPI_TYPE_COMMIT : Datatype is MPI_TYPE_NULL

The commit don't seem to work... Here is an excerpt of the code:

int main(int argc, char *argv[])
{
  MPI::Datatype inputDataType;
  MPI::Datatype oldTypes[2];
  MPI::Aint offsets[2];
  MPI::Aint intExtent;
  MPI::Aint lb;
  int blockcounts[2];

  MPI::Init(argc, argv);

  MPI::INT.Get_extent(lb,intExtent);
		
  offsets[0] = 0;
  oldTypes[0] = MPI::INT;
  blockcounts[0] = 4;

  offsets[1] = blockcounts[0] * intExtent;
  oldTypes[1] = MPI::DOUBLE;
  blockcounts[1] = 9;

  inputDataType.Create_struct(2,blockcounts,offsets,oldTypes);
  inputDataType.Commit();

  //Lot of computation and communications here

  inputDataType.Free();
  MPI::Finalize();

  return 0;
}

Why I'm getting that error? I'm using Mpich version 1.2.7-9ubuntu1.
Also, could you explain me what is the lower bound lb nature and what is
it for?

Thanks,

Marc



More information about the mpich-discuss mailing list