[MPI3 Fortran] Fortran extra_state argument to MPIattributefunctions
Aleksandar Donev
donev1 at llnl.gov
Thu May 28 13:45:15 CDT 2009
Bill Long wrote:
> Besides the more formal methods mentioned by Aleks below, there is a
> common programming style approach to solve this problem: put the
> variable extra in a module.
This will work too, although it is not quite as guaranteed to work. This
is because when you first pass extra as an extra_state, you need to
somehow retain its address so you can refer to it later. Using LOC is
not conforming, and C_LOC requires TARGET. Using plain old argument
passing requires *matching* TARGETs on both the dummy and the actual to
be guaranteed to avoid copy in/out and thus work (this goes for FFTW as
well, though most codes, including mine, often cheat). Of course, if you
don't try to pass the address to extra but some "token" (Nick's word)
that means "look at extra", then the callback is free to modify the
variable extra and a compiler has to assume the worst.
Best,
Aleks
More information about the mpiwg-fortran
mailing list