|
[Sponsors] |
No different caculation speed between serial and openMP code? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 10, 2020, 07:37 |
No different caculation speed between serial and openMP code?
|
#1 |
New Member
Anh Dinh Le
Join Date: Apr 2020
Posts: 24
Rep Power: 6 |
Dear experts,
I wrote my own fortran code for multiphase flow problems. My code was originally in serial form. I submit the batch job file to compiler to use 20cpus for my code. The calculation time was much faster than the ifort command only. Here is the batch job file: #!/bin/bash #SBATCH --job-name=testOMP #SBATCH --nodes=1 #SBATCH --ntasks-per-node=1 #SBATCH --cpus-per-task=20 #SBATCH --exclusive #SBATCH --time=0-20:00:00 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK} time ./2D-test Then I modified the serial code to openMP parallel used the !$omp parallel do/end parallel do. However, there was nos different calculation speed between serial and parallel code. The way I modified shown in picture (part of code). Please give advice. Did I modified the code correctly? |
|
May 12, 2020, 18:12 |
|
#2 | |
Super Moderator
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49 |
That's not a whole lot of information. And I don't know what to make of this statement:
Quote:
There is not too much to work with, and to be honest, I don't have a whole lot of first-hand experience with OpenMP for this type of structured grids. Here is a more general check list for "my OpenMP code doesn't scale". In no particular order, and definitely incomplete.
Further reading: https://moodle.rrze.uni-erlangen.de/...iew.php?id=310 Yes, that's the material for a a full 3-day course. Turning a serial code into OpenMP parallel is the easy part. Getting decent performance and scaling is the harder part. |
||
May 15, 2020, 14:15 |
|
#3 |
New Member
Pedro Costa
Join Date: Jul 2017
Posts: 9
Rep Power: 9 |
You are only parallelizing the outer loop. You would need to have something like:
Code:
$OMP DO COLLAPSE(2) |
|
May 15, 2020, 21:00 |
|
#4 | |
New Member
Anh Dinh Le
Join Date: Apr 2020
Posts: 24
Rep Power: 6 |
Quote:
I did make the COLLAPSE(2) and (3), the same resulted. I tried to optimize the serial code structure, the calculation speed up now (a bit). Still dont know how to improve the parallel run. Maybe the parallel calculation cannot show the improvement for such small number of grid point (279 x 70) or maybe I made the wrong BATCH job for openMP. |
||
May 16, 2020, 05:17 |
|
#5 |
Senior Member
|
I strongly suggest to avoid testing on a system with a job scheduler which might be shared with others... at least not this kind of test, where you don't know if everything works correctly (even if you might be alone on a given node).
These days there is no single pc, or even cell phone for that matter, that has a single processor anymore, so you are plenty of possibilities when it comes to testing. Only go to larger machines when you are absolutely sure that everything works on the smaller ones and, of course, when you know how to use their job schedulers. In this specific case, however, the size of the problem looks absolutely small to achieve any relevant speedup in parallel. This would be true in MPI but it is even more so in openmp. If you are absolutely true that the only problem might be the size of your task, just throw something bigger at it, like 10 or 100 bigger. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Parallel Fortran 95 code using Openmp | Shiv1510 | Main CFD Forum | 5 | February 14, 2020 12:36 |
openmp with single processor | Ravindra Shende | Main CFD Forum | 2 | July 15, 2013 11:51 |
OpenMP in Junction Box Routine | Hannes_Kiel | CFX | 10 | September 21, 2010 14:51 |