Newsgroups: comp.parallel.mpi
From: "K. Tevosyan" <ktevosya@indiana.edu>
Subject: Parallel IO
Organization: Indiana University, Bloomington
Date: Fri, 23 May 1997 12:22:06 -0500
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <3385D23E.6B07@indiana.edu>

Hi,

I have the following problem. I need to execute a certain
function 100 times on 10 processors using MPI.
Each processor will perform a series of the function 
executions until the total number of executions reaches 100.
To check if the desired number of execution is reached, a
processor will read a counter from a file. If the counter
is less than 100, the processor will increment it, write it
back to the file, and continue with the next function execution.
If the counter is 100, the processor is done. The problem with
this scheme is multiple access to the same file. Is there any
way to lock the file access by a processor while the processor
reads the counter and writes it back? I could use UNIX file lockers, 
but I am not sure if it is o.k. to do so from within the MPI program.
Thanks.

Kahren Tevosyan

