file syncronization problem

file syncronization problem

Post by vistal » Mon, 05 Nov 2001 14:29:16



hi there, a question about syncronize file info in several machines:

I wrote a FORTRAN program to generate a bunch of data files, after
that,
in the program I call an external solver to solve them in parallel,
like this:

!---------------------------------
    status=system('solver.script')
    n=wait(status)
!---------------------------------

the solver.script is a shell script which execute several threads to
login several machines parallelly
----------------------------------------------
#!/bin/sh
MYID=$$
echo  Xiao Tu Guai Guai started at `date`

sync
sleep 30
PIDS=
(sleep 400; kill -1 $MYID) &
(echo 'vger started!';vger/explogin;date) & PIDS="$PIDS $!"
(echo 'sci-fi started!';sci-fi/explogin;date) & PIDS="$PIDS $!"
(echo 'talia started!';talia/explogin;date) & PIDS="$PIDS $!"
trap "echo TIMEOUT;kill $PIDS" 1
echo waiting for $PIDS

wait $PIDS
----------------------------------------------

each xxx/explogin is an login script and execute the solver after
login.

Now is the problem:
 If I generate the data files, and then, interupt my fortran program,
wait
for enough long time, if I run the 'solver.script' externally, It dose
work,
and several threads perform execellently.

  BUT, If I exec the 'solver.script'in my program immediatelly after
generating the data files,I found only the thread ran on the same
machine as my program can be finished properly,all the other threads
return an error message "Bad data files".

  I thought the problem is the file syncronization between these
machines,
I use sync or use sleep after sync, no matter I put this sync in the
'solver.script' or my program, it still dosen't work.

