Я пишу параллельный код на C ++ на моем ноутбуке с OS X (Snow Leopard) и пытаюсь отладить его с помощью memchecker. Я успешно построил OpenMPI с поддержкой valgrind с: configure --prefix=/opt/openmpi-1.4.3/ --enable-debug --enable-memchecker --with-valgrind=/opt/valgrind-3.6.0/ FFLAGS=-m64 F90FLAGS=-m64
(игнорировать флаги Fortran, это из-за моего компилятора Fortran из GCC).
Когда я запускаю свое приложение с
mpirun -np 2 valgrind --suppressions = / opt / openmpi-1.4.3 / share / openmpi / openmpi-valgrind.supp --leak-check = yes --dsymutil = yes ./program
Я получаю множество предупреждений от Вальгринда (большинство из них в конце кучи). Я включил небольшой фрагмент предупреждений ниже. Что я получил от них, так это то, что Valgrind обнаруживает утечки памяти и неинициализированные значения в библиотеке MPI, но меня это не особо интересует. Я хочу предупреждения из кода, который я пишу. Я уже запускаю Valgrind с файлом подавления, предоставленным OpenMPI, но, очевидно, этого недостаточно. Как я могу легко игнорировать все другие предупреждения, обнаруженные в дистрибутиве OpenMPI? Можно ли найти файл подавления для отладки OpenMPI с Valgrind на OS X, или вы знаете какой-нибудь хитрый трюк?
Первое предупреждение
==1531== Syscall param writev(vector[...]) points to uninitialised byte(s)
==1531== at 0x1014E16E2: writev (in /usr/lib/libSystem.B.dylib)
==1531== by 0x101AEA4C5: mca_oob_tcp_peer_send (in /opt/openmpi-1.4.3/lib/openmpi/mca_oob_tcp.so)
==1531== by 0x101AF0B88: mca_oob_tcp_send_nb (in /opt/openmpi-1.4.3/lib/openmpi/mca_oob_tcp.so)
==1531== by 0x101AC7F48: orte_rml_oob_send (in /opt/openmpi-1.4.3/lib/openmpi/mca_rml_oob.so)
==1531== by 0x101AC8AA1: orte_rml_oob_send_buffer (in /opt/openmpi-1.4.3/lib/openmpi/mca_rml_oob.so)
==1531== by 0x101B3489E: allgather (in /opt/openmpi-1.4.3/lib/openmpi/mca_grpcomm_bad.so)
==1531== by 0x101B3525D: modex (in /opt/openmpi-1.4.3/lib/openmpi/mca_grpcomm_bad.so)
==1531== by 0x1000A48E6: ompi_mpi_init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x1000F7806: MPI_Init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100001AF2: main (main.cpp:34)
==1531== Address 0x101a8911b is 107 bytes inside a block of size 256 alloc'd
==1531== at 0x10002DB2D: realloc (vg_replace_malloc.c:525)
==1531== by 0x1012240B6: opal_dss_buffer_extend (in /opt/openmpi-1.4.3/lib/libopen- pal.0.dylib)
==1531== by 0x101225CF7: opal_dss_copy_payload (in /opt/openmpi-1.4.3/lib/libopen-pal.0.dylib)
==1531== by 0x101B347CA: allgather (in /opt/openmpi-1.4.3/lib/openmpi/mca_grpcomm_bad.so)
==1531== by 0x101B3525D: modex (in /opt/openmpi-1.4.3/lib/openmpi/mca_grpcomm_bad.so)
==1531== by 0x1000A48E6: ompi_mpi_init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x1000F7806: MPI_Init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100001AF2: main (main.cpp:34)
После выполнения небольшой фрагмент резюме кучи выглядит следующим образом
==1531== 88 bytes in 1 blocks are definitely lost in loss record 1,950 of 2,194
==1531== at 0x10002D915: malloc (vg_replace_malloc.c:236)
==1531== by 0x100073888: opal_obj_new (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073808: opal_obj_new_debug (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073C17: ompi_attr_create_keyval_impl (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073FCF: ompi_attr_create_keyval (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100077C96: create_comm (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x10007798A: ompi_attr_create_predefined (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x1000737CF: ompi_attr_init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x1000A4840: ompi_mpi_init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x1000F7806: MPI_Init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100001AF2: main (main.cpp:34)
...
==1531== 88 bytes in 1 blocks are definitely lost in loss record 1,952 of 2,194
==1531== at 0x10002D915: malloc (vg_replace_malloc.c:236)
==1531== by 0x100073888: opal_obj_new (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073808: opal_obj_new_debug (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073C17: ompi_attr_create_keyval_impl (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073FCF: ompi_attr_create_keyval (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x10014CEC5: PMPI_Keyval_create (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x1065ACFE6: ???
==1531== by 0x10658867B: ???
==1531== by 0x10017A591: module_init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100179985: mca_io_base_file_select (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100089D55: ompi_file_open (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x1000E1ED1: MPI_File_open (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531==
==1531== 88 bytes in 1 blocks are definitely lost in loss record 1,953 of 2,194
==1531== at 0x10002D915: malloc (vg_replace_malloc.c:236)
==1531== by 0x100073888: opal_obj_new (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073808: opal_obj_new_debug (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073C17: ompi_attr_create_keyval_impl (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x100073FCF: ompi_attr_create_keyval (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x10014CEC5: PMPI_Keyval_create (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)
==1531== by 0x1065A6210: ???
==1531== by 0x106597149: ???
==1531== by 0x106596AAB: ???
==1531== by 0x1065AD14C: ???
==1531== by 0x10658867B: ???
==1531== by 0x10017A591: module_init (in /opt/openmpi-1.4.3/lib/libmpi.0.dylib)