Hans,
here is attached a simplified version of your second.c test program that
works.
i noticed that anz variable is not initialized,
also, your program is incorrect from an MPI point of view.
the program fails on my RHEL7 like box, with both OpenMPI and MPICH.
Cheers,
Gilles
On 3/5/2016 7:35 PM, Hans-Jürgen Greif wrote:
Hello,
on mac os 10.11.3 I have found an error:
mpirun -np 2 valgrind ./second
==612== Memcheck, a memory error detector
==612== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==612== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==612== Command: ./second
==612==
==611== Memcheck, a memory error detector
==611== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==611== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==611== Command: ./second
==611==
--612-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option
--611-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option
--612-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated
2 times)
--611-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated
2 times)
--611-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated
4 times)
--612-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated
4 times)
--611-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated
8 times)
--612-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated
8 times)
==612== Conditional jump or move depends on uninitialised value(s)
==611== Conditional jump or move depends on uninitialised value(s)
==611== at 0x100000BED: main (second.c:39)
==611==
==612== at 0x100000D1C: main (second.c:60)
==612==
==611== Conditional jump or move depends on uninitialised value(s)
==611== at 0x100060781: MPI_Win_post (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x100000C69: main (second.c:43)
==611==
==611== Conditional jump or move depends on uninitialised value(s)
==611== at 0x100413E98: __ultoa (in /usr/lib/system/libsystem_c.dylib)
==611== by 0x10041136C: __vfprintf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x1004396C8: __v2printf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x10040EF51: _vasprintf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x1001C379E: opal_show_help_vstring (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x100128231: orte_show_help (in
/usr/local/openmpi/lib/libopen-rte.12.dylib)
==611== by 0x10002069E: backend_fatal (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000203EC: ompi_mpi_errors_are_fatal_comm_handler (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000201BD: ompi_errhandler_invoke (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x100000C69: main (second.c:43)
==611==
==611== Conditional jump or move depends on uninitialised value(s)
==611== at 0x100413F06: __ultoa (in /usr/lib/system/libsystem_c.dylib)
==611== by 0x10041136C: __vfprintf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x1004396C8: __v2printf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x10040EF51: _vasprintf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x1001C379E: opal_show_help_vstring (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x100128231: orte_show_help (in
/usr/local/openmpi/lib/libopen-rte.12.dylib)
==611== by 0x10002069E: backend_fatal (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000203EC: ompi_mpi_errors_are_fatal_comm_handler (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000201BD: ompi_errhandler_invoke (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x100000C69: main (second.c:43)
==611==
==611== Conditional jump or move depends on uninitialised value(s)
==611== at 0x100413F71: __ultoa (in /usr/lib/system/libsystem_c.dylib)
==611== by 0x10041136C: __vfprintf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x1004396C8: __v2printf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x10040EF51: _vasprintf (in
/usr/lib/system/libsystem_c.dylib)
==611== by 0x1001C379E: opal_show_help_vstring (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x100128231: orte_show_help (in
/usr/local/openmpi/lib/libopen-rte.12.dylib)
==611== by 0x10002069E: backend_fatal (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000203EC: ompi_mpi_errors_are_fatal_comm_handler (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000201BD: ompi_errhandler_invoke (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x100000C69: main (second.c:43)
==611==
==611== Conditional jump or move depends on uninitialised value(s)
==611== at 0x10000B359: strlen (vg_replace_strmem.c:470)
==611== by 0x10019922D: opal_dss_pack_string (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x100198CFD: opal_dss_pack (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x100128633: orte_show_help_norender (in
/usr/local/openmpi/lib/libopen-rte.12.dylib)
==611== by 0x100128249: orte_show_help (in
/usr/local/openmpi/lib/libopen-rte.12.dylib)
==611== by 0x10002069E: backend_fatal (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000203EC: ompi_mpi_errors_are_fatal_comm_handler (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000201BD: ompi_errhandler_invoke (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x100000C69: main (second.c:43)
==611==
==611== Thread 2:
==611== Syscall param write(buf) points to uninitialised byte(s)
==611== at 0x10051C9FE: write (in
/usr/lib/system/libsystem_kernel.dylib)
==611== by 0x1012C9926: send_bytes (in
/usr/local/openmpi/lib/openmpi/mca_oob_tcp.so)
==611== by 0x1012C916F: mca_oob_tcp_send_handler (in
/usr/local/openmpi/lib/openmpi/mca_oob_tcp.so)
==611== by 0x1001CDC10: opal_libevent2021_event_base_loop (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x10013BC6C: orte_progress_thread_engine (in
/usr/local/openmpi/lib/libopen-rte.12.dylib)
==611== by 0x10066CC12: _pthread_body (in
/usr/lib/system/libsystem_pthread.dylib)
==611== by 0x10066CB8F: _pthread_start (in
/usr/lib/system/libsystem_pthread.dylib)
==611== by 0x10066A374: thread_start (in
/usr/lib/system/libsystem_pthread.dylib)
==611== Address 0x101c7f7cd is 157 bytes inside a block of size 512
alloc'd
==611== at 0x100009D5A: realloc (vg_replace_malloc.c:789)
==611== by 0x100197E32: opal_dss_buffer_extend (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x10019926B: opal_dss_pack_string (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x100198CFD: opal_dss_pack (in
/usr/local/openmpi/lib/libopen-pal.13.dylib)
==611== by 0x100128633: orte_show_help_norender (in
/usr/local/openmpi/lib/libopen-rte.12.dylib)
==611== by 0x100128249: orte_show_help (in
/usr/local/openmpi/lib/libopen-rte.12.dylib)
==611== by 0x10002069E: backend_fatal (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000203EC: ompi_mpi_errors_are_fatal_comm_handler (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x1000201BD: ompi_errhandler_invoke (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==611== by 0x100000C69: main (second.c:43)
==611==
[alpha:611] *** An error occurred in MPI_Win_post
[alpha:611] *** reported by process [122543980675073,1095216660480]
[alpha:611] *** on communicator MPI_COMM_WORLD
[alpha:611] *** MPI_ERR_WIN: invalid window
[alpha:611] *** MPI_ERRORS_ARE_FATAL (processes in this communicator
will now abort,
[alpha:611] *** and potentially your MPI job)
--611:0:schedule VG_(sema_down): read returned -4
==611==
==611== HEAP SUMMARY:
==611== in use at exit: 2,644,595 bytes in 7,919 blocks
==611== total heap usage: 13,035 allocs, 5,116 frees, 3,399,345
bytes allocated
==611==
==611== LEAK SUMMARY:
==611== definitely lost: 680 bytes in 16 blocks
==611== indirectly lost: 24 bytes in 1 blocks
==611== possibly lost: 0 bytes in 0 blocks
==611== still reachable: 2,621,733 bytes in 7,710 blocks
==611== suppressed: 22,158 bytes in 192 blocks
==611== Rerun with --leak-check=full to see details of leaked memory
==611==
==611== For counts of detected and suppressed errors, rerun with: -v
==611== Use --track-origins=yes to see where uninitialised values come
from
==611== ERROR SUMMARY: 75 errors from 7 contexts (suppressed: 0 from 0)
==612==
==612== Process terminating with default action of signal 15 (SIGTERM)
==612== at 0x10002E490: ompi_request_default_wait_all (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==612== by 0x101446397:
ompi_coll_tuned_allreduce_intra_recursivedoubling (in
/usr/local/openmpi/lib/openmpi/mca_coll_tuned.so)
==612== by 0x10001CA18: ompi_comm_allreduce_intra (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==612== by 0x10001C829: ompi_comm_nextcid (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==612== by 0x10001B55E: ompi_comm_dup_with_info (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==612== by 0x10140B8B1: component_select (in
/usr/local/openmpi/lib/openmpi/mca_osc_pt2pt.so)
==612== by 0x100032FE5: ompi_win_create (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==612== by 0x10005F1FF: MPI_Win_create (in
/usr/local/openmpi/lib/libmpi.12.dylib)
==612== by 0x100000D75: main (second.c:62)
==612==
==612== HEAP SUMMARY:
==612== in use at exit: 2,589,509 bytes in 7,918 blocks
==612== total heap usage: 12,962 allocs, 5,044 frees, 3,252,656
bytes allocated
==612==
==612== LEAK SUMMARY:
==612== definitely lost: 210,011 bytes in 92 blocks
==612== indirectly lost: 279,210 bytes in 6,023 blocks
==612== possibly lost: 53,392 bytes in 9 blocks
==612== still reachable: 2,024,738 bytes in 1,602 blocks
==612== suppressed: 22,158 bytes in 192 blocks
==612== Rerun with --leak-check=full to see details of leaked memory
==612==
==612== For counts of detected and suppressed errors, rerun with: -v
==612== Use --track-origins=yes to see where uninitialised values come
from
==612== ERROR SUMMARY: 14 errors from 1 contexts (suppressed: 0 from 0)
The program second.c runs well on opensuse 13.3.
Hans-Jürgen Greif
hans_juergen.gr...@kabelbw.de <mailto:hans_juergen.gr...@kabelbw.de>
_______________________________________________
users mailing list
us...@open-mpi.org
Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
Link to this post:
http://www.open-mpi.org/community/lists/users/2016/03/28638.php
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// #include
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/machine/types.h"
#define comm MPI_COMM_WORLD
#define MAX 2
double *puffer;
double Ergebnis[MAX];
//using namespace std;
int main(int argc, char **argv )
{
int i, j, rank, size, info, anz=1, ndat = MAX;
MPI_Group group;
MPI_Status status;
MPI_Init( & argc, & argv );
MPI_Comm_rank(comm, & rank);
MPI_Comm_size(comm, & size);
MPI_Comm_group(comm, & group);
MPI_Win win;
//printf(" print %s \n", group);
/* Öffne für jeden Sklaven ein Fenster */
MPI_Alloc_mem(MAX*sizeof(double), MPI_INFO_NULL, &puffer);
MPI_Win_create( &puffer, MAX*sizeof(double), sizeof(double), MPI_INFO_NULL,
comm, &win);
MPI_Win_post( group, 0, win); /* Freigabe des Fensters */
MPI_Win_start(group, 0, win);
MPI_Barrier(MPI_COMM_WORLD);
/* Mastertask */
if ( rank == 0 )
{
i=0;
for(j=1; j< anz; j++)
{ /* Überprüfe welches Fenster frei ist */
for(info=0;!info;i = i%(anz-1)+1)
MPI_Win_test(win, &info);
//Arbeite(&puffer[i],ndat);
/* Daten in puffer[i] sind freigeben */
}
}
else
{
for(i=1;i< anz;i++)
MPI_Put(Ergebnis, ndat, MPI_DOUBLE, 0, 0, ndat, MPI_DOUBLE, win);
/* Blockierende Freigabe des Fensters */
}
MPI_Win_complete( win );
MPI_Win_wait( win );
MPI_Win_free( &win ); /* Schließen des Fensters */
return 0;
}