<?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 ray hits only occur on thread 0 when using OpenMP in Intel® Embree Ray Tracing Kernels</title>
    <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/ray-hits-only-occur-on-thread-0-when-using-OpenMP/m-p/1702258#M1012</link>
    <description>&lt;P&gt;I'm working with a code which parallelizes the detection of ray intersections with a geometry using an OpenMP parallel for. This is actually a code for simulating thermal images. The code is open source and available here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/crobarcro/ThRend" target="_blank"&gt;https://github.com/crobarcro/ThRend&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;In this code there is a parallel for loop, i.e. with&lt;/P&gt;&lt;P&gt;#pragma omp parallel for&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;which contains the following (and other things):&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;RTCRay ray;
ray.org_x = camOrig.x; ray.org_y = camOrig.y; ray.org_z = camOrig.z;
ray.tfar = 1000.0f; ray.tnear = EPS; ray.time = 0; ray.id = 0; ray.flags = -1;
ray.dir_x = dir.x; ray.dir_y = dir.y; ray.dir_z = dir.z;

RTCRayHit query;
RTCIntersectContext context;
rtcInitIntersectContext(&amp;amp;context);
query.ray = ray;
query.hit.geomID = RTC_INVALID_GEOMETRY_ID;
query.hit.primID = RTC_INVALID_GEOMETRY_ID;
query.hit.instID[0] = RTC_INVALID_GEOMETRY_ID;
rtcIntersect1(eScene, &amp;amp;context, &amp;amp;query);

float t = 0;
float aparentT = 0;
if (query.hit.geomID != RTC_INVALID_GEOMETRY_ID) {
&amp;lt;snip&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On Linux,&amp;nbsp;when I use a single thread the full output image is created correctly. However, if I increase the threads to two, only half the image is created, the rest blank, and if I increase to 4, only 1/4 is created. Ther reason is that only thread 0 ever passes the&amp;nbsp;&amp;nbsp;if (query.hit.geomID != RTC_INVALID_GEOMETRY_ID) test.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can anyone suggest what the problem might be? I'm certain it's not the geometry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For further info, the scene is created in&amp;nbsp;buildSceneEmbree in EmbreeUtils.h and the ray tracing is done in&amp;nbsp;generateThermography in main.cpp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Jul 2025 23:24:58 GMT</pubDate>
    <dc:creator>crobar</dc:creator>
    <dc:date>2025-07-08T23:24:58Z</dc:date>
    <item>
      <title>ray hits only occur on thread 0 when using OpenMP</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/ray-hits-only-occur-on-thread-0-when-using-OpenMP/m-p/1702258#M1012</link>
      <description>&lt;P&gt;I'm working with a code which parallelizes the detection of ray intersections with a geometry using an OpenMP parallel for. This is actually a code for simulating thermal images. The code is open source and available here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/crobarcro/ThRend" target="_blank"&gt;https://github.com/crobarcro/ThRend&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;In this code there is a parallel for loop, i.e. with&lt;/P&gt;&lt;P&gt;#pragma omp parallel for&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;which contains the following (and other things):&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;RTCRay ray;
ray.org_x = camOrig.x; ray.org_y = camOrig.y; ray.org_z = camOrig.z;
ray.tfar = 1000.0f; ray.tnear = EPS; ray.time = 0; ray.id = 0; ray.flags = -1;
ray.dir_x = dir.x; ray.dir_y = dir.y; ray.dir_z = dir.z;

RTCRayHit query;
RTCIntersectContext context;
rtcInitIntersectContext(&amp;amp;context);
query.ray = ray;
query.hit.geomID = RTC_INVALID_GEOMETRY_ID;
query.hit.primID = RTC_INVALID_GEOMETRY_ID;
query.hit.instID[0] = RTC_INVALID_GEOMETRY_ID;
rtcIntersect1(eScene, &amp;amp;context, &amp;amp;query);

float t = 0;
float aparentT = 0;
if (query.hit.geomID != RTC_INVALID_GEOMETRY_ID) {
&amp;lt;snip&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On Linux,&amp;nbsp;when I use a single thread the full output image is created correctly. However, if I increase the threads to two, only half the image is created, the rest blank, and if I increase to 4, only 1/4 is created. Ther reason is that only thread 0 ever passes the&amp;nbsp;&amp;nbsp;if (query.hit.geomID != RTC_INVALID_GEOMETRY_ID) test.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can anyone suggest what the problem might be? I'm certain it's not the geometry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For further info, the scene is created in&amp;nbsp;buildSceneEmbree in EmbreeUtils.h and the ray tracing is done in&amp;nbsp;generateThermography in main.cpp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jul 2025 23:24:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/ray-hits-only-occur-on-thread-0-when-using-OpenMP/m-p/1702258#M1012</guid>
      <dc:creator>crobar</dc:creator>
      <dc:date>2025-07-08T23:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: ray hits only occur on thread 0 when using OpenMP</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/ray-hits-only-occur-on-thread-0-when-using-OpenMP/m-p/1710452#M1013</link>
      <description>&lt;P&gt;The problem comes likely as you do not initialize the ray.mask to 0xFFFFFFFF. Please try again with that fix.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 07:08:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/ray-hits-only-occur-on-thread-0-when-using-OpenMP/m-p/1710452#M1013</guid>
      <dc:creator>SvenW_Intel</dc:creator>
      <dc:date>2025-08-19T07:08:42Z</dc:date>
    </item>
  </channel>
</rss>

