0

我的基本问题是关于抑制文件如何在 valgrind 中工作。我查看了很多文档,这些文档指向在 mpi 版本 > 1.5(我的是 1.6)上使用以下内容:

    mpirun -np 2 valgrind --suppressions=/usr/share/openmpi/openmpi-valgrind.supp --track-origins=yes ./myprog

但是,当我这样运行它时,文件有超过 600 个错误!我得到的错误是这两个一遍又一遍。以我目前对 valgrind 和 mpi 的理解,我不知道如何解释其中任何一个。

==8821==  Address 0xad5e4d7 is 87 bytes inside a block of size 128 alloc'd
==8821==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8821==    by 0x6348C52: ??? (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
==8821==    by 0x6349AF1: ??? (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
==8821==    by 0x6349B81: ??? (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
==8821==    by 0x7DA5B9C: ??? (in /usr/lib/openmpi/lib/openmpi/mca_grpcomm_bad.so)
==8821==    by 0x7DA52F4: ??? (in /usr/lib/openmpi/lib/openmpi/mca_grpcomm_bad.so)
==8821==    by 0x5082AF2: ??? (in /usr/lib/openmpi/lib/libmpi.so.0.0.2)
==8821==    by 0x50A33FA: PMPI_Init (in /usr/lib/openmpi/lib/libmpi.so.0.0.2)
==8821==    by 0x408AB5: main (test_send-receive.cpp:8)
==8821==  Uninitialised value was created by a heap allocation
==8821==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8821==    by 0x635FE2B: ??? (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
==8821==    by 0x6360634: opal_ifcount (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
==8821==    by 0x81B36AA: ??? (in /usr/lib/openmpi/lib/openmpi/mca_oob_tcp.so)
==8821==    by 0x5C01EE2: mca_oob_base_init (in /usr/lib/openmpi/lib/libopen-rte.so.0.0.0)
==8821==    by 0x7FA97FB: ??? (in /usr/lib/openmpi/lib/openmpi/mca_rml_oob.so)
==8821==    by 0x5C083E4: orte_rml_base_select (in /usr/lib/openmpi/lib/libopen-rte.so.0.0.0)
==8821==    by 0x5BF5EC4: orte_ess_base_app_setup (in /usr/lib/openmpi/lib/libopen-rte.so.0.0.0)
==8821==    by 0x7BA1EAE: ??? (in /usr/lib/openmpi/lib/openmpi/mca_ess_env.so)
==8821==    by 0x5BDDB72: orte_init (in /usr/lib/openmpi/lib/libopen-rte.so.0.0.0)
==8821==    by 0x50822E0: ??? (in /usr/lib/openmpi/lib/libmpi.so.0.0.2)
==8821==    by 0x50A33FA: PMPI_Init (in /usr/lib/openmpi/lib/libmpi.so.0.0.2)

产生这些错误的代码是:

int main(int argc, char *argv[]) {

  /* init MPI */
  MPI_Init(&argc, &argv);

  int myid;
  MPI_Comm_rank(MPI_COMM_WORLD, &myid);
  int i;
  if(myid == 0){
    double * d = new double [10];
    for(i = 0; i<10; i++){
      d[i] = i + 1.0;
    }
    MPI_Send(d,
             10,
         MPI_DOUBLE,
         1,
         1,
         MPI_COMM_WORLD);
    delete[] d;
  } else {
    MPI_Status status;
    double * c = new double [10];
    MPI_Recv(c,
         10,
         MPI_DOUBLE,
             0,
         MPI_ANY_TAG,
         MPI_COMM_WORLD,
         &status);

    for(i = 0; i<10; i++){
      printf("%f\n", c[i]);
    }
    delete[] c;
  }
  MPI_Finalize();
  return 0;
    }

此外,此代码运行良好并输出预期结果。我是否误解了数据是如何通过网络发送的,还是这里发生了我不明白的其他事情?

很抱歉这篇文章的长度,你们甚至为读到这里而感到震惊。

4

1 回答 1

1

很有可能我们的抑制文件在 OMPI v1.6 中不是最新的。:-\

您应该在 OMPI 邮件列表中报告此情况。请参阅http://www.open-mpi.org/community/lists/ompi.php

于 2012-07-08T14:47:11.363 回答