On Saturday, December 15, 2012 12:00:07 Greg Watson wrote:
> Christoph,
>
> Good point. There are a lot of factors involved in getting the output to the
> Eclipse console, which I won't go into here. Suffice to say that combining
> both buffered and un-buffered I/O in this way is bound to cause issues like
> this. You could try using printf or fputc instead of write to confirm.
>
> Regards,
> Greg
Greg,
kudos to my IBM colleagues at MPI development. Concurrently to this PTP discussion thread there was also a bug report filed against IBM PE with identical test case and title "poe eats output".
MPI development identified the terminating ASCII \0 as the root cause - poe hits the first \0 and thinks stdout is done.
I tried the same thing for Eclipse PTP console by adding the following change to my test program.
----------------------------------
diff --git a/helloa.c b/helloa.c
index 927d701..7d5e521 100644
--- a/helloa.c
+++ b/helloa.c
@@ -7,6 +7,7 @@
int main(int argc, char* argv[]) {
int num_bytes_written;
int num_repeats = 1;
+ int num_bytes = sizeof(buf) - 1;
int print_num_bytes = 0;
int i;
@@ -19,7 +20,7 @@
}
for (i=0; i<num_repeats; i++) {
- if (0>(num_bytes_written = write(1, buf, sizeof(buf)) )) {
+ if (0>(num_bytes_written = write(1, buf, num_bytes) )) {
perror("Error in writing buffer: ");
} else if (print_num_bytes) {
fprintf(stderr," %d Bytes written.\n", num_bytes_written);
This fixes the error for Eclipse as well. - I am now getting the following console output - as expected.
abcdefghij 10 Bytes written.
abcdefghij 10 Bytes written.
abcdefghij 10 Bytes written.
abcdefghij 10 Bytes written.
Question - do we treat this as a bug for the Eclipse console ? The same thing was considered a bug for IBM PE stdout handling. If so, can someone point me to the exact place where should I file a bug ?
--
Mit freundlichen Grüßen / Kind regards
Dr. Christoph Pospiech
High Performance & Parallel Computing
Phone: +49-351 86269826
Mobile: +49-171-765 5871
E-Mail: christoph.pospiech@xxxxxxxxxx
-------------------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland GmbH / Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Martina Koederitz (Vorsitzende), Reinhard Reschke, Dieter Scholz, Gregor Pillen, Joachim Heel, Christian Noll
Sitz der Gesellschaft: Ehningen / Registergericht: Amtsgericht Stuttgart, HRB 14562 / WEEE-Reg.-Nr. DE 99369940
|