Hi,
I have a collective of questions about OpenMP in TI’s MCSDK 2.1.0.3 and CGT 7.4.1 for C6678L EVM board. Correct me if I’m wrong since at this time, we are still waiting for the complete documentation of OpenMP in TI’s MCSDK and CGT. This is also for my better understanding of the OpenMP implementation. I have a basic OpenMP programming in desktop environment where memory is not the issue.
As we all know, OpenMP in its pragma has 2 types of variables, shared and private.
#pragma omp parallel private(a, b, c) shared(p_slice)
1. Q1: Am I right that the shared region is declared by the following codes (taken from omp_config.cfg). From my reading, .sharedRegionId = 2 points to DDR3 memory region. From these lines, it shows that any variables that needs to be shared among cores needs to be declared in memory region with base 0x90000000 and length 0x1000000, which is in DDR3 region (0x80000000 with length of 0x20000000).
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
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",
}
);
In BiosMulticoreSDK 2.1 User Guide also says that all global and static variables are shared, and all dynamically allocated memory is shared. Q2: Does this mean that the compiler will automatically put all global and static variables in the region? Q3: If not, how can we declare a static variable in this region? Q4: Can we use the whole portion of DDR3 (base: 0x80000000 len: 0x20000000) as shared region?
2. Q5: Am I right that the private region is declared as .threadprivate section as in
Program.sectMap[".threadprivate"] = new Program.SectionSpec();
Program.sectMap[".threadprivate"].loadSegment = "L2SRAM";
Q6: This L2SRAM from the TMS320C6678 Memory Map refers to Local L2 SRAM (0x00800000) and not each core’s L2 SRAM (0x10800000, 0x11800000 etc.). If I want to write a SPMD (Single Program Multiple Data) program and I want to have variables that are private for each core, how can I do that? The private variables (my guess) should be in the each core’s L2 SRAM.Q7: Can I change the .threadprivate to other memory region such as DDR3?
3. What is .stackSize as in the following lines? From this link, Ajay Jayaraj said that this is for local variables in main thread. Q7: Does this variable is shared between cores/threads?
var OpenMP = xdc.useModule('ti.omp.utils.OpenMP');
OpenMP.stackSize = 0x800000;
OpenMP.stackRegionId = 2;
Q8: If OpenMP.stackRegionID is set to -1, is it true that the memory region being used is the MSMCSRAM (0x0C000000)?
4. Q9: What is DDR3_NOCACHE in demos.image_processing.openmp.evmc6678l.platform RTSC platform as in the image_processing_openmp_evmc6678l? Here, Ajay Jayaraj said that this is from the older version of OpenMP runtime. Q10: Does that mean in the project, we can change
Program.sectMap["ddr"] = new Program.SectionSpec();
Program.sectMap["ddr"].loadSegment = "DDR3_NOCACHE";
to
Program.sectMap["ddr"] = new Program.SectionSpec();
Program.sectMap["ddr"].loadSegment = "DDR3";
and we can delete the DDR3_NOCACHE in the RTSC platform (DDR3_NOCACHE is as shown below)?
5. Q11: What is the purpose of MSMCSRAM_NOCACHE? Is it similar to DDR3_NOCACHE?
Hope this can be beneficial to others as well.
Rizuan