<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
</head>
<body dir="auto">
<div>Hi Joseph,</div>
<div id="AppleMailSignature">You can use 'clang -c -S -emit-llvm -o -' to see the real calls of OpenMP runtime functions<br>
<br>
Best regards,
<div>Alexey Bataev</div>
</div>
<div><br>
2 ΞΟΡΒ. 2016 Η., Χ 17:24, Joseph Schuchart via Openmp-dev <<a href="mailto:openmp-dev@lists.llvm.org">openmp-dev@lists.llvm.org</a>> ΞΑΠΙΣΑΜ(Α):<br>
<br>
</div>
<blockquote type="cite">
<div>
<p>Alexandre, <br>
</p>
<p>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.
<br>
</p>
<p>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?<br>
</p>
<p>Joseph<br>
</p>
<br>
<div class="moz-cite-prefix">On 10/27/2016 09:44 PM, Alexandre Eichenberger wrote:<br>
</div>
<blockquote cite="mid:OFE150A02A.13BC4B8D-ON00258059.006C2E34-00258059.006C75EE@notes.na.collabserv.com" type="cite">
<div class="socmaildefaultfont" dir="ltr" style="font-family:"Helvetica Neue", Helvetica, Arial,
        sans-serif;font-size:10.5pt">
<div dir="ltr">Joseph</div>
<div dir="ltr"> </div>
<div dir="ltr">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:</div>
<div dir="ltr"> </div>
<div dir="ltr">EXTERN void __kmpc_fork_call(klegacy_Indent *loc, int32_t argc, klegacy_ParFctPtr microtask, ...);</div>
<div dir="ltr"> </div>
<div dir="ltr"> </div>
<div dir="ltr">where the first is unused, the second is the number of parameters to the microtask, the function to be called, and the params.</div>
<div dir="ltr"> </div>
<div dir="ltr">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.</div>
<div dir="ltr">
<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial;font-size:10.5pt">
<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial;font-size:10.5pt">
<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial;font-size:10.5pt">
<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial;font-size:10.5pt">
<div dir="ltr"><br>
Alexandre<br>
<br>
-----------------------------------------------------------------------------------------------------<br>
<span style="color:#0000CD;">Alexandre Eichenberger, Master Inventor, Advanced Compiler Technologies</span><br>
<span style="color:#0000CD;">- research</span>: compiler optimization (OpenMP, multithreading, SIMD)<br>
<span style="color:#0000CD;">- info:</span> <a class="moz-txt-link-abbreviated" href="mailto:alexe@us.ibm.com">alexe@us.ibm.com</a> <a class="moz-txt-link-freetext" href="http://www.research.ibm.com/people/a/alexe">http://www.research.ibm.com/people/a/alexe</a><br>
<span style="color:#0000CD;">- phone</span>: 914-945-1812 (work) 914-312-3618 (cell)</div>
</div>
</div>
</div>
</div>
</div>
<div dir="ltr"> </div>
<div dir="ltr"> </div>
<blockquote data-history-content-modified="1" dir="ltr" style="border-left:solid #aaaaaa 2px; margin-left:5px;
          padding-left:5px; direction:ltr; margin-right:0px">
----- Original message -----<br>
From: Joseph Schuchart via Openmp-dev <a class="moz-txt-link-rfc2396E" href="mailto:openmp-dev@lists.llvm.org">
<openmp-dev@lists.llvm.org></a><br>
Sent by: "Openmp-dev" <a class="moz-txt-link-rfc2396E" href="mailto:openmp-dev-bounces@lists.llvm.org">
<openmp-dev-bounces@lists.llvm.org></a><br>
To: openmp-dev <a class="moz-txt-link-rfc2396E" href="mailto:openmp-dev@lists.llvm.org">
<openmp-dev@lists.llvm.org></a><br>
Cc:<br>
Subject: [Openmp-dev] Using the runtime C interface<br>
Date: Wed, Oct 26, 2016 8:55 AM<br>
 
<div><font face="Default Monospace,Courier
              New,Courier,monospace" size="2">All,<br>
<br>
I am currently working on a research project with the goal to create a<br>
C++ abstraction for creating tasks similar to tasking in OpenMP but with<br>
added functionality and only relying on standard C++ language features.<br>
In order to allow for an easy integration with existing OpenMP<br>
applications, I would like to use an existing OpenMP runtime as a basis<br>
so that users can only port parts of their application while keeping<br>
most of the existing code. Eventually all created tasks will be<br>
scheduled by the same runtime.<br>
<br>
The LLVM OpenMP runtime seems to be a good fit as it comes with a<br>
documented API [1] and supports multiple compilers. Thanks to the<br>
documentation and the library code, I think I have a good understanding<br>
of how to create tasks with depdendencies using __kmpc_omp_task_alloc()<br>
and __kmpc_omp_task_with_deps(). However, it is not clear to me how<br>
threads can be spawned correctly. I assume that __kmpc_fork_call() is<br>
the right place to look at but I fail to understand how a microtask<br>
should exactly behave, e.g., which functions to call while waiting for<br>
tasks to be created in another thread. Is there any publicly available<br>
example on how to use the API correctly without any OpenMP pragmas? Or<br>
is it possible to extract such an example from OpenMP code using the<br>
LLVM compiler?<br>
<br>
Any pointers are much appreciated.<br>
<br>
Cheers<br>
Joseph<br>
<br>
[1] <a moz-do-not-send="true" href="http://openmp.llvm.org/Reference.pdf" target="_blank">
http://openmp.llvm.org/Reference.pdf</a><br>
<br>
--<br>
Dipl.-Inf. Joseph Schuchart<br>
High Performance Computing Center Stuttgart (HLRS)<br>
Nobelstr. 19<br>
D-70569 Stuttgart<br>
<br>
Tel.: +49(0)711-68565890<br>
Fax: +49(0)711-6856832<br>
E-Mail: <a class="moz-txt-link-abbreviated" href="mailto:schuchart@hlrs.de">schuchart@hlrs.de</a><br>
<br>
_______________________________________________<br>
Openmp-dev mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:Openmp-dev@lists.llvm.org">Openmp-dev@lists.llvm.org</a><br>
<a moz-do-not-send="true" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</a></font></div>
</blockquote>
<div dir="ltr"> </div>
</div>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
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: <a class="moz-txt-link-abbreviated" href="mailto:schuchart@hlrs.de">schuchart@hlrs.de</a>
</pre>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>Openmp-dev mailing list</span><br>
<span><a href="mailto:Openmp-dev@lists.llvm.org">Openmp-dev@lists.llvm.org</a></span><br>
<span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</a></span><br>
</div>
</blockquote>
</body>
</html>