Re: [OMPI users] MPI_AllGather null terminator character

2012-01-31 Thread Gabriele Fatigati
Ok Jeff, thanks very much for your support! Regards, 2012/1/31 Jeff Squyres > On Jan 31, 2012, at 3:59 AM, Gabriele Fatigati wrote: > > > I have very interesting news. I recompiled OpenMPI 1.4.4 enabling the > memchecker. > > > > Now the warning on strcmp is disappeared also without buffers > i

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-31 Thread Jeff Squyres
On Jan 31, 2012, at 3:59 AM, Gabriele Fatigati wrote: > I have very interesting news. I recompiled OpenMPI 1.4.4 enabling the > memchecker. > > Now the warning on strcmp is disappeared also without buffers initializations > using memset! > > So the warning is a false positive? My simple code

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-31 Thread Gabriele Fatigati
Dear Jeff, I have very interesting news. I recompiled OpenMPI 1.4.4 enabling the memchecker. Now the warning on strcmp is disappeared also without buffers initializations using memset! So the warning is a false positive? My simple code is safe? Thanks. 2012/1/28 Jeff Squyres > On Jan 28, 201

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-28 Thread Jeff Squyres
On Jan 28, 2012, at 5:22 AM, Gabriele Fatigati wrote: > I had the same idea so my simple code I have already done calloc and memset .. > > The same warning still appear using strncmp that should exclude uninitialized > bytes on hostnam_recv_buf :( Bummer. > My apologize for being so insistent,

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-28 Thread Gabriele Fatigati
HI Jeff, I had the same idea so my simple code I have already done calloc and memset .. The same warning still appear using strncmp that should exclude uninitialized bytes on hostnam_recv_buf :( My apologize for being so insistent, but I would understand if there is some bug in MPI_Allgather, st

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-27 Thread Jeff Squyres
Ah, I have an idea what might be happening here: I believe that valgrind is actually pretty smart. If you have a buffer of size 128, and gethostname() only fills in, say, the first 32 bytes (including the \0), the other 128-32=96 bytes are uninitialized. You can MPI_Allgather these, in which c

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-27 Thread Gabriele Fatigati
Dear Ralph, thanks for the suggest, but doesn't solve the problem :( The warning still exists. 2012/1/27 Ralph Castain > I suspect that valgrind doesn't recognize that MPI_Allgather will ensure > that hostname_recv_buf is filled prior to calling strcmp. If you want to > eliminate the warning, y

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-27 Thread Ralph Castain
I suspect that valgrind doesn't recognize that MPI_Allgather will ensure that hostname_recv_buf is filled prior to calling strcmp. If you want to eliminate the warning, you should memset hostname_recv_buf to 0 so it has a guaranteed value. On Jan 27, 2012, at 6:21 AM, Gabriele Fatigati wrote:

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-27 Thread Gabriele Fatigati
Hi Jeff, yes, very stupid bug in a code, but also with the correction the problem with Valgrind in strcmp remains: ==21779== Conditional jump or move depends on uninitialised value(s) ==21779==at 0x4A0898C: strcmp (mc_replace_strmem.c:711) ==21779==by 0x400BA8: main (all_gather.c:28) ==21

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-27 Thread Jeff Squyres
I see one problem: gethostname(local_hostname, sizeof(local_hostname)); That should be: gethostname(local_hostname, max_name_len); because sizeof(local_hostname) will be sizeof(void*). But if that's what you were intending, just to simulate a small hostname buffer, then be aware that

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-27 Thread Gabriele Fatigati
Sorry, this is the right code. 2012/1/27 Gabriele Fatigati > Hi Jeff, > > The problem is when I use strcmp on ALLGather buffer and Valgrind that > raise a warning. > > Please check if the attached code is right, where size(local_hostname) is > very small. > > Valgrind is used as: > > mpirun val

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-27 Thread Gabriele Fatigati
Hi Jeff, The problem is when I use strcmp on ALLGather buffer and Valgrind that raise a warning. Please check if the attached code is right, where size(local_hostname) is very small. Valgrind is used as: mpirun valgrind --leak-check=full --tool=memcheck ./all_gather and openmpi/1.4.4 compiled

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-26 Thread Jeff Squyres
I'm not sure what you're asking. The entire contents of hostname[] will be sent -- from position 0 to position (MAX_STRING_LEN-1). If there's a \0 in there, it will be sent. If the \0 occurs after that, then it won't. Be aware that get_hostname(buf, size) will not put a \0 in the buffer if

Re: [OMPI users] MPI_AllGather null terminator character

2012-01-26 Thread Gabriele Fatigati
Dear OpenMPi users/developers, anybody can help about such problem? 2012/1/13 Gabriele Fatigati > Dear OpenMPI, > > using MPI_Allgather with MPI_CHAR type, I have a doubt about > null-terminated character. Imaging I want to spawn node names where my > program is running on: > > > --

[OMPI users] MPI_AllGather null terminator character

2012-01-13 Thread Gabriele Fatigati
Dear OpenMPI, using MPI_Allgather with MPI_CHAR type, I have a doubt about null-terminated character. Imaging I want to spawn node names where my program is running on: char hostname[MAX_LEN]; char* hostname_recv_buf=(char*)calloc(num_procs*(MAX_STRING_