<?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 Core assign and parallel processing don't work when using Intel openMP Library(i.e., libiomp5) in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Core-assign-and-parallel-processing-don-t-work-when-using-Intel/m-p/1374374#M8187</link>
    <description>&lt;P&gt;Issue :&amp;nbsp;Core assign and parallel processing don't work when using Intel openMP Library(i.e., libiomp5)&lt;/P&gt;
&lt;P&gt;Compiler : GCC&lt;/P&gt;
&lt;P&gt;OS : RHEL 6.4, 6.6, 7.7, and 8.4 with Intel OneAPI 2022 installed&lt;/P&gt;
&lt;P&gt;==============================================================================&lt;/P&gt;
&lt;P&gt;Hello.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I faced with some difficult that core assign and parallel processing on my code don't work well when I using Intel openMP library, i.e., libiomp5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since I should use Intel MKL Library like specially libmkl_intel_thread.a and libmkl_intel_core.a, it is essential using libiomp5.so.&lt;/P&gt;
&lt;P&gt;In addition, I should use #pragma omp parallel processing with core assign such as CPU_SET and pthread_setafficity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I tested my test code as using libiomp5,&amp;nbsp;the figure of core load(result of top command on the shell) looks so strange.&lt;/P&gt;
&lt;P&gt;My test code generates two threads those first thread used core#0, #2 and #4 and others used core#1, #3 and #5. If normal work, core#0 ~ #5 are under 100% load because two threads are on the infinite loop without sleep. However only core#0, #2 and #4 are under 100% load.&lt;/P&gt;
&lt;P&gt;Strangely, that doesn't mean the thread assigned on core#1, #3 and #5 was not created. This thread was made but cannot check CPU load.&lt;/P&gt;
&lt;P&gt;One more interesting thing is all cores work well when I changed iomp5 as gomp. As following 2 pictures are core load statement when I use iomp5 and gomp separately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result with iomp5" style="width: 474px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/28259i953EFA2A7FD8A727/image-dimensions/474x356/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="474" height="356" role="button" title="iomp_result.jpg" alt="result with iomp5" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;result with iomp5&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;iomp result : only core#0, #2 and #4 are under 100% load but two threads works.&lt;/P&gt;
&lt;P&gt;compile command :&amp;nbsp;gcc Test_iomp5.c -o Test_iomp5.out -D_GNU_SOURCE -fopenmp -ldl -&lt;STRONG&gt;liomp5&lt;/STRONG&gt; -lpthread -L/opt/intel/oneapi/compiler/2022.0.0/linux/compiler/lib/intel64&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result with gomp" style="width: 478px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/28260i49F2BB6AC4FFFF81/image-dimensions/478x358/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="478" height="358" role="button" title="gomp_result.jpg" alt="result with gomp" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;result with gomp&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;gomp result : core#0 ~ #5 are under 100% load.&lt;/P&gt;
&lt;P&gt;compile command :&amp;nbsp;gcc Test_iomp5.c -o Test_iomp5.out -D_GNU_SOURCE -fopenmp -ldl -&lt;STRONG&gt;gomp&lt;/STRONG&gt; -lpthread -L/opt/intel/oneapi/compiler/2022.0.0/linux/compiler/lib/intel64&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Such condition, what should I do to fix this problem?&lt;/P&gt;
&lt;P&gt;Specially, I found the way to solve this problem that is using gomp as well as iomp5 as following compile command but I am afraid compatibility between gomp and iomp5 when use both.&lt;/P&gt;
&lt;P&gt;compile command :&amp;nbsp;gcc Test_iomp5.c -o Test_iomp5.out -D_GNU_SOURCE -fopenmp -ldl -&lt;STRONG&gt;gomp&lt;/STRONG&gt;&amp;nbsp;-&lt;STRONG&gt;iomp5&lt;/STRONG&gt; -lpthread -L/opt/intel/oneapi/compiler/2022.0.0/linux/compiler/lib/intel64&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to know&lt;/P&gt;
&lt;P&gt;1) How can I use #pragma omp parallel processing on the multi threads when I used iomp5?&lt;/P&gt;
&lt;P&gt;2)&amp;nbsp;If I should use both gomp and iomp5, is that no problem in terms of&amp;nbsp;compatibility each other?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me solve this issues, Sincerely.&lt;/P&gt;
&lt;P&gt;If any question and to do test, do not&amp;nbsp;hesitate on reply &lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;============= My Test Code :&amp;nbsp;Test_iomp5.c ============&lt;/P&gt;
&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;pthread.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sched.h&amp;gt;&lt;BR /&gt;#include &amp;lt;omp.h&amp;gt;&lt;/P&gt;
&lt;P&gt;#define MAX_THREAD_NUM 2&lt;BR /&gt;#define MAX_OMP_NUM 6&lt;/P&gt;
&lt;P&gt;extern void* DoWork1(void *args)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; long lLoop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; #pragma omp parallel for private(lLoop) num_threads(MAX_OMP_NUM)&lt;BR /&gt;&amp;nbsp; for(lLoop = 0 ; lLoop &amp;lt; 10000000000 ; lLoop++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; lLoop = 0;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; printf("Thread 1 Done @ core 0 &amp;amp; 2 &amp;amp; 4\n");&lt;BR /&gt;&amp;nbsp; return NULL;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;extern void* DoWork2(void *args)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; long lLoop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; #pragma omp parallel for private(lLoop) num_threads(MAX_OMP_NUM)&lt;BR /&gt;&amp;nbsp; for(lLoop = 0 ; lLoop &amp;lt; 10000000000 ; lLoop++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; lLoop = 0;&lt;BR /&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; printf("Thread 2 Done @ core 1 &amp;amp; 3 &amp;amp; 5\n");&lt;BR /&gt;&amp;nbsp; return NULL;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;int main(int const argc, char *const argv)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; int iLoop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; pthread_t threads[MAX_THREAD_NUM];&lt;BR /&gt;&amp;nbsp; pthread_attr_t attr;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (void) pthread_attr_init(&amp;amp;attr);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; for(iLoop = 0 ; iLoop &amp;lt; MAX_THREAD_NUM ; iLoop++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; cpu_set_t mask;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CPU_ZERO(&amp;amp;mask);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; if(iLoop == 1)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(1, &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(3, &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(5, &amp;amp;mask);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) pthread_attr_setaffinity_np(&amp;amp;attr, sizeof(cpu_set_t), &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) pthread_create(&amp;amp;threads[iLoop], &amp;amp;attr, DoWork2, (void *)iLoop);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) printf("Thread %d CoreSetMask 0x%X\n", iLoop+1, mask.__bits[0]);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp; &amp;nbsp;else&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(0, &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(2, &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(4, &amp;amp;mask);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) pthread_attr_setaffinity_np(&amp;amp;attr, sizeof(cpu_set_t), &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) pthread_create(&amp;amp;threads[iLoop], &amp;amp;attr, DoWork1, (void *)iLoop);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) printf("Thread %d CoreSetMask 0x%X\n", iLoop+1, mask.__bits[0]);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; for(iLoop = 0 ; iLoop &amp;lt; MAX_THREAD_NUM ; iLoop++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (void) pthread_join(threads[iLoop], NULL);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2022 09:24:10 GMT</pubDate>
    <dc:creator>Themis_Jeon</dc:creator>
    <dc:date>2022-04-05T09:24:10Z</dc:date>
    <item>
      <title>Core assign and parallel processing don't work when using Intel openMP Library(i.e., libiomp5)</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Core-assign-and-parallel-processing-don-t-work-when-using-Intel/m-p/1374374#M8187</link>
      <description>&lt;P&gt;Issue :&amp;nbsp;Core assign and parallel processing don't work when using Intel openMP Library(i.e., libiomp5)&lt;/P&gt;
