Is there a SCHEDULE clause convenient for me ?

General OpenMP discussion

Is there a SCHEDULE clause convenient for me ?

Postby dva2tlse » Wed Sep 18, 2013 5:12 am

Hello everybody on the forum,
I have already posted a question on this forum, about multiple input files, and it has been solved in the meanwhile; the big (for me) fortran program that I need to speedup, has many input files, and each of them has been given a name and a fortran unit number directly related to the number of the thread which will read it.
If TID is the thread number (up to 16 and maybe 40 later, on the machine I'm working on) the integer given by OMP_GET_THREAD_NUM, then the file names are given by a character array "character*80 file3(16)", and TID+1 gives the index to lookup in this array; same thing for the fortran I/O unit numbers, which are given by TID+11.

Now, I need to know if there is a SCHEDULE clause convenient for the kind work I need to run. Since I'm french, I may have not completely understood the description of its usage.
So, I will simply show the program and explain the question :
Code: Select all

----------------------------------
program rfomp1
implicit none
...
C$OMP MASTER
! read first input data from three different files;
!   on thread 0 and fortran I/O units 1, 2 and 3.
! one of these files fills the array "character*80 file3(16)",
!   to have the name of the input files which will be read later.
C$OMP END MASTER
...
C$OMP PARALLEL DO PRIVATE(EID, TID) SHARED(elem, lina)
do EID=1, 300000 ! Loop 300000 on units of work.
call fabmat(... ) ! main subroutine for each unit of work
...
remainder of the unit of work
...
enddo
C$OMP END PARALLEL DO
...
stop
end
----------------------------------
subroutine fabmat(... )
implicit none
...
OPEN(UNIT=TID+11, FILE=file3(TID+1), err=...)
read input data pertinent to one single unit of work,
... coming from a single file for this unit of work.
CLOSE(TID+11)
...
here is made the main work of each unit; 99.94 % of the total time with 16 threads.
...
return
-----------------------------------


The problem is that, depending of the input data read by each unit of work, these ones may last different times, like this :
Code: Select all
1  2  3  4 ...  16
|  |  |  |      |
|  |  |  |      |
|     |  |      |
      |  |      |
      |  |
      |
      |
      |
      |

17 18 19 20 ... 32
|  |  |  |      |


  Thus I do not want 15 threads to wait for the slower of the 16 first ones; I want the 17-th to start immediately after the end of the quickest of the 16 first ones, as shown below :

1  2  3  4 ...  16
|  |  |  |      |
|  |  |  |      |
|  17 |  |      |
aa |  |  |      |
|  |  |  |      bb
|  |  |  nn     |
|  |  |  |      |
|  oo |  |      |
|  |  |  |      |
|  |  pp |      |
|  |  |  |      |


Is this the behaviour of the SCHEDULE(RUNTIME) clause ?

Thank's,
David
dva2tlse
 
Posts: 18
Joined: Sun Sep 08, 2013 2:52 am
Location: Toulouse, France

Re: Is there a SCHEDULE clause convenient for me ?

Postby MarkB » Wed Sep 18, 2013 5:31 am

Hi David,

I would suggest trying SCHEDULE(DYNAMIC) for this case. You may need to choose the chunksize to be larger than the the default of 1.
SCHEDULE(RUNTIME) allows you to set the SCHEDULE to one of the other kinds using an environment variable, and is really just intended for convenient experimentation.

Hope that helps,
Mark.
MarkB
 
Posts: 427
Joined: Thu Jan 08, 2009 10:12 am


Return to Using OpenMP

Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests