MPI发送RECV输入参数
MPI send recv input arguments
我对代码的这一部分有一些问题(我将其更清楚地清楚)。
//p is the number of processor (we suppose 2)
//vett is the vector who contains the elements to send
//disp is a vector whose elements are the index of the first element to send
//elem is a vector whose elements are the number of elements to send
//local_v is the destination vector (of dimension elem[rank])
//local_n is the number of elements that have to arrive (=elem[rank])
在我的情况下,周期仅执行一次
for(unsigned int i = 1; i < p; i++){
if(rank==0){
MPI_Send(&vett[disp[i]], elem[i], MPI_INT, i, 0, MPI_COMM_WORLD);
}else{
MPI_Recv(&local_v, local_n, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
}
}
processor1发送到另一个(在这种情况下,仅处理器2)。我不确定我是否正确使用mpi_send,特别是我不确定第一个输入参数是否正确...
在接收缓冲区后,MPI_Recv
中缺少[0]
,这是整个行:
MPI_Recv(&local_v[0], local_n, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
相关文章:
- 将输入参数作为右值引用传递?
- 是否可以在命令行中将输入参数传递给可执行文件
- 用户输入作为参数C++
- C++基于输入参数的动态代码生成
- 我想知道为什么"std::unique_ptr<int> foo(新 int)"是合法的,因为"std::<int>unique_ptr"要求输入参数类型应该是"int"?
- 如何使用输入参数作为文件的传递?
- 如何设置默认参数以防用户不输入另一个参数
- C++ 如何根据作为输入传递的参数调用一个构造函数或另一个构造函数?
- 在未显式传递参数时默认使用 lambda 的用户输入
- 在函数中使用运算符重载,在 c++ 中使用 const 类型输入参数
- 提供变量作为 MATLAB 系统命令的输入参数,以便C++可执行文件
- isPalindrome不显示输出,isPalindrome函数未使用字符串输入作为字符串参数进行测试
- 如何使输入文本文件成为构造函数参数?c++
- 函数的函数无法识别输入参数
- C++ Catch 是否有类似 NUnit 的测试用例的东西,具有多个参数/输入选项
- 具体参数输入
- 为什么在参数输入之前将计算放置在代码中时,计算不起作用
- C 函数通过指针通过参考与参数输入参数
- 将命令行参数输入文件传递给要分析的类
- 将命令作为参数输入到另一个应用程序