&lt;P&gt;Compiler : GCC&lt;/P&gt;
&lt;P&gt;OS : RHEL 6.4, 6.6, 7.7, and 8.4 with Intel OneAPI 2022 installed&lt;/P&gt;
&lt;P&gt;==============================================================================&lt;/P&gt;
&lt;P&gt;Hello.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I faced with some difficult that core assign and parallel processing on my code don't work well when I using Intel openMP library, i.e., libiomp5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since I should use Intel MKL Library like specially libmkl_intel_thread.a and libmkl_intel_core.a, it is essential using libiomp5.so.&lt;/P&gt;
&lt;P&gt;In addition, I should use #pragma omp parallel processing with core assign such as CPU_SET and pthread_setafficity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I tested my test code as using libiomp5,&amp;nbsp;the figure of core load(result of top command on the shell) looks so strange.&lt;/P&gt;
&lt;P&gt;My test code generates two threads those first thread used core#0, #2 and #4 and others used core#1, #3 and #5. If normal work, core#0 ~ #5 are under 100% load because two threads are on the infinite loop without sleep. However only core#0, #2 and #4 are under 100% load.&lt;/P&gt;
&lt;P&gt;Strangely, that doesn't mean the thread assigned on core#1, #3 and #5 was not created. This thread was made but cannot check CPU load.&lt;/P&gt;
&lt;P&gt;One more interesting thing is all cores work well when I changed iomp5 as gomp. As following 2 pictures are core load statement when I use iomp5 and gomp separately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result with iomp5" style="width: 474px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/28259i953EFA2A7FD8A727/image-dimensions/474x356/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="474" height="356" role="button" title="iomp_result.jpg" alt="result with iomp5" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;result with iomp5&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;iomp result : only core#0, #2 and #4 are under 100% load but two threads works.&lt;/P&gt;
&lt;P&gt;compile command :&amp;nbsp;gcc Test_iomp5.c -o Test_iomp5.out -D_GNU_SOURCE -fopenmp -ldl -&lt;STRONG&gt;liomp5&lt;/STRONG&gt; -lpthread -L/opt/intel/oneapi/compiler/2022.0.0/linux/compiler/lib/intel64&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result with gomp" style="width: 478px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/28260i49F2BB6AC4FFFF81/image-dimensions/478x358/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="478" height="358" role="button" title="gomp_result.jpg" alt="result with gomp" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;result with gomp&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;gomp result : core#0 ~ #5 are under 100% load.&lt;/P&gt;
&lt;P&gt;compile command :&amp;nbsp;gcc Test_iomp5.c -o Test_iomp5.out -D_GNU_SOURCE -fopenmp -ldl -&lt;STRONG&gt;gomp&lt;/STRONG&gt; -lpthread -L/opt/intel/oneapi/compiler/2022.0.0/linux/compiler/lib/intel64&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Such condition, what should I do to fix this problem?&lt;/P&gt;
&lt;P&gt;Specially, I found the way to solve this problem that is using gomp as well as iomp5 as following compile command but I am afraid compatibility between gomp and iomp5 when use both.&lt;/P&gt;
&lt;P&gt;compile command :&amp;nbsp;gcc Test_iomp5.c -o Test_iomp5.out -D_GNU_SOURCE -fopenmp -ldl -&lt;STRONG&gt;gomp&lt;/STRONG&gt;&amp;nbsp;-&lt;STRONG&gt;iomp5&lt;/STRONG&gt; -lpthread -L/opt/intel/oneapi/compiler/2022.0.0/linux/compiler/lib/intel64&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to know&lt;/P&gt;
&lt;P&gt;1) How can I use #pragma omp parallel processing on the multi threads when I used iomp5?&lt;/P&gt;
&lt;P&gt;2)&amp;nbsp;If I should use both gomp and iomp5, is that no problem in terms of&amp;nbsp;compatibility each other?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me solve this issues, Sincerely.&lt;/P&gt;
&lt;P&gt;If any question and to do test, do not&amp;nbsp;hesitate on reply &lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;============= My Test Code :&amp;nbsp;Test_iomp5.c ============&lt;/P&gt;
&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;pthread.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sched.h&amp;gt;&lt;BR /&gt;#include &amp;lt;omp.h&amp;gt;&lt;/P&gt;
&lt;P&gt;#define MAX_THREAD_NUM 2&lt;BR /&gt;#define MAX_OMP_NUM 6&lt;/P&gt;
&lt;P&gt;extern void* DoWork1(void *args)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; long lLoop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; #pragma omp parallel for private(lLoop) num_threads(MAX_OMP_NUM)&lt;BR /&gt;&amp;nbsp; for(lLoop = 0 ; lLoop &amp;lt; 10000000000 ; lLoop++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; lLoop = 0;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; printf("Thread 1 Done @ core 0 &amp;amp; 2 &amp;amp; 4\n");&lt;BR /&gt;&amp;nbsp; return NULL;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;extern void* DoWork2(void *args)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; long lLoop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; #pragma omp parallel for private(lLoop) num_threads(MAX_OMP_NUM)&lt;BR /&gt;&amp;nbsp; for(lLoop = 0 ; lLoop &amp;lt; 10000000000 ; lLoop++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; lLoop = 0;&lt;BR /&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; printf("Thread 2 Done @ core 1 &amp;amp; 3 &amp;amp; 5\n");&lt;BR /&gt;&amp;nbsp; return NULL;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;int main(int const argc, char *const argv)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; int iLoop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; pthread_t threads[MAX_THREAD_NUM];&lt;BR /&gt;&amp;nbsp; pthread_attr_t attr;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (void) pthread_attr_init(&amp;amp;attr);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; for(iLoop = 0 ; iLoop &amp;lt; MAX_THREAD_NUM ; iLoop++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; cpu_set_t mask;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CPU_ZERO(&amp;amp;mask);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; if(iLoop == 1)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(1, &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(3, &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(5, &amp;amp;mask);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) pthread_attr_setaffinity_np(&amp;amp;attr, sizeof(cpu_set_t), &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) pthread_create(&amp;amp;threads[iLoop], &amp;amp;attr, DoWork2, (void *)iLoop);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) printf("Thread %d CoreSetMask 0x%X\n", iLoop+1, mask.__bits[0]);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp; &amp;nbsp;else&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(0, &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(2, &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CPU_SET(4, &amp;amp;mask);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) pthread_attr_setaffinity_np(&amp;amp;attr, sizeof(cpu_set_t), &amp;amp;mask);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) pthread_create(&amp;amp;threads[iLoop], &amp;amp;attr, DoWork1, (void *)iLoop);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(void) printf("Thread %d CoreSetMask 0x%X\n", iLoop+1, mask.__bits[0]);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; for(iLoop = 0 ; iLoop &amp;lt; MAX_THREAD_NUM ; iLoop++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (void) pthread_join(threads[iLoop], NULL);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 09:24:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Core-assign-and-parallel-processing-don-t-work-when-using-Intel/m-p/1374374#M8187</guid>
      <dc:creator>Themis_Jeon</dc:creator>
      <dc:date>2022-04-05T09:24:10Z</dc:date>
    </item>
  </channel>
</rss>

