<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Verdana",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
.MsoPapDefault
{mso-style-type:export-only;
margin-bottom:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D;mso-fareast-language:EN-US">At a guess you’re not linking against the runtime you have modified.<o:p></o:p></span></a></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Check exactly which shared library is being linked, and then use nm on it to see what symbols it contains.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D;mso-fareast-language:EN-US">As a second, stylistic, issue: please don’t name your new, non-standard function “omp_<i>anything”.
</i>Such names should be reserved for functions from the OpenMP standard. Historically other, non-standard, entrypoints to the runtime have used the “kmp_” prefix. Either use that, or choose your own, but having non-standard functionality appear to be standard
is asking for trouble.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">-- Jim<br>
<br>
James Cownie <james.h.cownie@intel.com><br>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D">Tel: +44 117 9071438</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Openmp-commits [mailto:openmp-commits-bounces@lists.llvm.org]
<b>On Behalf Of </b>Rezaul Karim Raju via Openmp-commits<br>
<b>Sent:</b> Wednesday, January 20, 2016 3:33 AM<br>
<b>To:</b> openmp-dev@lists.llvm.org; openmp-commits@lists.llvm.org<br>
<b>Subject:</b> Re: [Openmp-commits] [Openmp-dev] Intel OpenMP Runtime & LLVM : RUNTIME FUNCTION (newly written) CALL gets " Undefined Reference"<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">Hello everyone,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">I was writing a new runtime routine to integrate with intel openMP runtime. My function call is pretty like the calling of, "omp_set_num_threads(4);"<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b>omp_set_my_threads(8);</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b>omp_set_data_bind(&bindvariable);</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b>my goal here is to set/provide (to runtime) a integer value and an address location through runtime routine call. </b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b>What I did: </b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">I have made a shadow copy like the omp_set_num_thread() function implementation; it generates the function prototype as below
<b>in the omp.h header file:</b> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">extern void __KAI_KMPC_CONVENTION omp_set_data_bind (void *);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">extern void __KAI_KMPC_CONVENTION omp_set_my_threads (int);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">and in my program I am calling like: <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">int main(){<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">....<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">omp_set_num_threads(4);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b>omp_set_my_threads(8);</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b>omp_set_data_bind(&bindvariable);</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"> #pragma omp parallel<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"> {<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"> ---<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"> }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">}<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">Compile with CLANG (LLVM) the IR code generates the function call as: <b>call void @omp_set_my_threads(i32 8)</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b>but while I am going to compile it gives me the error as: </b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><span style="color:red">/tmp/XXXa.o: In function `main':<o:p></o:p></span></b></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><span style="color:red">XXXa.c:(.text+0x403): undefined reference to `omp_set_my_threads'<o:p></o:p></span></b></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><span style="color:red">clang-3.5: error: linker command failed with exit code 1 <o:p></o:p></span></b></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><span style="color:red"><o:p> </o:p></span></b></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><span style="color:blue">CAN YOU PLEASE COMMENT WHAT I AM MISSING HERE ..? </span><o:p></o:p></b></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><o:p> </o:p></b></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><span style="color:black">thank you very much in advance..!!</span><o:p></o:p></b></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><o:p> </o:p></b></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><b><span style="color:black">- Raju</span><o:p></o:p></b></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"> <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:10.0pt">On Tue, Dec 15, 2015 at 11:02 AM, Churbanov, Andrey <<a href="mailto:Andrey.Churbanov@intel.com" target="_blank">Andrey.Churbanov@intel.com</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hello,</span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">If you print information from __kmp_task_alloc() function, you cannot find your data in
the structures.</span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">The reason is that this routine only allocates space requested by the compiler and initializes
its own runtime-related info, and if you examine the space allocated for shareds you can only find uninitialized memory there.</span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">The addresses of shared variables are put into allocated memory by the compiler later,
AFTER the __kmp_task_alloc() call. E.g. the array of shareds should already be initialized in the __kmp_omp_task() call. But I doubt you can rely on particular location of any shared variable in the array of shareds, it is compiler’s decision where to place
your particular variable’s address, and it may or may not be the first in the array of shareds. E.g. compiler can insert its own auxiliary data before user’s data.</span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Regards,</span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Andrey</span><span lang="RU"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a name="1144782762______replyseparator"></a><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">
Openmp-dev [mailto:<a href="mailto:openmp-dev-bounces@lists.llvm.org" target="_blank">openmp-dev-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>Rezaul Karim Raju via Openmp-dev<br>
<b>Sent:</b> Tuesday, December 15, 2015 8:47 AM<br>
<b>To:</b> <a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>;
<a href="mailto:openmp-commits@lists.llvm.org" target="_blank">openmp-commits@lists.llvm.org</a><br>
<b>Subject:</b> [Openmp-dev] Intel OpenMP Runtime & LLVM [kmp_tasking.c]: Problem to access SHARED VARIABLE DATA LOCATION</span><span lang="RU"><o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">Dear concern, <o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">Please consider the source code(openmp c code) snippet as below: <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">--- code snippet ---<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">int a1, b1, c1, N;<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">Initially address of a1:= 0x7fff9bd58304 <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">omp_set_num_threads(2);<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> #pragma omp parallel<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> #pragma omp single<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> // task one: a1=b1+c1;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> #pragma omp task shared(a1) firstprivate(b1,c1)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> a1 = a1 + b1 + c1;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> }<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> }<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> }<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">In the above openMP code task construct contains shared variable (a1), I AM INTERESTED TO FIND THE SHARED VARIABLE OF TASK DATA IN RUNTIME TASK ALLOCATION.
<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">I am looking into the source code of Intel OpenMP Runtime, my openmp code is compiled with LLVM. In the LLVM IR, @__kmpc_omp_task_alloc( ...) calls runtime function kmp_task_alloc(),
source code is here: under the <src> directory, Kmp_tasking.c <o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">I am trying to access the "shared variable data location for a task" which is as below: <o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">kmp_task_t *<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">__kmp_task_alloc(...){<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">kmp_task_t *task;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">kmp_taskdata_t *taskdata;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">// Calculate shared structure offset including padding after kmp_task_t struct<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> // to align pointers in shared struct<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> shareds_offset = sizeof( kmp_taskdata_t ) + sizeof_kmp_task_t;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> shareds_offset = __kmp_round_up_to_val( shareds_offset, sizeof( void * ));<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">// Avoid double allocation here by combining shareds with taskdata<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> #if USE_FAST_MEMORY<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> taskdata = (kmp_taskdata_t *) __kmp_fast_allocate( thread, shareds_offset + sizeof_shareds );<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> #else /* ! USE_FAST_MEMORY */<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> taskdata = (kmp_taskdata_t *) __kmp_thread_malloc( thread, shareds_offset + sizeof_shareds );<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> #endif /* USE_FAST_MEMORY */<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">task = KMP_TASKDATA_TO_TASK(taskdata);<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">if (sizeof_shareds > 0) {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> // Avoid double allocation here by combining shareds with taskdata<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> task->shareds = & ((char *) taskdata)[ shareds_offset ];<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">printf("task->shareds address original:= %p address of pointer it points to := %p\n", & ((char *) taskdata)[ shareds_offset ], *task->shareds);<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> }<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">}<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">here, <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">typedef struct kmp_task { /* GEH: Shouldn't this be aligned somehow? */<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> void * shareds; /**< pointer to block of pointers to shared vars */<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">But, task->shareds = & ((char *) taskdata)[ shareds_offset ]; which is a pointer to block of pointers to shared variables, if I print the shared variable
pointing address(which should be the address of a1:= 0x7fff9bd58304) <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">IT PRINTS DIFFERENT ADDRESS: <0x1fe0ef0><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">NEED TO GET THE ADDRESS OF TASK'S SHARED VARIABLE ADDRESS FROM RUNTIME.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU">appreciate your comment and help. Thanking you.<o:p></o:p></span></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU" style="font-size:10.0pt;color:#CCCCCC">------------------------</span><span lang="RU"><o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU" style="font-size:10.0pt;color:#999999">RaJu, Rezaul Karim<br>
Graduate Student (PhD) | Computer Science | University of Houston</span><span lang="RU"><o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU" style="font-size:10.0pt;color:#999999">Research in High Performance Computing Tools </span><span lang="RU"><o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="RU" style="font-size:10.0pt;color:#999999">Houston, Texas-77004</span><span lang="RU"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p><span lang="RU"><br>
--------------------------------------------------------------------<br>
Joint Stock Company Intel A/O<br>
Registered legal address: Krylatsky Hills Business Park, <br>
17 Krylatskaya Str., Bldg 4, Moscow 121614, <br>
Russian Federation<o:p></o:p></span></p>
<p><span lang="RU">This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.<o:p></o:p></span></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#CCCCCC">------------------------</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#999999">RaJu, Rezaul Karim<br>
Graduate Student (PhD) | Computer Science | University of Houston</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#999999">Research in High Performance Computing Tools </span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#999999">Houston, Texas-77004</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p>---------------------------------------------------------------------<br>
Intel Corporation (UK) Limited<br>
Registered No. 1134945 (England)<br>
Registered Office: Pipers Way, Swindon SN3 1RJ<br>
VAT No: 860 2173 47</p>
<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></body>
</html>