[Tdg] Multiprocessor Compilation

Wesley Smith wesley.hoke at gmail.com
Thu Mar 29 01:34:27 PDT 2007


Just found out about this: http://www.openmp.org/ .  It's a standard
for compiling sections of code to run in parallel.  It will be built
into GCC 4.2, which is the next version.  It works with fortran, C,
and C++.  A sample fortran snippet looks like this:


* Initilize initial condition and RHS

!$omp parallel do private(xx,yy)
      do j = 1,m
         do i = 1,n
            xx = -1.0 + dx * dble(i-1)        ! -1 < x < 1
            yy = -1.0 + dy * dble(j-1)        ! -1 < y < 1
            u(i,j) = 0.0
            f(i,j) = -alpha *(1.0-xx*xx)*(1.0-yy*yy)
     &           - 2.0*(1.0-xx*xx)-2.0*(1.0-yy*yy)
         enddo
      enddo
!$omp end parallel do


Basically you provide #pragma-like compiler directives to specify what
code to compile and run in parallel.

wes



More information about the Tdg mailing list