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.

#pragma omp parallel sections

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.