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.

OpenMP多核共享问题

Other Parts Discussed in Thread: SYSBIOS

在.cfg文件中配置如下:
var OpenMP = xdc.useModule('ti.omp.utils.OpenMP');
OpenMP.setNumProcessors(4);

var HeapOMP = xdc.useModule('ti.omp.utils.HeapOMP');
var Settings = xdc.useModule('ti.csl.Settings');
var ti_platform_evmc6678l_Settings = xdc.useModule('ti.platform.evmc6678l.Settings');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Idle = xdc.useModule('ti.sysbios.knl.Idle');
HeapOMP.sharedRegionId = 2;
HeapOMP.localHeapSize  = 0x20000;
HeapOMP.sharedHeapSize = 0x1000000;


在main函数中代码如下: NTHREADS = 4
 omp_set_num_threads(NTHREADS);
 /* Fork a team of threads giving them their own copies of variables */
 #pragma omp parallel shared(Ompsum) private(nthreads,i)
 {
   for(i = 0; i < NTHREADS; i++)
   {
    Ompsum += 3;
      /* Get the core number. */
    //nthreads = omp_get_thread_num();
    coreNum = CSL_chipReadReg (CSL_CHIP_DNUM);
    printf("omp cores : %d \n,i=%d \n", coreNum,i);
   }
 }

程序只下载在核0中,实际打印出来的coreNum都是等于0。是不是表明程序都是在核0中,并没有并行处理程序?