<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hi, <span style="font-size:12.8000001907349px">Hajime,</span><div><span style="font-size:12.8000001907349px"> MPI spec also says "</span>valuelen is the number of characters available in value". So it seems if you should pass valuelen = 4 if value is a buffer of 4 bytes.</div><div> I am also confused by "In C, valuelen should be one less than the amount of allocated space to allow for the null terminator". So I leave the question for others.</div><div> Interestingly, for MPI_Info_get_valuelen(), MPI spec says "The length returned in C does not include the end-of-string". </div>
<div><br></div><div> BTW, I found MPICH and OpenMPI have the same behavior. </div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div>
<br><div class="gmail_quote">On Sun, Feb 1, 2015 at 12:13 AM, Hajime Fujita <span dir="ltr"><<a href="mailto:hfujita@uchicago.edu" target="_blank">hfujita@uchicago.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I came across some question about a behavior of MPI_Info_get in MPICH.<br>
<br>
If I knew the size of the value, what should I pass to MPI_Info_get as `valuelen`?<br>
Suppose I have 3-byte value in the info object, and I allocate 4-byte buffer including a space for null-termination. Then I think I should specify 3 as valuelen to retrieve the whole value, as the MPI-3 specifications says<br>
"In C, valuelen should be one less than the amount of allocated space to allow for the null terminator.”<br>
<br>
However, when I run the attached program in MPICH 3.1.1, I get:<br>
$ ./test<br>
key found: vaule=va # The last character ‘l’ is missing<br>
<br>
If I specify `sizeof(buff)` as valuelen, it shows “val” correctly.<br>
<br>
So apparently MPICH thinks valuelen includes null terminator.<br>
Am I missing anything, or any misunderstanding here?<br>
<br><br>
<br>
Thank you in advance,<br>
Hajime<br>
<br>
--<br>
Hajime Fujita<br>
Postdoctoral Scholar, Large-Scale Systems Group<br>
Department of Computer Science, The University of Chicago<br>
<a href="http://www.cs.uchicago.edu/people/hfujita" target="_blank">http://www.cs.uchicago.edu/people/hfujita</a><br>_______________________________________________<br>
discuss mailing list <a href="mailto:discuss@mpich.org">discuss@mpich.org</a><br>
To manage subscription options or unsubscribe:<br>
<a href="https://lists.mpich.org/mailman/listinfo/discuss" target="_blank">https://lists.mpich.org/mailman/listinfo/discuss</a><br></blockquote></div><br></div>