I have parallelized the following piece of code:
- Code: Select all
#pragma omp parallel
{
#pragma omp for ordered schedule (dynamic, chunk)
for (CntCds = 0; CntCds < NbCds; CntCds++) {
/* Calcul the lambdas using the bisection method */
lcMKTcpsLmbBisMth (CpsTyp, CalDat, LdMkt, CdsCrv, CntCds);
/* Calcul cumulative probability for the calculated lambda */
MKTcrvFind (LlCps, CdsCrv, &LdCps);
MKTcpsPrbCum (CntCds, LdCps);
/* Calcul BPV */
lcMKTcpsCalBpv (CpsTyp, CalDat, LdMkt, LdCps, CdsCrv, CntCds);
}
}
The problem is that I want some internal variables of one of the functions I call inside the loop (lcMKTcpsLmbBisMth) to be private for each thread. I guess I have to do something inside the function but what? Do I have to create a parallel section or something? How can I set these variables as private?
Thanks in advance.
Kind regards,
Aitor.
