mpi and system call

From: Yves Revaz <yves.revaz_at_obs.unige.ch>
Date: Mon, 30 May 2005 12:55:21 +0200

Dear Gadget list,


I met a problem using Gadget2 on our beowulf cluster at the Geneva
Observatory.
The use of the command system(buf3); (begrun.c, line +-652) causes MPI
to block.
Thus, I suggest to replace the lines :


sprintf(buf1, "%s%s", fname, "-usedvalues");
sprintf(buf2, "%s%s", All.OutputDir, "parameters-usedvalues");
sprintf(buf3, "cp %s %s", buf1, buf2);
system(buf3);

by :


/* copy parameters-usedvalues file*/
sprintf(buf1, "%s%s", fname, "-usedvalues");
sprintf(buf2, "%s%s", All.OutputDir, "parameters-usedvalues");

fd = fopen(buf1,"r");
fdout = fopen(buf2,"w");

while(1)
  {
    fgets(buf, 200, fd);
    if (feof(fd)) break;
    fprintf(fdout, buf, 200);
  }
 
fclose(fd);
fclose(fdout);


This problem seems to be system dependent.
A similar system call is present in restart.c and should be replaced.

Cheers.


-- 
                                                 (o o)
--------------------------------------------oOO--(_)--OOo-------
  Yves Revaz
  Geneva Observatory	       Tel : ++ 41 22 379 23 65
  51. Ch. des Maillettes       Fax : ++ 41 22 379 22 05
  1290 Sauverny 	           e-mail : Yves.Revaz_at_obs.unige.ch
  SWITZERLAND		          http://obswww.unige.ch/~revaz/
----------------------------------------------------------------
Received on 2005-05-30 12:55:23

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:30 CET