OpenMP thread-safety programming problem

  • Follow


I have an environmental modeling programming problem that I'm
trying to deal with, and would like suggestions...

I am trying to adapt a large (~25,000 LOC), non-thread-safe
atmospheric-aerosol thermodynamics code from US EPA to work
in an OpenMP parallel (3-D spatially gridded) atmospheric
chemistry/transport model.

The original code has one main entry point, for getting the response
for one grid-cell; I want to call that main entry point in parallel
from my model.  There are about 1000 "worker" routines; they communicate
(contrary to EPA coding standards, by the way) by means of data stored
and retrieved from various COMMONs, all of which are placed in one
single INCLUDE-file.  There is essentially no structural documentation,
and the coding style is one level up from "spaghetti."  The rest of the
community treats this sub-model basically as an incomprehensible black
box.

The obvious solution is to have one single main subroutine, move all
the variables from the COMMONs into local variables in it, and to make
all the "worker" routines CONTAINed subroutines.  (If I were to treat
this as a MODULE problem, I'd have all the thread-safety problems coming
from the COMMONs right back again.

But.

There are 10 lowest-level "worker" routines, each with an empty
argument-list, each dealing with a different part of the phase
space, and one "worker-driver" routine into which all 10 of these
are passed as arguments, after the current grid cell's state has
been stored into the COMMONs, and after the phase-case has been
determined.  This "worker-driver" is called 35 times, each time
with a different combination of pairs of the lowest-level worker
routines as arguments, depending upon the case (and sometimes called 
with humidity zero, then with the real humidity, and...).  That's
where this all breaks down:  at least according to Sun's "f95",
subroutine-arguments can't be CONTAINed in the same routine that
CONTAINs their caller...  (Intel "ifort" allows this, btw.)

The code is sufficiently complex that I don't want to have to go
through and figure out just what fifty-or-so-argument argument list
I'd have to pass into all these routines in order to make it all
work ;-(

Any suggestions?


Thanks --

Carlie J. Coats, Jr.
Environmental Modeling Center
Baron Advanced Meteorological Systems, LLC.
"My opinions are my own, and I've got *lots* of them!"
0
Reply carlie (79) 10/17/2007 9:26:09 PM


0 Replies
72 Views

(page loaded in 0.032 seconds)

Similiar Articles:













7/19/2012 6:57:09 PM


Reply: