Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

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