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.
Hi, all
How should I program right when I need each section code run parallel?
I tried like following:
-----the .cfg file-----
// allocate out of this shared region heap after IPC has been started. var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion'); // Configure HeapOMP for the shared memory heap // HeapOMP created in ti/omp/common.cfg.xs var HeapOMP = xdc.useModule('ti.omp.utils.HeapOMP'); HeapOMP.sharedRegionId = 2; HeapOMP.localHeapSize = 0x20000; HeapOMP.sharedHeapSize = 0x1000000; // Specify the Shared Region SharedRegion.setEntryMeta( HeapOMP.sharedRegionId, { base: 0x90000000, len: HeapOMP.sharedHeapSize, ownerProcId: 0, cacheEnable: true, createHeap: true, isValid: true, name: "heapomp", } ); /* load the common configuration file */ xdc.loadCapsule('ti/omp/common.cfg.xs'); var System = xdc.useModule('xdc.runtime.System'); System.extendedFormats = "%$S"; var OpenMP = xdc.useModule('ti.omp.utils.OpenMP'); OpenMP.setNumProcessors(4); OpenMP.autoDnldCore = false; //add this line Program.sectMap["ddr"] = new Program.SectionSpec(); Program.sectMap["ddr"].loadSegment = "DDR3"; Program.sectMap[".threadprivate"] = new Program.SectionSpec(); Program.sectMap[".threadprivate"].loadSegment = "L2SRAM"; // Enable Cache Write-back for HEAPOMP var Cache = xdc.useModule('ti.sysbios.family.c66.Cache'); Cache.setMarMeta(0x80000000, 0x20000000, Cache.PC | Cache.WTE);
-----the C file-----
void main()
{
......
#pragma omp parallel sections //------>this is the line where error occur { #pragma omp section { // other code printf("ThreadId is %d\n", omp_get_thread_num()); } #pragma omp section { // other code printf("ThreadId is %d\n", omp_get_thread_num()); } #pragma omp section { // other code printf("ThreadId is %d\n", omp_get_thread_num()); } #pragma omp section { // other code printf("ThreadId is %d\n", omp_get_thread_num()); } }
......
}
But when I build this, It occurred " error #1510: syntax error in OpenMP pragma "
Can anyone tell me why?
Mike,
Regards.
Hi Mike,
Have you executed the examples provided by TI? Please refer examples from below TI wiki.
http://processors.wiki.ti.com/index.php/OpenMP_on_C6000
If you have problems in building examples, please ensure to use CGT(compiler) version 7.4.x.
I hope this helps.
Thanks.
Hi, Rajasekaran K,
The compiler is version 7.4.0, I think the problem is the c grammar's error.
Can you tell me if I a bunch of code section need to be run parallel, how should I program the code?
Thanks.
Hi Mike,
Please refer openmp specification documents for syntax and examples.
http://openmp.org/wp/openmp-specifications/
I hope this helps.
Thanks.