[Openmp-dev] Additional Loop Scheduling Techniques

Cownie, James H via Openmp-dev openmp-dev at lists.llvm.org
Thu Nov 22 06:47:14 PST 2018


Welcome!

The first thing to do is to look at the manual that accompanies the code. (See http://llvm.org/svn/llvm-project/openmp/trunk/runtime/doc/ or the equivalent place in your checked out code). It should clearly be updated (since it hasn't been built since 2015); maybe this could be your first commit request...), but it does try to give you  some introduction. For scheduling look at the chapter on Work Sharing. That also points you at the functions you should be interested in, and the enumerations which list the supported schedules.

I expect that your new schedules will need to use the dynamic schedule interface, since that has a call into the runtime for each chunk of iterations a thread should execute, whereas the static schedule interface calls the runtime only once, then computes the iteration locally from the chunked block-cyclic distribution described by that initial call.

For prototyping purposes, it is probably easiest to add some new call of your own (do not use the omp_* namespace!) to set a flag inside the runtime that you can then check in the dynamic loop initialization code to choose your schedule at the next dynamic loop.

So, something like
      ay_set_schedule_magic();
#pragma omp for schedule(dynamic)
      for (...)
          ... etc ...

You'd then also need to define ay_set_schedule_magic() somewhere in the runtime and export it, and also have a null version of that in another shared library so that you can to the comparison between your code and the existing schedules on the same executable.

You could just force all dynamic loops to use your new schedule (via some envirable you checked for), but that may be more confusing, since it's harder to do experiments on real code with many dynamic loops.

If you want to do history based scheduling (remembering how a particular lexical loop behaved and using that information the next time it is executed), note that the first argument to all of these functions is a pointer to an ident_t which, in turn, points to a source location string. (With the Intel compiler you need to compile the code with -parallel-source-info=2 to get the full filename in there; I'm not sure what LLVM does about that). Without that flag there is still some source info it's just not complete.
(Hmm... it looks as if clang puts in the source file info without requiring extra compiler flags, look at https://godbolt.org/z/HseSot and note the
.L__unnamed_2:
.asciz ";/tmp/compiler-explorer-compiler1181022-56-1lbfx2g.w69k/example.cpp;square;4;9;;"
for instance).

(If you're not familiar with the compiler explorer, it may prove useful to you as a quick way to see what code is generated for a given OpenMP construct).

Good luck, and keep asking.

-- Jim

Jim Cownie <james.h.cownie at intel.com>
CVCG/DPD/TCAR (Technical Computing, Analyzers, and Runtimes)
Tel: +44 117 9071438

From: Openmp-dev [mailto:openmp-dev-bounces at lists.llvm.org] On Behalf Of Akan Yilmaz via Openmp-dev
Sent: Thursday, November 22, 2018 2:13 PM
To: openmp-dev at lists.llvm.org
Subject: [Openmp-dev] Additional Loop Scheduling Techniques

Hi all

I am completely new to the LLVM OpenMP runtime library. I am currently interested to implement additional loop scheduling techniques to the runtime library and then test them with different benchmarks. I wanted to ask you if one of you could help me getting things sorted out, like, which techniques are already implemented and where I can find documents to get more Information about the implementation that already exists. I am happy for every information!

Have a nice day
Akan
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20181122/a6e58537/attachment.html>


More information about the Openmp-dev mailing list