CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

How to parallelize this fortran code by openmp

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 18, 2008, 22:36
Default How to parallelize this fortran code by openmp
  #1
ronac
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
  Reply With Quote

Old   May 11, 2016, 03:12
Default
  #2
New Member
 
ankesh
Join Date: Apr 2016
Posts: 2
Rep Power: 0
ankeshgoyal is on a distinguished road
i private default shared and reduction (:+c2)
ankeshgoyal is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 12:24.