openmp - run 2 different functions simultaneously C++ Open MP -
i want run 2 absolutely different functions simultaneously. tried check if works:
#pragma omp parallel { #pragma omp single nowait { #pragma omp task { (unsigned long long i=0; i<numsteps; i++) sum1 = sum1 + 4.0/(1.+ (i + .5)*step*(i + .5)*step); } #pragma omp task { (unsigned long long i=0; i<numsteps; i++) sum2 = sum2 + 4.0/(1.+ (i + .5)*step*(i + .5)*step); } #pragma omp taskwait } }
with 1 cycle ends in 10s , loads cpu on 100%.
with 2 cycles want run simultaneously on 2 different cores ends in 24s , loads cpu on 200% expected near 10s.
without #pragma omp single nowait
ends calculations in 138s , loads cpu on 400%.
what doing wrong?
Comments
Post a Comment