Newsgroups: comp.parallel.mpi
From: Pasha <cuno@bimacs.biu.ac.il>
Subject: Re: MPICH: how to redirect stdout from separate executables?
Organization: Bar-Ilan University
Date: Fri, 24 Nov 1995 15:23:51 +0200
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <30B5C767.2430@bimacs.biu.ac.il>

If I understood correctly you want to get some kind of report
files from each of processors your program is running on. I am 
talking about the SPMD approach.
Here is the function, I wrote : 

--------------------------------------
extern int ntasks, myid;

void proc_report(char *formatStr, ...)
  {
     char file_name[MAX_FILE_NAME];
     va_list argList;
  
     FILE *buf;
 
     sprintf(file_name, "task.%d", myid);
     buf = fopen (file_name, "a+");
 
     va_start(argList,formatStr);
     vfprintf(buf, formatStr, argList);
     va_end(argList);
 
     fclose(buf);    
  }
---------------------------------------
Now you may use the proc_report(...) function exactly
as you are using the printf() function. But now it will produce 
an output file task.id , where id is the number of the processor
printed out your information. I am using it as a function for 
printing any kind of debug information while running MPICH programs.
Hope it will help.

			Yours, Paul

