|
[Sponsors] |
How to parallelize this fortran code by openmp |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 18, 2008, 22:36 |
How to parallelize this fortran code by openmp
|
#1 |
Guest
Posts: n/a
|
Dear all,
I have a fortran code to calculate particle motion. there are alway many big loops. Some guy suggest me to use openmp to speed it up. the following is the pseudo code. Do I do it correctly? c$OMP PARALLEL DO DEFAULT(SHARED), PRIVATE(i,ni,c2,ks,ke) do i=1,ni a(i)=c1 c2=0 ks=lfirst(i) ke=last(i) do k=ks,ke c2=c2+f(k) c3=f1+f2 ................ c4=f+f3 enddo f(i)=c2+c3 enddo It can be seen that the loop i in the code is independent, but loop k is dependent. All calculations mainly happen in loop k which is small, up to 8. The loop i is always big, up to 200,000. I only want to use openmp for loop i. Your hints would be greatly appreciated. Cheers,ronac |
|
May 11, 2016, 03:12 |
|
#2 |
New Member
ankesh
Join Date: Apr 2016
Posts: 2
Rep Power: 0 |
i private default shared and reduction (:+c2)
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFX11 + Fortran compiler ? | Mohan | CFX | 20 | March 30, 2011 19:56 |
fortran code | HaKu | Main CFD Forum | 1 | February 17, 2010 10:57 |
3D fortran Navier-Stokes code | emrah | Main CFD Forum | 4 | December 15, 2007 10:53 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |
Multi-dimensional heat conduction fortran code | odat | Main CFD Forum | 1 | August 6, 1999 01:18 |