This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320C6678: openmp nested , dynamic and untied

Part Number: TMS320C6678

hi everyone,

i'm working on openmp on C6678. I have a few question about the nested , dynamic features and the untied clause.

1. nested feature

{
#pragma omp parallel for
  for(i = 0; i > 3;i++)
  {
      printf("core%d outer\n",omp_get_thread_num()); 
#pragma omp parallel for
      for(j = 0; j < 3;j++)
      printf("core%d inner\n",omp_get_thread_num()); 
}

the prints in console:

[C66xx_0]core0 outer 
core0 inner
core0 inner
core0 inner
[C66xx_1]core1 outer 
[C66xx_2]core2 outer 
[C66xx_1]core0 inner 
[C66xx_2]core0 inner 
[C66xx_1]core0 inner 
[C66xx_2]core0 inner 
[C66xx_1]core0 inner 
[C66xx_2]core0 inner

why the nested iterations on core1 and core2 print "core0"?  Dose omp really implement the nested feature that creates new threads when nested?

2.dynamic feature

the dynamic here is the feature that allows the runtime to dynamically change  the parallel thread number by invoking omp_set_dynamic(1);.I read the source code and find that the dynamic feature is implemented by gomp_resolve_num_threads() who calls MultiProc_getNumOfProcsInCluster(). I wonder What MultiProc_getNumOfProcsInCluster(). actually returns  when there's no explicit configuration on cluster with one 6678 board.  and what's the difference with multiproc_getNumOfProcessor().

3.  Does omp implement the untied clause? If it's yes, then how? I don't see it clear in the source code.

Thank you !

  • Hi,

    Could you please post the SDK version?

    Best Regards,
    Yordan
  • Sure,I'm using mcsdk_2_01_02_06 and omp_1_01_03_02.

    Thank you!

  • Hi Ruijie

    The code confuses me a little. What is your expectations ?

    (especially since the condition is i>3)


    Ran
  • Hi Ruijie

    I changed your code a little bit - here is what I did, I separated between the core number (DNUM) and the thread number. And I changed the for count to be less than 3

    void program2()
    {
        int i,j   ;
          int nthreads, tid;
    #pragma omp parallel for
          for(i = 0; i < 3;i++)
          {
              tid = omp_get_thread_num();
              printf("core %d Thread # %d outer\n", DNUM, tid);
    #pragma omp parallel for
              for(j = 0; j < 3;j++)
              {

                 printf("core %d Thread # %d inner\n",DNUM,tid);
              }
        }
    }

    Here are the results  - you see that all the cores are printing but they all use the same thread.  The thread is distributed between the cores:

    C66xx_0] core 0 Thread # 0 outer
    core 0 Thread # 7 inner
    core 0 Thread # 7 inner
    core 0 Thread # 7 inner
    core 0 Thread # 0 outer
    core 0 Thread # 0 inner
    core 0 Thread # 0 inner
    core 0 Thread # 0 inner
    core 0 Thread # 0 outer
    core 0 Thread # 0 inner
    core 0 Thread # 0 inner
    core 0 Thread # 0 inner
    [C66xx_1] core 1 Thread # 1 outer
    [C66xx_2] core 2 Thread # 2 outer
    [C66xx_3] core 3 Thread # 3 outer
    [C66xx_4] core 4 Thread # 4 outer
    [C66xx_5] core 5 Thread # 5 outer
    [C66xx_6] core 6 Thread # 6 outer
    [C66xx_7] core 7 Thread # 7 outer
    [C66xx_1] core 1 Thread # 0 inner
    [C66xx_2] core 2 Thread # 0 inner
    [C66xx_3] core 3 Thread # 0 inner
    [C66xx_4] core 4 Thread # 0 inner
    [C66xx_5] core 5 Thread # 0 inner
    [C66xx_6] core 6 Thread # 0 inner
    [C66xx_7] core 7 Thread # 0 inner
    [C66xx_1] core 1 Thread # 0 inner
    [C66xx_2] core 2 Thread # 0 inner

    Now one thing about printf - it does not keep timing,  that is, the fact that line 2 is before line 1 does not mean that line 2 was printed before line 1,  this is because of the way CCS reads printf data for multiple cores.

    In any rate, it does not look like it is what you expected.  So I am going to send this case to the developers and see what they say

    I will post the answer here

    Ran

  • Thank you Ran,
    Sorry for a late reply. it's a miswrote. what I mean is i < 3. Thank you for the help on the first question.
    Can you help me with the second and third questions in my first post? Any hint or suggestions?
    Thank you!