MPICH on Lazarus lazarus / 13-General ---------------------------------------------------------------------- loro51 · 2008-01-28 21:06 Dear All,    I'm trying to use the MPICH Lazarus package and creat a simple program on wich the NODE 0 prints a message asking for the INPUT and send it to all nodes via MPI_Send, but What happens is that on the Win CMD console I get FIRST the ReadLn and After the WriteLn.   I believe that it is a BUFFER problem that I can't see, does any one done something like this?    Just to know I'm using an Win 2K with Lazarus v0.9.24 beta. The package MPICH2 is correctly installed, once the "helloworld.exe" worked well.    Here is the code: Code: [Select] program ExchangeNum; {$mode objfpc}{$H+} {$IFDEF Unix} {$linklib c} {$ENDIF} uses MPI, MPICH2, SysUtils; var    myid, size:     integer ;    dest, source : integer ; // ID    tag:               integer ;    MSG:             double  ;        Status:        MPI_Status ;   begin   tag:= 50 ;     MPI_Init(@argc, @argv);   MPI_Comm_rank(MPI_COMM_WORLD, @myid);   MPI_Comm_size(MPI_COMM_WORLD, @size);     If (myid = 0) then begin      WriteLn('Write the MSG (double)');      Readln(MSG);      WriteLn('NODE ',myid, ' MSG = ',MSG:2:5);      For dest:= 1 to (size-1) do           MPI_Send(@MSG, SizeOf(MSG), MPI_FLOAT, dest, tag, MPI_COMM_WORLD);   End   Else begin        source:=0;        MPI_Recv(@MSG, SizeOf(MSG), MPI_FLOAT, source, tag, MPI_COMM_WORLD, @status);        Writeln('NODE ',myid, ' MPI_Recv = ',MSG:2:5);   End;         MPI_Finalize; end.                 the command on the CMD is: mpiexec -n 4 \\MASTER\ExchangeNum\ExchangeNum.exe Thanks ---------------------------------------------------------------------- loro51 · 2008-01-29 21:12 As you probably can see it is missing something Code: [Select]    WriteLn(StdOut, 'Write the MSG (double)');    Flush(StdOut);    ReadLn(MSG); Every time I write a WriteLn it is necessary to Flush all the information from the Buffer, besides onusing the WriteLn it is necessary to set what is the Text so that the buffer can go to. Here it is used the StdOut. Hugs