Ti的工程师:
你们好,最近需要使用openMP,发现多核不能pirntf出信息到控制台上。代码如下,很简单:
void main() { int tid = 0; int nthreads = 0; omp_set_num_threads(8); #pragma omp parallel private(nthreads, tid) { tid = omp_get_thread_num(); printf("Hello World from thread = %d\n" ,tid); if (MultiProc_self() == 0) { nthreads = omp_get_num_threads(); printf("Number of threads = %d\n", nthreads); } } }
但是只有0和打印出消息到控制台上:
[C66xx_0] Hello World from thread = 0
[C66xx_0] Number of threads = 8
我查看了.CIO段是放在L2RAM中的,应该没问题啊,
不知道这里是个什么情况,下面是我的cfg配置:
var Log = xdc.useModule('xdc.runtime.Log'); var Diags = xdc.useModule('xdc.runtime.Diags'); // 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'); var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc'); var TaskKnl = xdc.useModule('ti.sysbios.knl.Task'); 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'); var SysStd = xdc.useModule('xdc.runtime.SysStd'); System.extendedFormats = "%$S"; System.SupportProxy = SysStd; var OpenMP = xdc.useModule('ti.omp.utils.OpenMP'); OpenMP.setNumProcessors(8); 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(0x90000000, 0x10000000, Cache.PC | Cache.WTE); var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc'); var Notify = xdc.useModule('ti.sdo.ipc.Notify'); var Ipc = xdc.useModule('ti.sdo.ipc.Ipc'); Program.sectMap[".testimage"] = "DDR3";
platform如下:
我也试了system_printf,也不行,因为我项目上要打印出多核的状态信息方便调试,所以需要解决这个问题。
感谢宝贵时间,网上也不好找到类似的情况,没办法至于求助你们了。
Thomas Yang1:
您用的是哪款芯片?哪个软件包
我们测试过TI 提供的OpenMP的例子在6678上是可以正常多核打印的
Bin Lu2:
回复 Thomas Yang1:
官方开发板,EVM6678LE,软件包是mcsdk_2_01_02_05 和 bios_6_33_06_50 我比较怀疑是CCS的设置问题,但是找了半天也没找到这么设置CIO的选项,现在是只有0核这个主核能够在控制台显示,其他的核打印不了消息。
Thomas Yang1:
回复 Bin Lu2:
谢谢反馈!