我正在尝试使用这个(http://theboostcpplibraries.com/boost.mpi-simple-data-exchange#ex.mpi_01)示例47.2来了解我自己使用valgrind运行的boost mpi代码的valgrind输出。以下代码运行正常,我得到了“99”。然而,当我用valgrind运行它时,我得到了“Syscall param write(buf)指向未初始化的字节”的投诉。
#include <boost/mpi.hpp>
#include <iostream>
int main(int argc, char *argv[])
{
boost::mpi::environment env{argc, argv};
boost::mpi::communicator world;
if (world.rank() == 0)
{
int i;
world.recv(1, 16, i);
std::cout << i << '\n';
}
else if (world.rank() == 1)
{
world.send(0, 16, 99);
}
}
Syscall param write(buf) points to uninitialised byte(s)
at 0x37BEA0E6FD: ??? (in /lib64/libpthread-2.12.so)
.......
by 0x409B70: main (e47.2.cpp:6)
Address 0x7feffec48 is on thread 1's stack
.......