<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> alexe@us.ibm.com http://www.research.ibm.com/people/a/alexe<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 <openmp-dev@lists.llvm.org><br>Sent by: "Openmp-dev" <openmp-dev-bounces@lists.llvm.org><br>To: openmp-dev <openmp-dev@lists.llvm.org><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 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: schuchart@hlrs.de<br><br>_______________________________________________<br>Openmp-dev mailing list<br>Openmp-dev@lists.llvm.org<br><a 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>