Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] MPI_AllGather null terminator character
From: Gabriele Fatigati (g.fatigati_at_[hidden])
Date: 2012-01-26 04:13:03


Dear OpenMPi users/developers,

anybody can help about such problem?

2012/1/13 Gabriele Fatigati <g.fatigati_at_[hidden]>

> 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_LEN),(sizeof(char)));
>
> MPI_Allgather(hostname, MAX_STRING_LEN, MPI_CHAR, hostname_recv_buf,
> MAX_STRING_LEN, MPI_CHAR, MPI_COMM_WORLD);
>
> ----------------------------------------
>
>
> Now, is the null-terminated character of each local string included? Or I
> have to send and receive in MPI_Allgather MAX_STRING_LEN+1 elements?
>
> Using Valgrind, in a subsequent simple strcmp:
>
> for( i= 0; i< num_procs; i++){
> if(strcmp(&hostname_recv_buf[MAX_STRING_LEN*i],
> local_hostname)==0){
> ... doing something....
> }
> }
>
> raise a warning:
>
> Conditional jump or move depends on uninitialised value(s)
> ==19931== at 0x4A06E5C: strcmp (mc_replace_strmem.c:412)
>
> The same warning is not present if I use MAX_STRING_LEN+1 in MPI_Allgather.
>
>
> Thanks in forward.
>
> --
> Ing. Gabriele Fatigati
>
> HPC specialist
>
> SuperComputing Applications and Innovation Department
>
> Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy
>
> www.cineca.it Tel: +39 051 6171722
>
> g.fatigati [AT] cineca.it
>

-- 
Ing. Gabriele Fatigati
HPC specialist
SuperComputing Applications and Innovation Department
Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy
www.cineca.it                    Tel:   +39 051 6171722
g.fatigati [AT] cineca.it