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 pragmas can be put on multiple SYS/BIOS Task instances ?

Part Number: TMS320C6678

Hello, 

My customer is concerning about the limitation of OpenMP parallel regions in SYS/BIOS environment. They have some SYS/BIOS Tasks in system and consider to use OpenMP pragmas in these contexts.

Can I understand TI OpenMP runtime, for example, openmp_dsp_c667x_2_06_00_00 allows to use OpenMP pragmas in multiple SYS/BIOS Task instances ? If yes, how does OpenMP runtime schedule the works dispatched from these Tasks ? 

Best Regards,
Naoki

  • Hi Naoki,

    Have a look at TI documentation on OpenMP:
    downloads.ti.com/.../index.html

    Best Regards,
    Yordan
  • Yordan,

    Yes, I read the manual, but I could not find the related descriptions. Can you ask your OpenMP expert ?

    Best Regards,
    Naoki

  • Hi Naoki,

    Yes, I've notified the RTOS team. Their feedback will be posted directly here.

    Best Regards,
    Yordan
  • Hello, Yodan

    Any responses on this ?

    Best Regards,
    Naoki
  • Hi Naoki,

    No feedback yet. I've escalated this internally.

    Best Regards,
    Yordan
  • Hi Naoki,


    The OpenMP runtime is configured by default to assume that the program starts on core0 where the master thread runs and the worker threads are running on the other cores (not in sys/bios tasks).  On core0, the master thread may be configured to run from within the context of a sys/bios task.  Some changes would be required in the runtime to get the worker threads (on the other cores) into sys/bios tasks.  So, the short answer is that on core0 you can run multiple sys/bios tasks and one of them may be running an OpenMP parallel region that is offloading work to threads on the other cores.  The other cores are not running sys/bios tasks, but are dedicated to run as worker threads.

    Another approach is to divide the device and have multiple OpenMP 'master' threads  running on different cores in SYS/BIOS tasks.  An OpenMP-master-sys/bios-task could be running on core0 and have worker threads on CORE1-3 and another OpenMP-master-sys/bios-task could be running on CORE4 and have workers on CORE4-7.  But this is not the default configuration and it would require the partitioning of some of the memory.  It would be like running two separate OpenMP programs in parallel.

    We would be interested in working with you to adapt the OpenMP runtime to meet your requirements.

    Best Regards,

    Eric Stotzer

  • Hello, Eric

    Thank you for your reply.
    So their main concern is
    1. Whether they can do OpenMP parallel region in multiple SYS/BIOS Task context simultaneously on core0, or not. Your answer seems that this is not acceptable because you mentioned "on core0 you can run multiple sys/bios tasks and one of them may be running an OpenMP parallel region" Correct ?
    2. If the above 1 is acceptable, how does the OpenMP runtime handle the queued/dispatched works when a parallel region in a lower priority task instance could be preempted by another high priority task instance and then CPU went into its OpenMP parallel region.

    The latter part of your suggestion (multiple OpenMP master in a single device) is slightly different from their requests, but it seems OpenMP runtime has a scalable options. Thanks for your information and helps.

    Best Regards,
    Naoki
  • Hi Naoki,

    1. The current configuration of the runtime supports one sys/bios task (at a timee) on CORE0 running a parallel region.  There is only one copy of the OpenMP runtime state variables.  You could in theory setup a configuration with multiple copies of the runtime state variables and then run "multiple" OpenMP instance in parallel.  This is similar to the multiple device-openmp-tasks suggestion I made in my previous email.

    2. See 1) above.  The master thread is running in the sys/bios task.  But it could be possible to adapt the OpenMP runtime to put the worker threads into OpenMP Tasks.  I have not thought it through enough to consider then what happens if you want to pre-empt the worker-thread-task with a higher priority task (openmp or not).  It seems like it would work as long as all worker-thread-tasks that correspond to the same parallel region execute with the same priority.

    Best Regards, Eric

  • Hello Eric,

    I`m trying to understand correctly your points... To summarize your answers,
    1. The default OpenMP runtime supports parallel regions only in OpenMP-master-sys/bios-task instance on Core0. Parallel regions are not supported on other normal SYS/BIOS task instances on Core0. On other slave cores, SYS/BIOS does not run and OpenMP runtime dispatches master`s requests in FIFO order and then invokes a worker subsequently without any scheduler`s help.
    2. With something configurations added in OpenMP runtime, we can have multiple OpenMP-master-sys/bios-tasks on Core0. And this offers the ability to do parallel region in each context of execution. Also, we can enable SYS/BIOS on slave cores. In this case, all worker threads are regarded as SYS/BIOS Task instances, and they would work based on their priorities (the team threads have the same Task priorities and OpenMP runtime inherits them from OpenMP-master-sys/bios-tasks working on Core0.

    I`m letting my imagination wild... Is my understanding correct ?

    Best Regards,
    Naoki
  • 1. Yes.  The default configuration is: One sys/bios task on core0 can execute a parallel region.  Cores1-7 are reserved as workers, not running sys/bios, waiting to pull work off a queue (sent to them by the master on core0).  This is supported today.

    2. With some work, what you have outlined could be supported.  The first step would be to package the workers on cores 1-7 into sys/bios tasks.  The next step would be to package the OpenMP runtime state, so that multiple instances of OpenMP-master-workers can run together potentially at different priorities.  This model is similar to having multiple OpenMP programs running in parallel.

    Your imagination seems good to me - you have got it.

    Eric

  • Hello Eric,

    Thank you for your explanation. So, how we can do to enable the option described as 2 in the previous posts? Only *.cfg file modifications are required ? or something source code modification in OpenMP runtime ?

    Best Regards,
    Naoki
  • Hi Naoki,

    It will require some changes in the source code of the runtime. The first step would be to encapsulate the master and worker threads into SYS/BIOS tasks. See the code in ./src/ti/runtime/openmp/src/omp_init.c and the function tomp_entry_func. The two parts of the if-else need to be split up into two sys/bios tasks. This function is called from the boot routine in ./src/ti/runtime/boot.c.
  • Hello Eric,

    I need to clarify your suggestions here, but in the meanwhile, I got a lot of questions about OpenMP/NDK from my customer. I`ve posted some on keystone e2e forum. I`ll get back here after closing them. Hopefully, you could also help us out on those threads.

    Best Regards,
    Naoki