<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic sycl with thread local storage in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-with-thread-local-storage/m-p/1721060#M4597</link>
    <description>&lt;P&gt;I have an OpenMP program written without GPU offload.&lt;/P&gt;&lt;P&gt;I am in the process of adapting it to use GPU offload, should a GPU be present.&lt;/P&gt;&lt;P&gt;I would also adapt it to use a combination of concurrent OpenMP on CPU and&amp;nbsp; GPU.&lt;/P&gt;&lt;P&gt;The original code used thread local storage:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#if defined(__linux)
__thread int myCore = -1;	// logical core (may be subset of physical cores and not necessarily core(0))
__thread int myHT = -1;	// logical thread (may be subset of hw threads in core and not necessarily hwThread(0) in core)
#else
__declspec(thread) int myCore = -1;	// logical core (may be subset of physical cores and not necessarily core(0))
__declspec(thread) int myHT = -1;	// logical thread (may be subset of hw threads in core and not necessarily hwThread(0) in core)
#endif&lt;/LI-CODE&gt;&lt;P&gt;I now get an error:&lt;/P&gt;&lt;P&gt;1&amp;gt;C:\Diffusion\diffusion_tiled_HT1\HyperThreadPhalanx.h(83,19): : error : thread-local storage is not supported for the current target&lt;BR /&gt;1&amp;gt; 83 | extern __declspec(thread) int myCore;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While I can see that the CPU core and HT are meaningless within the GPU, they are significant within the CPU parallel regions.&lt;/P&gt;&lt;P&gt;Now I can circumvent the error by making an array for each variable and index it by the omp_get_thread_num(), but this isn't as efficient as using TLS.&lt;/P&gt;&lt;P&gt;Any comments on this would be welcomed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Oct 2025 15:21:20 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2025-10-08T15:21:20Z</dc:date>
    <item>
      <title>sycl with thread local storage</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-with-thread-local-storage/m-p/1721060#M4597</link>
      <description>&lt;P&gt;I have an OpenMP program written without GPU offload.&lt;/P&gt;&lt;P&gt;I am in the process of adapting it to use GPU offload, should a GPU be present.&lt;/P&gt;&lt;P&gt;I would also adapt it to use a combination of concurrent OpenMP on CPU and&amp;nbsp; GPU.&lt;/P&gt;&lt;P&gt;The original code used thread local storage:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#if defined(__linux)
__thread int myCore = -1;	// logical core (may be subset of physical cores and not necessarily core(0))
__thread int myHT = -1;	// logical thread (may be subset of hw threads in core and not necessarily hwThread(0) in core)
#else
__declspec(thread) int myCore = -1;	// logical core (may be subset of physical cores and not necessarily core(0))
__declspec(thread) int myHT = -1;	// logical thread (may be subset of hw threads in core and not necessarily hwThread(0) in core)
#endif&lt;/LI-CODE&gt;&lt;P&gt;I now get an error:&lt;/P&gt;&lt;P&gt;1&amp;gt;C:\Diffusion\diffusion_tiled_HT1\HyperThreadPhalanx.h(83,19): : error : thread-local storage is not supported for the current target&lt;BR /&gt;1&amp;gt; 83 | extern __declspec(thread) int myCore;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While I can see that the CPU core and HT are meaningless within the GPU, they are significant within the CPU parallel regions.&lt;/P&gt;&lt;P&gt;Now I can circumvent the error by making an array for each variable and index it by the omp_get_thread_num(), but this isn't as efficient as using TLS.&lt;/P&gt;&lt;P&gt;Any comments on this would be welcomed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Oct 2025 15:21:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-with-thread-local-storage/m-p/1721060#M4597</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2025-10-08T15:21:20Z</dc:date>
    </item>
  </channel>
</rss>

