我是MPI编程的新手,很难学习,直到通过定义结构创建Derived数据类型我才成功.现在我想在我的结构中包含Vector,并希望在整个Process中发送数据.对于前:
struct Structure{
//Constructor
Structure(): X(nodes),mass(nodes),ac(nodes) {
//code to calculate the mass and accelerations
}
//Destructor
Structure() {}
//Variables
double radius;
double volume;
vector<double> mass;
vector<double> area;
//and some other variables
//Methods to calculate some physical properties
Run Code Online (Sandbox Code Playgroud)
现在使用MPI我想在整个过程中发送结构中的数据.我可以创建包含的MPI_type_struct向量并发送数据吗?
我尝试通过论坛阅读,但我无法从那里的回复中得到清晰的图片.希望我能够获得一个清晰的想法或方法来发送数据
PS:我可以单独发送数据,但是如果我们认为域非常大(比如10000*10000),那么使用MPI_Send/Recieve发送数据的开销可能是