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.

RTOS: TMS320C6678 OpenMP question

Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hello, experts,

I would like to ask some questions about openmp, I recently call OpenMP to do algorithm processing, encountered some problems. I designed a small test as follows, to see if it is successful to call openmp, and found that the execution time of the program without calling OpenMP is much less than that without calling openmp. According to reason, the time for calling OpenMP is less than that without calling. What's the reason? I don't know if my configuration is wrong. Please give me some advice, thank you.

this is my test

//#pragma omp parallel for shared(uart_i,uart_j) private(i)
for(i=0;i<1920000;i++)
{
for(uart_i=0;uart_i<1920000;uart_i++)
{
for(uart_j=0;uart_j<1920000;uart_j++);
}
if(i==1919999)
{
printf("will success\n");
}

}

  • Please post which processor and which SDK you are using.
  • Thank you for your reply Biser,

    the processor is 6678 .

    I'm using mcsdk_2_01_02_05 and omp_1_01_03_02
  • This is my .cfg file and I want to know where I should change file .

    /*******************************************************************************************
    * Specify all needed RTSC Moudles and configure them. *
    ********************************************************************************************/

    var Memory = xdc.useModule('xdc.runtime.Memory');
    var Log = xdc.useModule('xdc.runtime.Log');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
    var Startup = xdc.useModule('xdc.runtime.Startup');
    var System = xdc.useModule('xdc.runtime.System');
    var Main = xdc.useModule("xdc.runtime.Main");
    var SysMin = xdc.useModule("xdc.runtime.SysMin");
    var Srio = xdc.loadPackage('ti.drv.srio');
    System.SupportProxy = SysMin;
    SysMin.bufSize = 0x8000;


    /* Load and configure SYSBIOS packages */
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var Ecm = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
    var BiosCache = xdc.useModule('ti.sysbios.hal.Cache');
    var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var Exc = xdc.useModule('ti.sysbios.family.c64p.Exception');
    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');

    BIOS.taskEnabled = true;//
    Task.common$.namedInstance = true;

    var C64_Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
    var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');//
    var Sem = xdc.useModule('ti.sysbios.knl.Semaphore');

    /* Create a Heap. */
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = 0x8000;
    heapMemParams.sectionName = "systemHeapL2";
    Program.global.heap0 = HeapMem.create(heapMemParams);




    /*
    * Enable Event Groups here and registering of ISR for specific GEM INTC is done
    * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
    */
    Ecm.eventGroupHwiNum[0] = 7;
    Ecm.eventGroupHwiNum[1] = 8;
    Ecm.eventGroupHwiNum[2] = 9;
    Ecm.eventGroupHwiNum[3] = 10;

    /* Create a Heap. */
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = 0x800000;
    heapMemParams.sectionName = "ddr_heap";
    Program.global.ddr_heap = HeapMem.create(heapMemParams);


    /*
    ** This allows the heart beat (poll function) to be created but does not generate the stack threads
    **
    ** Look in the cdoc (help files) to see what CfgAddEntry items can be configured. We tell it NOT
    ** to create any stack threads (services) as we configure those ourselves in our Main Task
    ** thread.
    */
    //Global.enableCodeGeneration = false;

    /* Load the PDK packages */
    var Csl = xdc.useModule('ti.csl.Settings');
    var Pa = xdc.useModule('ti.drv.pa.Settings');
    var Cppi = xdc.loadPackage('ti.drv.cppi');
    var Qmss = xdc.loadPackage('ti.drv.qmss');

    /* Load the Platform/NDK Transport packages */
    var PlatformLib = xdc.loadPackage('ti.platform.evmc6678l');


    /* Use more efficient Notify driver */
    var Notify = xdc.module('ti.sdo.ipc.Notify');
    Notify.SetupProxy = xdc.module('ti.sdo.ipc.family.c647x.NotifyCircSetup');

    /* Use more efficient MessageQ transport */
    var MessageQ = xdc.module('ti.sdo.ipc.MessageQ');
    MessageQ.SetupTransportProxy = xdc.useModule('ti.sdo.ipc.transports.TransportShmNotifySetup');

    Startup.firstFxns.$add('&lld_init');


    var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');



    /* Load OpenMP module */
    var OpenMP = xdc.useModule('ti.omp.utils.OpenMP');
    OpenMP.stackSize = 0x4000;
    OpenMP.setNumProcessors(7);
    OpenMP.qmssInit = false;
    OpenMP.ipcHeapSize = 0x30000;
    OpenMP.qmssMemRegion = -1;
    OpenMP.qmssStartIndex = 0;
    OpenMP.qmssDestQueueNum = -1;
    OpenMP.stackRegionId = -1;
    OpenMP.internalOsal = true;
    OpenMP.cppiHwSem = 3;//3
    OpenMP.qmssHwSem = 4;
    OpenMP.mpaxIndex = 3;//3
    OpenMP.enableMemoryConsistency = false;

    // Configure HeapOMP

    // 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: 0x80000000,
    len: HeapOMP.sharedHeapSize,
    ownerProcId: 0,
    cacheLineSize: 0,
    cacheEnable: false,
    createHeap: true,
    isValid: true,
    name: "sr2-ddr3",
    }
    );


    // Initialize HeapMem parameters
    var HeapOMP = xdc.useModule('ti.omp.utils.HeapOMP');
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = HeapOMP.localHeapSize;

    // Create a HeapOMP instance
    var heapOmpParams = new HeapOMP.Params();
    heapOmpParams.localHeap = HeapMem.create(heapMemParams)
    heapOmpParams.sRegionId = HeapOMP.sharedRegionId;

    // Setup defaultHeapInstance to a HeapOMP instance

    var Memory = xdc.useModule('xdc.runtime.Memory');
    if (Memory.defaultHeapInstance)
    Program.$logWarning("Memory.defaultHeapInstance already set!", this);

    Memory.defaultHeapInstance = HeapOMP.create(heapOmpParams)

    Task.defaultStackSize = 0x4000;
    //BIOS.heapSize = 0x50000;

    Program.sectMap[".cio"] = {loadSegment: "L2SRAM", loadAlign:8};
    Program.sectMap[".args"] = {loadSegment: "L2SRAM", loadAlign:8};
    Program.sectMap[".cppi"] = {loadSegment: "MSMCSRAM", loadAlign:16};
    Program.sectMap[".qmss"] = {loadSegment: "MSMCSRAM", loadAlign:16};
    Program.sectMap[".nimu_eth_ll2"] = {loadSegment: "MSMCSRAM", loadAlign:16};
    Program.sectMap[".resmgr_memregion"] = {loadSegment: "MSMCSRAM", loadAlign:128};

    Program.sectMap[".gPaCmdBuf1Section"] = {loadSegment: "L2SRAM", loadAlign:128};
    Program.sectMap["systemHeapL2"] = "L2SRAM";

    Program.sectMap[".resmgr_handles"] = {loadSegment: "MSMCSRAM", loadAlign:16};
    Program.sectMap[".resmgr_pa"] = {loadSegment: "MSMCSRAM", loadAlign:8};

    Program.sectMap["ddr_heap"] = "DDR3";
    Program.sectMap[".plt"] = "MSMCSRAM";
    Program.sectMap["platform_lib"] = "MSMCSRAM";////MSMCSRAM_NOCACHE
    Program.sectMap[".text"] = "DDR3";

    Program.sectMap[".srioSharedMem"] = "MSMCSRAM_NOCACHE";

    Program.sectMap["ddr"] = new Program.SectionSpec();
    Program.sectMap["ddr"].loadSegment = "DDR3";
    Program.sectMap[".threadprivate"] = new Program.SectionSpec();
    Program.sectMap[".threadprivate"].loadSegment = "L2SRAM";

    Program.sectMap[".testimage"] = "DDR3"; //"DDR3";

    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
    Cache.setMarMeta(0x80000000, 0x1000000, 0);
    Cache.setMarMeta(0x81000000, 0x1f000000, 1);
    Cache.setMarMeta(0xa1000000, 0x1f000000, 0);

    /* Add init function */
    Startup.lastFxns.$add('&EVM_init');//

    /*BIOS.libType = BIOS.LibType_Debug;*/
  • Hi,

    MCSDK is now maintained in Processor SDK (www.ti.com/.../PROCESSOR-SDK-C667X ), and the latest OpenMP release is 2.6.2.1 from PRSDK. Please rebase your project to the latest Processor SDK and OMP, let us know if you still see any issue.

    Regards,
    Garrett