I cannot get extend of the derived MPI data type in the following code when I do mpirun -n 2 ./out. Why?
Error message:
*** An error occurred in MPI_Type_get_extent
*** reported by process [969080833,1]
*** on communicator MPI_COMM_WORLD
*** MPI_ERR_ARG: invalid argument of some other kind
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
*** and potentially your MPI job)
1 more process has sent help message help-mpi-errors.txt / mpi_errors_are_fatal
Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
main.cpp:
#include "mpi.h"
MPI_Datatype MPI_A;
struct A
{
int a;
};
int main()
{
MPI_Init(NULL, NULL);
A a;
int nblock = 1;
int block_count = 1;
MPI_Aint offset = 0;
MPI_Datatype block_type = MPI_INT;
MPI_Type_struct(nblock, &block_count, &offset, &block_type, &MPI_A);
MPI_Type_commit(&MPI_A);
MPI_Aint extent;
MPI_Type_get_extent(MPI_A, NULL, &extent);
return 0;
}