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

Reply via email to