Derived Datatypes andRelated FeaturesSelf Test with solution
Derived Datatypes and Related Features Self Test with solution
Self Test1.You are writing a parallel program to be run on 100processors. Each processor is working with only onesection of a skeleton outline of a 3-D model of a houseIn the course of constructing the model house eachprocessor often has to send the three cartesiancoordinates (x,y,z) of nodes that are to be used to makethe boundaries between thehouse sections. Eachcoordinate will be a real value.Why would it be advantageous for you to define a new datatype called Point which contained the three coordinates?
Self Test 1. You are writing a parallel program to be run on 100 processors. Each processor is working with only one section of a skeleton outline of a 3-D model of a house. In the course of constructing the model house each processor often has to send the three cartesian coordinates (x,y,z) of nodes that are to be used to make the boundaries between the house sections. Each coordinate will be a real value. Why would it be advantageous for you to define a new data type called Point which contained the three coordinates?
Self Testa) My program will be more readable and selfcommenting.b) Since many x,y,z values will be used in MPlcommunication routines they can be sent as asingle Point type entity instead of packing andunpacking three reals each time.C)Since all three values are real, there is nopurpose in making a derived data type.d)It would be impossible to use MPl Pack andMPl Unpack to send the three real values
Self Test a) My program will be more readable and self commenting. b) Since many x,y,z values will be used in MPI communication routines they can be sent as a single Point type entity instead of packing and unpacking three reals each time. c) Since all three values are real, there is no purpose in making a derived data type. d) It would be impossible to use MPI_Pack and MPI_Unpack to send the three real values
Answera)Incorrect. Actually this is a partially correct answer.Readablity *is* an advantage but perhaps a secondaryone compared to the correct answer.b)Correct! If you find yourself repeatedly transferring a setof data, make it your own derived datatype.C)Incorrect. Matter of opinion. You could make a pointarray containing three reals, but that is an awkward wayto handle the problem and does not take advantage ofMPI capabilities.d)Incorrect. In fact MPl Pack and MPI Unpack are themost versatile routines for transferring any sort ofheterogenous data
Answer a) Incorrect. Actually this is a partially correct answer. Readablity *is* an advantage but perhaps a secondary one compared to the correct answer. b) Correct! If you find yourself repeatedly transferring a set of data, make it your own derived datatype. c) Incorrect. Matter of opinion. You could make a point array containing three reals, but that is an awkward way to handle the problem and does not take advantage of MPI capabilities. d) Incorrect. In fact MPI_Pack and MPI_Unpack are the most versatile routines for transferring any sort of heterogenous data
Self Test2.What is the simplest MPI derived datatypecreation function to make the Point datatypedescribed in problem1?(Three of the answersgiven can actually be used to construct the type,but one is the simplest)MPI TYPE CONTIGUOUSa)b) MPI_TYPE_VECTORMPI TYPE STRUCTC)d) MPI_TYPE_COMMIT
Self Test 2. What is the simplest MPI derived datatype creation function to make the Point datatype described in problem 1? (Three of the answers given can actually be used to construct the type, but one is the simplest). a) MPI_TYPE_CONTIGUOUS b) MPI_TYPE_VECTOR c) MPI_TYPE_STRUCT d) MPI_TYPE_COMMIT