|
[Sponsors] |
June 25, 2021, 05:51 |
One severe limitation of OpenMP
|
#1 |
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8 |
If you got 8 threads, you use as many threads as possible.
However, OpenMP only allows control on a per-loop basis. I have this bit of section in my solver, I calculate rho_inverse, a, a_inverse, PSV from CSV, pressure etc : Code:
// // --- prepare commonly used data --- // // calculate rho inverse // inv_arrays(ri_, un1_, 1.0, ncells); // calculate x velocity, y velocity, energy // mul_arrays(vx_, un2_, ri_, ncells); mul_arrays(vy_, un3_, ri_, ncells); mul_arrays(e_ , un4_, ri_, ncells); // calculate pressure // calc_pressure(p_, un1_, e_, vx_, vy_, 0.4, ncells); // calculate the local speed of sound for all cells at once // calc_spdsound(a_, p_, ri_, 1.4, ncells); // calculate the reciprocal of the local speed of sound for all cells // inv_arrays(ai_, a_, 1.0, ncells); The speedup would come from calculating the x,y,e values in parallel, instead of doing them serially one after another. This kind of optimization opportunities are present throughout the code. However, OpenMP provides limited control. There's OpenMP sections, and that's what I'm currently using, but they're very limited. Using OpenMP sections, I can hardcode instructions to calculate x,y,e in parallel. However, since they're hardcoded, they're not scalable when we have more threads to use, and more equations to solve in parallel. Will probably keep using OpenMP sections, until I find a better alternative. If anyone knows of a better solution, kindly let me know. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using OpenMP similar to MPI? Bad idea? | aerosayan | Main CFD Forum | 3 | January 6, 2021 06:42 |
Particle tracking INTEGER limitation warning | Peter023 | FLUENT | 0 | June 24, 2013 04:59 |
[Netgen] Import netgen mesh to OpenFOAM | hsieh | OpenFOAM Meshing & Mesh Conversion | 32 | September 13, 2011 06:50 |
Severe nonorthogonality and severe skewness problem | qtian | OpenFOAM Running, Solving & CFD | 2 | January 22, 2008 19:47 |
OpenMP and fortran | John Deas | Main CFD Forum | 0 | May 17, 2007 17:53 |