Part Number: TMS320C6678
Hi all,
My customer have 2 questions while using OpenMP multi-core application.
1. When running the demo listed below, single-core cost 0.21s, quad-core cost 0.17s, eight-core cost 0.14s, why the time cost isn't multiple? What are the additional overhead when using OpenMP multi-core?
2. When running customer's own algorithm, single-core cost 0.8s, quad-core cost 0.9s, eight-core cost 0.3s, why the time cost of quad-core is higher than single-core? And how to optimize it?
#include <ti/omp/omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <c6x.h>
void test()
{
int a = 0;
for (int j = 0; j<100000; j++)
a++;
}
void main()
{
int i;
printf("starting running\n");
unsigned long long t1,t2;
TSCL = 0;
TSCH = 0;
t1 = _itoll(TSCH,TSCL);
#pragma omp parallel for private(i)
for ( i = 0; i<100; i++){
test();
}
t2 = _itoll(TSCH,TSCL);
printf("time is: %ld\n",(t2-t1)/10000);
}
Thanks,
Wesley.