[fpc-pascal] Common OpenMP syntax?
Andreas at TheBergerClan.org
Wed Jul 26 12:05:53 CEST 2006
Steve Williams wrote:
> Michael Van Canneyt wrote:
>> 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.
>> Local functions are very pascal-ish. C doesn't have it, which is why
>> they can't use it.
>> Let's use the language features to their full extent.
> *procedure* SubTask(*var* x : *array of* Float);
> /// Variables declared here have /|*private*|/ context./
> iam : Integer;
> nt : Integer;
> ipoints : Integer;
> iam := OMP.Get_Thread_Num; /// OMP library calls./
> nt := OMP.Get_Num_Threads;
> ipoints := Length (x) *div* nt; /// size of partition/
> istart := iam * ipoints; /// starting array index/
> *if* iam = Pred (nt) *then*
> ipoints := Length (x) - istart; /// last thread may do more/
> SubDomain (x, istart, ipoints);
Wouldn't it be better to write it like this:
procedure SubTask(var x: array of Float); *parallel*;
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal