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.

Questions about OpenMP and its Memory

Other Parts Discussed in Thread: TMS320C6678

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

  • RIZUAN said:

    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";

    No. Prior to OpenMP 1.1.2.6 in MCSDK 2.1.0.3, the .threadprivate section was used to implement the OpenMP threadprivate directive. This section is no longer required. The OpenMP runtime uses Thread Local Storage (TLS) to implement threadprivate.

  • RIZUAN said:
    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.

    Shared region 2 is used to create a heap in shared memory. All dynamic allocation (from the runtime or the user's application) are done out of this heap.

  • RIZUAN said:
    Q2: Does this mean that the compiler will automatically put all global and static variables in the region?

    The Platform file (Platform.xdc) maps dataMemory to DDR3_DATA. This results in global and static variables being mapped to the DDR3_DATA memory range which is shared across all the cores.

  • RIZUAN said:
    Q11: What is the purpose of MSMCSRAM_NOCACHE? Is it similar to DDR3_NOCACHE?

    The MSMCSRAM_NOCACHE memory region maps to on-chip shared memory. For details on the memory system, refer KeyStone Overview @ http://processors.wiki.ti.com/index.php/Keystone/Trainings

  • Hi Ajay,

    Sorry for the delay in replying your feedback.

    Ajay Jayaraj said:
    No. Prior to OpenMP 1.1.2.6 in MCSDK 2.1.0.3, the .threadprivate section was used to implement the OpenMP threadprivate directive. This section is no longer required. The OpenMP runtime uses Thread Local Storage (TLS) to implement threadprivate.

    I noticed that on 6th October 2012, TI has released MCSDK 2.1.1.4 (OpenMP ver as before, 1.1.2.6). Again, in the image processing demo and all the example, I still can see the usage of .threadprivate, DDR3_NOCACHE etc. Are these still in use in the omp 1.1.2.6 ?

    Rizuan

  • Hi Ajay,

    I really need a large memory in my code, can you comment on this?

    RIZUAN said:

    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

    Rizuan

  • Hi,

    RIZUAN said:
    #pragma omp parallel private(a, b, c) shared(p_slice)

    What is the memory region used for private variables ?

    Rizuan

  • Please see this thread.  -George