-/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "private.hpp"
#include "smpi_datatype_derived.hpp"
+#include "smpi_comm.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
return datatype->extent(lb, extent);
}
+int PMPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count * lb, MPI_Count * extent)
+{
+ MPI_Aint tmplb;
+ MPI_Aint tmpext;
+ int ret = PMPI_Type_get_extent(datatype, &tmplb, &tmpext);
+ if(ret == MPI_SUCCESS){
+ *lb = static_cast<MPI_Count>(tmplb);
+ *extent = static_cast<MPI_Count>(tmpext);
+ }
+ return ret;
+}
+
int PMPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent)
{
return PMPI_Type_get_extent(datatype, lb, extent);
}
+int PMPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count * lb, MPI_Count * extent)
+{
+ return PMPI_Type_get_extent_x(datatype, lb, extent);
+}
+
int PMPI_Type_extent(MPI_Datatype datatype, MPI_Aint * extent)
{
CHECK_MPI_NULL(1, MPI_DATATYPE_NULL, MPI_ERR_TYPE, datatype)
CHECK_NEGATIVE(1, MPI_ERR_COUNT, incount)
CHECK_TYPE(2, datatype)
CHECK_COMM(3)
- *size=incount*datatype->size();
+ *size = incount * std::max<long>(datatype->size(), datatype->get_extent());
return MPI_SUCCESS;
}