MPI 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is the purpose of MPI derived types?

Enables communicatio of non-contiguous data, or different datatypes with a single MPI call Makes code more compact and maintainable Makes communication of non-contiguous data more efficient

How do you define a new datatype? Basic example.

MPI_Datatype newType; MPI_Type_vector(nBlocks, lengthOfBlock, strideBetweenBlocks, typeInBlocks, &newType); MPI_Type_commit(&new_type); //ur code MPI_Type_Free(&newType);

What is the signature for the indexed datatype?

MPI_Type_indexed(numBlocks, lengthOfEachBlock, displacmentOfEachBlock, baseType, &NewType); LengthOfEachBlock and displacementofEachBlock are arrays and should be the same length as numBlocks

What is the indexed datatype good for?

When you want to send data from a buffer of different block lengths at irregular displacements. Can be used to accomplish what the vector and contiguous type can do, but is slightly more complicated.

What are the signatures for creating a cartesian type? What does each type do?

int MPI_Cart_create(MPI_Comm comm_old, int ndims, int *dims,int *periods, int reorder, MPI_Comm *comm_cart); comm_old - input communicator ndims - number of dimensions of cartesian grid dims - integer array of size ndims specficying the number of processes in each dimension periods - logical array of size ndims specifying whether the grid is periodic (true) or not (false) in each dimension reorder - ranking may. be reodered (true) or not (false_ comm_cart (out) - new communicator

How do you find the resulting source and destination rank given a shift direction and amount?

int MPI_Cart_shift( MPI_Comm comm, int direction, int displ, int *source, int *dest) For direction, 0 is horizontal and 1 is vertical.

What are cartesian topologies?

they organize processes into a grid/mesh that simplifies comunication in applications. Allows you to think of processes as squares, cubes ,etc

What is the vector derived type good for?

when you want to send data that is not contiguous in memory. However, each block you send needs to be the same distance from every other block.

How do you determine which rank to send to in a cartesian type?

Sending and receiving requires one-dim ranks. MPI provides the following to convert ranks to coordinates: int MPI_Cart_coord(MPI_Comm comm_cart, int rank, int maxdims, int *coords) and the following to convert coordinates to ranks: int MPI_Cart_rank(MPI_Comm comm_cart, int *coords, int *rank)

What is the contiguous data type good for?

Sending data that is already contiguous in memory. The advantage here is readability.

What are some advantages of cartesian topologies?

They have inherent information about their neighbors, which reduces coding complexity. MPI can reorder processes that message each other frequently. Programs can scale more effieciently. Can handle edge wrapping automatically Improved code maintainability and readability.


Ensembles d'études connexes

AICE Business Unit 3 Multiple Choice

View Set

152 TEST 2 (Culture & Family Dynamics)

View Set

Chapter 15 Caring for the Postpartal woman

View Set

U.S. History Semester 1 Final Exam Review

View Set