gpt4 book ai didi

c++ - 切换到 MPI_LONG_LONG_INT 会崩溃吗?

转载 作者:太空宇宙 更新时间:2023-11-04 04:34:57 27 4
gpt4 key购买 nike

我有以下代码,将所有进程的值“全部收集”到nbodiesPerProc

int nBodies = 10;
std::vector<int> nbodiesPerProc(m_processes);
int err = MPI_Allgather(&nBodies,1,MPI_INT,&nbodiesPerProc[0], 1, MPI_INT, m_comm);

ASSERTMPIERROR(err, "gather");

一旦我将代码更改为 MPI_LONG_LONG_INT,它就开始崩溃:

std::size_t nBodies = 10;
static_assert( sizeof(std::size_t) == 8, "We send an 64bit integer");
std::vector<std::size_t> nbodiesPerProc(m_processes);
int err = MPI_Allgather(&nBodies,1,MPI_LONG_LONG_INT,&nbodiesPerProc[0]
,1, MPI_LONG_LONG_INT, m_comm);

ASSERTMPIERROR(err, "gather");

有人知道吗?我需要注册 MPI_LONG_LONG_INT 吗?

崩溃:

[zfmgpu:17069] Signal: Segmentation fault (11)
[zfmgpu:17069] Signal code: Address not mapped (1)
[zfmgpu:17069] Failing at address: 0x10
[zfmgpu:17070] *** Process received signal ***
[zfmgpu:17070] Signal: Segmentation fault (11)
[zfmgpu:17070] Signal code: Address not mapped (1)
[zfmgpu:17070] Failing at address: 0x18
[zfmgpu:17067] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7fe4626a6340]
[zfmgpu:17067] [ 1] /lib/x86_64-linux-gnu/libc.so.6(+0x981c0) [0x7fe4609641c0]
[zfmgpu:17067] [ 2] /usr/lib/libmpi.so.1(+0x10362d) [0x7fe46162d62d]
[zfmgpu:17067] [ 3] /usr/lib/libmpi.so.1(ompi_datatype_sndrcv+0x502) [0x7fe46158e392]
[zfmgpu:17067] [ 4] /usr/lib/openmpi/lib/openmpi/mca_coll_tuned.so(ompi_coll_tuned_allgather_intra_recursivedoubling+0x91) [0x7fe459aa0081]
[zfmgpu:17067] [ 5] /usr/lib/libmpi.so.1(PMPI_Allgather+0x179) [0x7fe46158f0c9]

更新:MPI_UNSIGNED_LONG_LONG 也没有帮助,这将是正确的 64 位类型

最佳答案

发现错误:

m_processes = 0

(愚蠢)

关于c++ - 切换到 MPI_LONG_LONG_INT 会崩溃吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31775299/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com