Jak utworzyć nowy typ w MPI
Jestem nowym użytkownikiem MPI i chcę stworzyć nowy typ danych dlaResidence
struct
. Chcę tylko sprawdzić, czy mogę stworzyć nowy właściwy sposób. struct Residence {double x; podwójny y; };
Mój nowy typ MPI
MPI_Datatype createRecType()
{
// Set-up the arguments for the type constructor
MPI_Datatype new_type;
int count = 2;
int blocklens[] = { 1,1 };
MPI_Aint indices[2];
//indices[0]=0;
MPI_Type_extent( MPI_DOUBLE, &indices[0] );
MPI_Type_extent( MPI_DOUBLE, &indices[1] );
MPI_Datatype old_types[] = {MPI_DOUBLE,MPI_DOUBLE};
MPI_Type_struct(count,blocklens,indices,old_types,&new_type);
MPI_Type_commit(&new_type);
}