[fpc-pascal] Common OpenMP syntax?

Marc Weustink marc at dommelstein.net
Fri Jul 21 01:24:45 CEST 2006


Steve Williams wrote:
> Marc Weustink wrote:
> 
>> Steve Williams wrote:
>>  
>>
>>> I would suggest something along the lines of the C/C++ 
>>> implementation, but using the Pascal form of compiler directives.
>>>
>>> Using some of the documented examples in the v2.5 spec:
>>>
>>> Example A.1.1:
>>> procedure a1(n: Integer; a: PSingleArray; b: PSingleArray);
>>> var
>>>  i: Integer;
>>> begin
>>>  {$omp parallel for}
>>>  for i := 1 to n - 1 do
>>>    b^[i] := (a^[i] + a^[i - 1]) / 2.0;
>>> end;
>>>     
>>
>>
>> Brrr.... using local defines look not native to the language.
>> Why not something like as (refered in another thread) pascal-fc which 
>> uses cobegin..coend or known blocks like asm..end; try..end;
>>
>> for instance:
>>   omp..end;
>>   parralel..end;
>>   
> 
> 
> One of the pretexts behind OpenMP is that the code will still compile if 
> OpenMP is not available or disabled on a particular compiler. 

Mwah... in that case you can still use the same keywords, only it won't 
be much parallel, since it's executed in one thread.
And beeing executed in one or more threads should not matter in parallel 
blocks.

Marc

> That's 
> the reason behind using compiler directives instead of new keywords.  
> Using compiler directives similar to the C/C++ directives also means 

eehh... to repeat what someone else already mentioned in this thread,
if I want to use C, I don't use pascal.

Marc.

> that the wealth of information already out there is instantly applicable 
> to the Pascal version.
> 




More information about the fpc-pascal mailing list