<div dir="ltr">Hi Hal,<div><br></div><div>I just want to see which core the program is assigned to. I know we could set the CPUaffinity, but I don't want to specify it. I want it to be scheduled by the operating systems itself, then I will check which core it is scheduled. Is it possible to get this information? Thanks.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 20, 2015 at 11:45 AM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">----- Original Message -----<br>
> From: "zhi chen" <<a href="mailto:zchenhn@gmail.com">zchenhn@gmail.com</a>><br>
> To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>
> Cc: <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
</span><span class="">> Sent: Thursday, November 19, 2015 5:47:45 PM<br>
> Subject: Re: [llvm-dev] Get timestamp and processor ID in the IR<br>
><br>
><br>
</span><span class="">> Say if we have 8 cores, I want to get which core is running the<br>
> current program. Thanks.<br>
><br>
<br>
</span>What do you intend to do with that information?<br>
<br>
One obvious complication is that the identity of the core running your application might change at any time (whenever the operating system performs a context switch). If you need to need to restrict to running only on one core, you'll likely need to adjust the process's core bindings (affinity mask) using some operating-system specific method.<br>
<span class="HOEnZb"><font color="#888888"><br>
 -Hal<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> On Thu, Nov 19, 2015 at 3:37 PM, Hal Finkel < <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> ><br>
> wrote:<br>
><br>
><br>
> ----- Original Message -----<br>
> > From: "zhi chen" < <a href="mailto:zchenhn@gmail.com">zchenhn@gmail.com</a> ><br>
> > To: "Hal Finkel" < <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> ><br>
> > Cc: <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> > Sent: Thursday, November 19, 2015 3:48:02 PM<br>
> > Subject: Re: [llvm-dev] Get timestamp and processor ID in the IR<br>
> ><br>
> ><br>
> > Hi Hal,<br>
> ><br>
> ><br>
> > Thanks for the pointer. Is it possible to get the processor ID on<br>
> > X86<br>
> > architecture? There is a library call in linux, sched_getcpu(), to<br>
> > the ID.<br>
> ><br>
><br>
> What exactly do you mean by "processor ID"?<br>
><br>
> -Hal<br>
><br>
><br>
><br>
> ><br>
> > Also, is it possible to get the program counter in the IR?<br>
> ><br>
> ><br>
> > Best,<br>
> > Zhi<br>
> ><br>
> ><br>
> > On Thu, Nov 19, 2015 at 1:33 PM, Hal Finkel < <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> ><br>
> > wrote:<br>
> ><br>
> ><br>
> > Hi Zhi,<br>
> ><br>
> > There is no standard (architecture-independent) way to get the<br>
> > processor id. We do have an intrinsic to get the cycle counter:<br>
> ><br>
> > <a href="http://llvm.org/docs/LangRef.html#llvm-readcyclecounter-intrinsic" rel="noreferrer" target="_blank">http://llvm.org/docs/LangRef.html#llvm-readcyclecounter-intrinsic</a><br>
> ><br>
> > -Hal<br>
> ><br>
> ><br>
> ><br>
> > ----- Original Message -----<br>
> > > From: "zhi chen via llvm-dev" < <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a> ><br>
> > > To: <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> > > Sent: Thursday, November 19, 2015 3:29:40 PM<br>
> > > Subject: [llvm-dev] Get timestamp and processor ID in the IR<br>
> > ><br>
> > ><br>
> > ><br>
> > > Hi,<br>
> > ><br>
> > ><br>
> > > I am wondering if it is possible to get the time-stamp and the<br>
> > > processor ID where an instruction is exectued in the IR? Thanks<br>
> > > for<br>
> > > your help in advance:)<br>
> > ><br>
> > ><br>
> > > Best,<br>
> > > Zhi<br>
> > > _______________________________________________<br>
> > > LLVM Developers mailing list<br>
> > > <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> > > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
> > ><br>
> ><br>
> > --<br>
> > Hal Finkel<br>
> > Assistant Computational Scientist<br>
> > Leadership Computing Facility<br>
> > Argonne National Laboratory<br>
> ><br>
> ><br>
><br>
> --<br>
> Hal Finkel<br>
> Assistant Computational Scientist<br>
> Leadership Computing Facility<br>
> Argonne National Laboratory<br>
><br>
><br>
<br>
--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</div></div></blockquote></div><br></div>