- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any help with OPENMP would be appreciated.
I am trying to use the OPENMP parallel directive withthe SYSTEM call in order torun multiple instances of aseparately compiled executable in parallel.I have 4 threads defined. I am running the separate instances from a command file (shown below) which serves the function of creating the directory, receiving the input file, etc. Eachthreadwill therefore create a unique directory from which to run. Everything appears to run fine until but I am receiving a periodic "Access is denied." message during code execution. Here isthecode snippet in question:
do i=1,n
... define args(:) and input_files (as defined below)
!$omp parallel default(shared),private(tid)
irc(tid+1)=SYSTEM(args(tid+1))
!$omp end parallel
enddo
The array, args(:), is composed of the following:
args(1)='cmd /c s3run.cmd input_file1'
args(2)='cmd /c s3run.cmd input_file2'
args(3)='cmd /c s3run.cmd input_file3'
args(4)='cmd /c s3run.cmd input_file4'
The command file, s3run.cmd, looks like:
@echo off
if exist %1.dir goto movedir
mkdir %1.dir
:movedir
move %1.inp %1.dir > nul
chdir %1.dir
set exe="c:/s3.exe"
%exe% < %1.inp > %1.out 2> %1.log
Note that I have also seen the same error using the parallel do, and also with the RUNQQ versus the SYSTEM call. If there is a clean way to parallelize the launching of an executable, that would also be helpful. Thanks.
Dave.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your array args try "START /NOWAIT " infront of "CMD"
then use
do i=1,size(args)
irc(i) = SYSTEM(args(i))
enddo
irc(i) will only indicate SYSTEM succeeded/failed and will not indicate if or where the batch file failed.
Also, your .cmd file is issuing "move %1.inp %1.dir > nul"
This implies that there exists a filenamed "%1.inp" in the current directory. And presumably if the move is successful that you will no longer have a "%1.inp" in the current directory. This implies that something else initialized the file "%1.inp" in the current directory. Whatever that something is, it may still have "%1.inp" in use.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to all for the suggestions.
I did track downthe issueto the background processes for Microsoft Desktop search which I did not realize was indexing concurrently those directories within which the Fortran executables were running. With 4 CPUs on my machine, I was running 4 copies of the executables at a clip, with each run taking place in its own unique directory from which the main program would read the resultant output files. This process upon being repeated several thousand times during execution of the main program would inevitably create the "Access Error".
The OPENMP code does work although a more efficient approach is the serial loop which also works fine and produces identical results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So are you saying the "Access Error"
a) Did not occur within the launcher app (the part that issued the SYSTEM calls). And did not occur within the copies of theworker app (the part which was launched with the SYSTEM calls). But rather occured in an app of yoursthat monitored the progress or took action upon results from the launcher and/or worker apps.
b) Microsoft Desktop search interfered with your launcher app and/or worker app.
c) Microsoft Desktop search reported the "Access Error"
Jim

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page