我正在尝试使用电子围栏来查找程序中的一些内存错误。我的程序使用OpenMPI,当我尝试运行它时,它会崩溃并显示以下回溯信息:
Program received signal SIGSEGV, Segmentation fault.
2001 ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: No such file or directory.
__memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2001
(gdb) bt
#0 __memcpy_ssse3_back ()
at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2001
#1 0x00007ffff72d6b7f in ompi_ddt_copy_content_same_ddt ()
from /usr/lib/libmpi.so.0
#2 0x00007ffff72d4d0d in ompi_ddt_sndrcv () from /usr/lib/libmpi.so.0
#3 0x00007ffff72dd5b3 in PMPI_Allgather () from /usr/lib/libmpi.so.0
#4 0x00000000004394f1 in ppl::gvec<unsigned int>::gvec (this=0x7fffffffdd60,
length=1) at qppl/gvec.h:32
#5 0x0000000000434a35 in TreeBuilder::TreeBuilder (this=0x7fffffffdc60,
octree=..., mygbodytab=..., mylbodytab=..., cellpool=0x7fffef705fc8,
---Type <return> to continue, or q <return> to quit---
leafpool=0x7fffef707fc8, bodypool=0x7fffef6bdfc0) at treebuild.cxx:93
#6 0x000000000042fb6b in BarnesHut::BuildOctree (this=0x7fffffffde50)
at barnes.cxx:155
#7 0x000000000042af52 in BarnesHut::Run (this=0x7fffffffde50)
at barnes.cxx:386
#8 0x000000000042b164 in main (argc=1, argv=0x7fffffffe118) at barnes.cxx:435
我的代码中相关部分如下:
代码片段:
me = spr_locale_id();
world_size = spr_num_locales();
my_elements = std::shared_ptr<T>(new T[1]);
world_element_pointers = std::shared_ptr<T*>(new T*[world_size]);
MPI_Allgather(my_elements.get(), sizeof(T*), MPI_BYTE,
world_element_pointers.get(), sizeof(T*), MPI_BYTE,
MPI_COMM_WORLD);
我不确定为什么__memcpy_ssse3_back会导致段错误。当我不使用电子围栏运行程序时,这部分程序不会发生段错误。有人知道发生了什么吗?我正在使用openmpi 1.4.3版本。
my_elements
数组发送了总共4或8个数据字节(取决于指针在你的架构中的大小),并将所有这些字节收集到一个指针数组中?!不过没关系,如果你能提供使用的Open MPI库的版本,那会有所帮助。 - Hristo Iliev