[fpc-pascal] Common OpenMP syntax?
Michael Van Canneyt
michael at freepascal.org
Wed Jul 26 11:46:40 CEST 2006
On Wed, 26 Jul 2006, Micha Nelissen wrote:
> Michael Van Canneyt wrote:
> >> The latter.
> > Which is why I think that it's better to have them as local functions,
> > instead of having to introduce a lot of new functions.
> There is no real reason to restrict 'parallel' to local functions, is
> there ?
No, but I used that because in the example you make use of variables
defined in the local function, but also in the parent function.
It seems obvious to me that a global function can be called in parallel
at any time. The compiler can perfectly detect whether a global
function writes to variables outside it's own scope, in which case
it's probably a no-no to paralellize the function. The programmer
could help there by adding the parallel keyword indicating that
the programmer knows it is safe to parallelize it.
For local functions it is less obvious, there the compiler could use
some help in most cases...
More information about the fpc-pascal