I want to know:
1. How to get the sync information like the time interval?
2. How to force the file system sync (sync command seems dosen't work)

thanks!

 
 
 

file syncronization problem

Post by hdmaste » Tue, 06 Nov 2001 11:45:44


There are many ways to get what you need. Here is what I would try first.1st
you may want to consider checking the permissions on all your files,this may
be what is causing your "bad data file" issue.When you type in sync it is
immediate in flushing out the disk buffers the total time it takes is
determined on the filesystem size. It should only take at the most 3-5
seconds / 20gigs. You can never " over sync a file system", so
sync;sync;sync;  will work fine sometimes it is necessary to sync a file
system more than once due to other processes running.

Good Luck


Quote:> hi there, a question about syncronize file info in several machines:

> I wrote a FORTRAN program to generate a bunch of data files, after
> that,
> in the program I call an external solver to solve them in parallel,
> like this:

> !---------------------------------
>     status=system('solver.script')
>     n=wait(status)
> !---------------------------------

> the solver.script is a shell script which execute several threads to
> login several machines parallelly
> ----------------------------------------------
> #!/bin/sh
> MYID=$$
> echo  Xiao Tu Guai Guai started at `date`

> sync
> sleep 30
> PIDS=
> (sleep 400; kill -1 $MYID) &
> (echo 'vger started!';vger/explogin;date) & PIDS="$PIDS $!"
> (echo 'sci-fi started!';sci-fi/explogin;date) & PIDS="$PIDS $!"
> (echo 'talia started!';talia/explogin;date) & PIDS="$PIDS $!"
> trap "echo TIMEOUT;kill $PIDS" 1
> echo waiting for $PIDS

> wait $PIDS
> ----------------------------------------------

> each xxx/explogin is an login script and execute the solver after
> login.

> Now is the problem:
>  If I generate the data files, and then, interupt my fortran program,
> wait
> for enough long time, if I run the 'solver.script' externally, It dose
> work,
> and several threads perform execellently.

>   BUT, If I exec the 'solver.script'in my program immediatelly after
> generating the data files,I found only the thread ran on the same
> machine as my program can be finished properly,all the other threads
> return an error message "Bad data files".

>   I thought the problem is the file syncronization between these
> machines,
> I use sync or use sleep after sync, no matter I put this sync in the
> 'solver.script' or my program, it still dosen't work.

> I want to know:
> 1. How to get the sync information like the time interval?
> 2. How to force the file system sync (sync command seems dosen't work)

> thanks!


 
 
 

file syncronization problem

Post by mar » Wed, 07 Nov 2001 00:17:49



> hi there, a question about syncronize file info in several machines:

> I wrote a FORTRAN program to generate a bunch of data files, after
> that,
> in the program I call an external solver to solve them in parallel,
> like this:

[code snipped]

Quote:> Now is the problem:
>  If I generate the data files, and then, interupt my fortran program,
> wait
> for enough long time, if I run the 'solver.script' externally, It dose
> work,
> and several threads perform execellently.

>   BUT, If I exec the 'solver.script'in my program immediatelly after
> generating the data files,I found only the thread ran on the same
> machine as my program can be finished properly,all the other threads
> return an error message "Bad data files".

>   I thought the problem is the file syncronization between these
> machines,
> I use sync or use sleep after sync, no matter I put this sync in the
> 'solver.script' or my program, it still dosen't work.

from man sync:

"The sync command runs the sync subroutine. If the system must be
stopped, run the sync command to ensure file system integrity. The
sync command writes all unwritten system buffers to disk including
modified i-nodes, delayed block I/O, and read-write mapped files.

Note: The writing, although scheduled, is not necessarily complete
upon return from the sync subroutine."

do a couple syncs.

Then from a  different command line, run fuser on the files to verify
that your fortran program does not still retain a lock on them, which
may be preventing sync from flushing the writes to those files until
the program is exited.

--
mark

 
 
 

file syncronization problem

Post by vistal » Wed, 07 Nov 2001 06:31:52


thanks for reply, I tried to replace the original sync into
"sync;sync;sync",it still dosen't work.

because our unix fs is afs, I found a source code to sync
file to file server(http://www.nd.edu/~dsouth/afs_syncing/)
after compilation, I call "fsync file1 file2...." , hope
to flush all of the files I need to read in other machines,
but when I ssh to other machines immediately after generating
those data files, they still say file not complete.

I also tried to use close()/open(pos='append') those files again
to flush them, still can't solve it.

wonder is there anything special in afs system?

thanks a lot!

 
 
 

1. File syncronization in Linux

Hi!  I have a large amount of digital photographs I have taken with my 2
and 3 megapixel digital cameras. I view and edit these in two different
locations: Chicago and Miami.  Both homes have internal networks
connected to the Internet via a DSL line with a static IP address.  The
client computers, which dual-boot between Linux and Windows are behind a
dedicated Redhat Linux 6 or 7 based ip masquerade server.  Instead of
having to manually load new digital photos onto each computer as I take
them, I would like the two locations to automatically syncronize
themselves.  In other words, any new photos I have taken that are in
Miami would be transfered to Chicago and vice versa.  I would like the
primary archive of the photos to be on the Linux server in Miami, as I
have a 40 GB harddrive in it.  I have tried to set something like this
up myself, but have run into a few problems, and have had a few questions:

1.  (Minor) Is there a way to have a Samba mountpoint automount, like in
Windows?  If not, I can always put into the syncronization script
commands which unmount and remount samba mountpoints.  I have decided
that the easiest way to share files between all of these computers is
samba because I still rely on Windows much of the time as a client OS.

2.  For the actual syncronization (copying of files) I have thought to
use cp -Ru.  The only problem with that is that if a file is renamed or
moved at either location, then there will be duplicates in both
locations; the one with the old name and the one with the new name.  If
a file were deleted from either location, also, it would not get deleted
at both, and therefore, upon the next syncronization, it would be copied
from the location which still had the file.  This is a pretty
significant problem.

3.  Speed...how long would it take to compare the files from each
location and determine which need to be syncronized?  I will probably
have the syncronization script executed nightly.

If you need more information about my setup or anything else, please
feel free to email me.

Sincerely,
Cameron Jay erens

2. Mounting Panasonic CDrom Problem...

3. file syncronization software

4. Acecad A-1812 drawingboard driver ???

5. files replication or syncronization

6. something like Sun's old screenblank for Linux?

7. Apache 1.3.23 syncronization problem

8. Linux, Win98, and partitioning (large) drives

9. RAID syncronization problem

10. Socket syncronization problems...

11. time syncronization

12. How to do Time Syncronization in Unix Sys.

13. password syncronization