[Beowulf] OpenMP on AMD dual core processors

Nathan Moore ntmoore at gmail.com
Fri Nov 21 10:42:37 EST 2008


What a relief that no one castigated me for including a "goto"!  I'm
teaching out of Kupferschmid's "Classical Fortran", and he makes a rather
compelling case that goto s actually more pedagogically sound (for
beginners) than "do while"

Successive steps in the equilibration are time-dependant, so they're
IMPOSSIBLE to parallelize.  I suppose I could get around the
re-initialization by including a "SINGLE" directive around the iteration
control structure.

Nathan

On Fri, Nov 21, 2008 at 9:05 AM, <rssr at lncc.br> wrote:

> Hi All
>
> I thing the problem could be the  convergence "loop" test and the criation
> of threads
>
> 10 converged = 1
> !$OMP PARALLEL
> !$OMP DO
> .....
> !$OMP ENDDO
> !$OMP END PARALLEL
> if(converged.eq.0) then
>
>      goto 10
> endif
>
> Each time you "goto 10"
> the compiler "create" and "initialize" the threads
> and this is time comsuming.
> try to change the convergence test to a
> reduce operation this will
> take time but not some much as !$OMP
> PARALLEL
>
> I hope its help
>
> Renato Silva
>
>
>
> > Hi All,
> >
> > I'm getting to the end of a semester of computational physics at my
> > institution, and thought it would be fin to close the semester with a
> > discussion of parallel programming. Initially, I was simply planning to
> > discuss MPI, but while reading through the gfortran man page I realized
> > that
> > gcc now supports OpenMP directives.
> >
> > Given that the machines my students are using are all dual core, I
> started
> > working on a simple example that I hoped would show a nice speedup from
> > the
> > "easy" library.
> >
> > The specific problem I'm working on is a 2-d solution to the laplace
> > equation (electrostatics). The bulk of the computation is a recursion
> > relation, applied to elements of a 2-d array, according to the following
> > snippet.
> >
> > Of course, by now I should know that "simple" never really is. When I
> > compile with gfortran and run with 1 or 2 cores (ie, OMP_NUM_THREADS=2,
> > export OMP_NUM_THREADS) there is basically no difference in execution
> > time.
> >
> >
> > Any suggestions? I figured that this would be a simple example to
> > parallelize. Is there a better example for OpenMP parallelization? Also,
> > is there something obvious I'm missing in the example below?
> >
> > Nathan Moore
> >
> > integer,parameter::Nx=1000
> > integer,parameter::Ny=1000
> > real*8 v(Nx,Ny)
> > integer boundary(Nx,Ny)
> >
> > v_cloud = -1.0e-4
> > v_ground = 0.d0
> >
> > convergence_v = dabs(v_ground-v_cloud)/(1.d0*Ny*Ny)
> >
> > ! initialize the the boundary conditions
> > do i=1,Nx
> > do j=1,Ny
> > v_y = v_ground + (v_cloud-v_ground)*(j*dy/Ly)
> > boundary(i,j)=0
> > v(i,j) = v_y
> > ! we need to ensure that the edges of the domain are held
> > as
> > boundary
> > if(i.eq.0 .or. i.eq.Nx .or. j.eq.0 .or. j.eq.Ny) then
> > boundary(i,j)=1
> > endif
> > end do
> > end do
> >
> > 10 converged = 1
> > !$OMP PARALLEL
> > !$OMP DO
> > do i=1,Nx
> > do j=1,Ny
> > if(boundary(i,j).eq.0) then
> > old_v = v(i,j)
> > v(i,j) =
> > 0.25*(v(i-1,j)+v(i+1,j)+v(i,j+1)+v(i,j-1))
> > dv = dabs(old_v-v(i,j))
> > if(dv.gt.convergence_v) then
> > converged = 0
> > endif
> > endif
> > end do
> > end do
> > !$OMP ENDDO
> > !$OMP END PARALLEL
> > if(converged.eq.0) then
> > goto 10
> > endif
> > _______________________________________________
> > Beowulf mailing list, Beowulf at beowulf.org
> > To change your subscription (digest mode or unsubscribe) visit
> > http://www.beowulf.org/mailman/listinfo/beowulf
> >
>



-- 
- - - - - - -   - - - - - - -   - - - - - - -
Nathan Moore
Assistant Professor, Physics
Winona State University
AIM: nmoorewsu
- - - - - - -   - - - - - - -   - - - - - - -

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.clustermonkey.net/pipermail/beowulf/attachments/20081121/127b013f/attachment-0001.html>
-------------- next part --------------
_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf


More information about the Beowulf mailing list