Custom datatype (MPI_Datatype datatype)?

青春壹個敷衍的年華 提交于 2021-01-29 06:09:45

问题


Is there such a thing as a custom datatype in MPI, or do you have to flatten everything into a text string and pass as MPI_CHAR? If you are required to flatten everything, is there a built-in function I am overlooking?


回答1:


The answer is MPI_Type_contiguous (the link is to the documentation). It allows you to block out a specific amount of space based on basic data types, and their respective offsets.




回答2:


A much better answer is MPI_Type_create_struct. It allows you to replicate your struct datatype and pass it around, there is a great example of it's use at DeinoMPI.



来源:https://stackoverflow.com/questions/10066628/custom-datatype-mpi-datatype-datatype

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!