Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-user] eclipse console eats output

Christoph,

I'd say it's a buffering issue. Try putting a fflush(stdout) at the end of the program to see if that makes any difference.

Regards,
Greg

On Dec 12, 2012, at 4:55 AM, Christoph Pospiech <Christoph.Pospiech@xxxxxxxxxx> wrote:

> Hi,
> 
> I stripped this down to a serial program with a serial run configuration. In my 
> understanding I may have stripped off all PTP parts. Hence this mailing list 
> may be the wrong place. If so, where should I post it instead ? Or any other 
> hints or comments ?
> 
> If I start the program MPI_Output as detailed below in a C/C++ run 
> configuration with arguments "4 1", I see the following output in the console 
> window.
> 
> 11 Bytes written.
> 11 Bytes written.
> 11 Bytes written.
> 11 Bytes written.
> abcdefghij
> 
> As you notice, there is only one copy of "abcdefghij". I would expect four of 
> them, as I see when starting the same executable in an ordinary bash.
> 
> cp@sirius:~/bench/DKRZ/MPI_Output/Debug_local$ pwd
> /home/cp/bench/DKRZ/MPI_Output/Debug_local
> cp@sirius:~/bench/DKRZ/MPI_Output/Debug_local$ ls
> helloa.d  helloa.o  makefile  MPI_Output  objects.mk  sources.mk  subdir.mk
> cp@sirius:~/bench/DKRZ/MPI_Output/Debug_local$ ./MPI_Output 4 1
> abcdefghij 11 Bytes written.
> abcdefghij 11 Bytes written.
> abcdefghij 11 Bytes written.
> abcdefghij 11 Bytes written.
> cp@sirius:~/bench/DKRZ/MPI_Output/Debug_local$
> 
> Here is the program.
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> 
> char buf[] = "abcdefghij";
> 
> int main(int argc, char* argv[]) {
> 	int num_bytes_written;
> 	int num_repeats = 1;
> 	int print_num_bytes = 0;
> 	int i;
> 
>    /* Inspect the command line for arguments */
>    if ( argc > 1 ) {
>    	num_repeats = atoi(argv[1]);
>    }
>    if ( argc > 2 ) {
>    	print_num_bytes = atoi(argv[2]);
>    }
> 
>    for (i=0; i<num_repeats; i++) {
>    	if (0>(num_bytes_written = write(1, buf, sizeof(buf)) )) {
>    		perror("Error in writing buffer: ");
>    	} else if (print_num_bytes) {
>    		fprintf(stderr," %d Bytes written.\n", num_bytes_written);
>    	}
>    }
> 	return EXIT_SUCCESS;
> }
> 
> -- 
> 
> 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 
> 
> _______________________________________________
> ptp-user mailing list
> ptp-user@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ptp-user



Back to the top