Hi,
I am working with a TMDSEVM6678LE and I want to use
a openMP example for adapt my code to use 8 cores.
Now I am tryng openMp example using just 4 cores it prints
hello World form core 0,..,7 etc., until here everything is ok,
but when I add some code for sum values from two arrays and
store result in third one the breakpoints seems does not stop(does not appear
an arrow over blue circle instead a red dashed underlineunder blue circle) and values of variable are not available
in variables windows.
Here my code:
#include <ti/omp/omp.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <time.h>
#define NTHREADS 4
int a[1000];
int b[1000];
int c[1000];
int i;
void main()
{
int nthreads, tid,i,istart,iend;
nthreads = NTHREADS;
for(i=0;i<1000;i++)
{
a[i]=i;
b[i]=1;
}
omp_set_num_threads(NTHREADS);
/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(nthreads, tid,i, istart, iend)
{
/* Obtain thread number */
tid = omp_get_thread_num();
printf("Hello from core %d\n", tid);
nthreads = omp_get_num_threads();
printf("Core number is; %d\n", nthreads);
istart = tid*1000/nthreads;
iend = (tid+1)*1000/nthreads;
for(i=istart;i<iend;i++)
{
c[i] = a[i] +b[i];
printf("Thread[%d] sum [%d] is = %d\n",tid,i,c[i]);
}
a[1] = b[1];
} /* All threads join master thread and disband */
}
Any help will be appreciated.
Julian