我是 MPI 编程的新手,仍然在学习,在通过定义结构创建派生数据类型之前我是成功的。现在我想在我的结构中包含 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
现在使用 MPI,我想跨进程发送结构中的数据。我可以创建包含的 MPI_type_struct 向量并发送数据吗?
我尝试通过论坛阅读,但我无法从那里给出的回复中获得清晰的画面。希望我能有一个清晰的想法或方法来发送数据
PS:我可以单独发送数据,但是如果我们认为域非常大(比如 10000*10000),使用 MPI_Send/Recieve 发送数据的开销会很大