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.

使用6678编程测试 多核比单核慢



测试内存区域:

extern unsigned int share_variable[];

for(i=0; i<327680; i++)
{
share_variable[i] = 1;
}

share_variable定义在DDR3中

单核测试:

t1 =TSCL;
for(i=0;i<327680;i++)
sum += share_variable[i];
t2 =TSCL;
printf("The sum is : %d. \n", sum);
printf("%d, task is done!\n", t2 - t1);

花费30ms

多核测试(使用了core1-7 共7个核):

if (CSL_semAcquireDirect(CoreNum) == 0)
printf("semAcquire failed!\n");

uint32_t len = 327680/7;
for(i=(CoreNum-1)*len;i<len*CoreNum;i++)
sum += share_variable[i];
printf("The sum is : %d. \n", sum);

CSL_semReleaseSemaphore (CoreNum);

在主核中发送IPC中断启动计算,并等待所有信号量被释放

t1 =TSCL;
for(i=1; i<8; i++)
    IssueInterruptToCore(i, 0x80000000);
Bool status = FALSE;
while(status == FALSE)
{
status = TRUE;
for(i=1; i<8; i++)
{
Bool coreStatus = FALSE;
coreStatus= CSL_semIsFree (i);
status &= coreStatus;
}
}
t2 =TSCL;
printf("%d, task is done!\n", t2 - t1);

共花费300ms

求解为什么。。是因为7个核通过EMIF去竞争读DDR3的关系吗?  如果有这方面的问题,该怎么去处理?