[Openmp-dev] Using the runtime C interface

Alexey Bataev via Openmp-dev openmp-dev at lists.llvm.org
Wed Nov 2 07:27:06 PDT 2016


Hi Joseph,
You can use 'clang -c -S -emit-llvm -o -' to see the real calls of OpenMP runtime functions

Best regards,
Alexey Bataev

2 нояб. 2016 г., в 17:24, Joseph Schuchart via Openmp-dev <openmp-dev at lists.llvm.org<mailto:openmp-dev at lists.llvm.org>> написал(а):


Alexandre,

Thanks for your swift reply. Which LLVM files are you refering to in particular? Ideally I would like to use something like clang -E to see how the OpenMP pragmas are resolved to particular library calls (unfortunately, pragmas are carried through this step). I am not too familiar with the LLVM tool-suite so I am not sure about any tools to dump intermediate presentations.

So far I have tried to use "clang -E" and "clang -ast-print" but all of them still contain the pragmas. Do you have any suggestions how to get a representation of the library calls that are generated?

Joseph

On 10/27/2016 09:44 PM, Alexandre Eichenberger wrote:
Joseph

Best is to create a few examples and look at the llvm files being generated. The construct that generates the fork call is #pragma omp parallel. Here is the template:

EXTERN void __kmpc_fork_call(klegacy_Indent *loc, int32_t argc, klegacy_ParFctPtr microtask, ...);


where the first is unused, the second is the number of parameters to the microtask, the function to be called, and the params.

Parameters are typically used to pass references and first private values. If you have no shared/private values in your model, you can ignore them.

Alexandre

-----------------------------------------------------------------------------------------------------
Alexandre Eichenberger, Master Inventor, Advanced Compiler Technologies
- research: compiler optimization (OpenMP, multithreading, SIMD)
- info: alexe at us.ibm.com<mailto:alexe at us.ibm.com> http://www.research.ibm.com/people/a/alexe
- phone: 914-945-1812 (work) 914-312-3618 (cell)


----- Original message -----
From: Joseph Schuchart via Openmp-dev <openmp-dev at lists.llvm.org><mailto:openmp-dev at lists.llvm.org>
Sent by: "Openmp-dev" <openmp-dev-bounces at lists.llvm.org><mailto:openmp-dev-bounces at lists.llvm.org>
To: openmp-dev <openmp-dev at lists.llvm.org><mailto:openmp-dev at lists.llvm.org>
Cc:
Subject: [Openmp-dev] Using the runtime C interface
Date: Wed, Oct 26, 2016 8:55 AM

All,

I am currently working on a research project with the goal to create a
C++ abstraction for creating tasks similar to tasking in OpenMP but with
added functionality and only relying on standard C++ language features.
In order to allow for an easy integration with existing OpenMP
applications, I would like to use an existing OpenMP runtime as a basis
so that users can only port parts of their application while keeping
most of the existing code. Eventually all created tasks will be
scheduled by the same runtime.

The LLVM OpenMP runtime seems to be a good fit as it comes with a
documented API [1] and supports multiple compilers. Thanks to the
documentation and the library code, I think I have a good understanding
of how to create tasks with depdendencies using __kmpc_omp_task_alloc()
and __kmpc_omp_task_with_deps(). However, it is not clear to me how
threads can be spawned correctly. I assume that __kmpc_fork_call() is
the right place to look at but I fail to understand how a microtask
should exactly behave, e.g., which functions to call while waiting for
tasks to be created in another thread. Is there any publicly available
example on how to use the API correctly without any OpenMP pragmas? Or
is it possible to extract such an example from OpenMP code using the
LLVM compiler?

Any pointers are much appreciated.

Cheers
Joseph

[1] http://openmp.llvm.org/Reference.pdf

--
Dipl.-Inf. Joseph Schuchart
High Performance Computing Center Stuttgart (HLRS)
Nobelstr. 19
D-70569 Stuttgart

Tel.: +49(0)711-68565890
Fax: +49(0)711-6856832
E-Mail: schuchart at hlrs.de<mailto:schuchart at hlrs.de>

_______________________________________________
Openmp-dev mailing list
Openmp-dev at lists.llvm.org<mailto:Openmp-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev




--
Dipl.-Inf. Joseph Schuchart
High Performance Computing Center Stuttgart (HLRS)
Nobelstr. 19
D-70569 Stuttgart

Tel.: +49(0)711-68565890
Fax: +49(0)711-6856832
E-Mail: schuchart at hlrs.de<mailto:schuchart at hlrs.de>


_______________________________________________
Openmp-dev mailing list
Openmp-dev at lists.llvm.org<mailto:Openmp-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20161102/9d4b3108/attachment-0001.html>


More information about the Openmp-dev mailing list