Common OpenMP syntax?

classic Classic list List threaded Threaded
50 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Common OpenMP syntax?

Florian Klämpfl
I'am currently thinking about implementing OpenMP support in FPC.
However, there is currently (to my knowledge) no pascal syntax defined
for OpenMp support. Do you think we can find a common syntax to simplify
things for users? I've some ideas how it be done, but I want to hear
other ideas first so they are maybe better if they aren't influenced by
my ideas :)

I started also a wiki page about it
http://www.freepascal.org/wiki/index.php/OpenMP_support where ideas can
be written down and shared.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Mattias Gaertner
On Mon, 17 Jul 2006 21:12:31 +0200
Florian Klaempfl <[hidden email]> wrote:

> I'am currently thinking about implementing OpenMP support in FPC.

There seems to be something in the air.
I had the same idea two weeks ago. Well, to be honest, I had the idea as I
heard of OpenMP 3 years ago, but now I want to finally do it.
I want to first write a tutorial for MPICH for FPC and then take a closer
look on OpenMP, to get used to it and find out it advantages and
disadvantages. We don't need to make the same errors as the C and Fortran
compilers.


> However, there is currently (to my knowledge) no pascal syntax defined
> for OpenMp support.

Right. AFAIK OpenMP is only a standard for C/C++ and Fortran. It's not an
implementation.


> Do you think we can find a common syntax to simplify
> things for users? I've some ideas how it be done, but I want to hear
> other ideas first so they are maybe better if they aren't influenced by
> my ideas :)
>
> I started also a wiki page about it
> http://www.freepascal.org/wiki/index.php/OpenMP_support where ideas can
> be written down and shared.

As soon as I done some more OpenMP experiments and made up my mind, I will
join. :)


Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Alexandre Leclerc
2006/7/17, Mattias Gaertner <[hidden email]>:
> On Mon, 17 Jul 2006 21:12:31 +0200
> Florian Klaempfl <[hidden email]> wrote:
> > However, there is currently (to my knowledge) no pascal syntax defined
> > for OpenMp support.
>
> Right. AFAIK OpenMP is only a standard for C/C++ and Fortran. It's not an
> implementation.

If ever it needed an implementation (which I'm glad to hear it is
not), maybe a section should be used like with asm (assembler) code.
At first glance (2 minutes) I was not able to grasp the big thing
about that; are we not yet able to do multi-threaded programming in
FPC?

--
Alexandre Leclerc
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Mattias Gaertner-2


On Tue, 18 Jul 2006, Alexandre Leclerc wrote:

> 2006/7/17, Mattias Gaertner <[hidden email]>:
> > On Mon, 17 Jul 2006 21:12:31 +0200
> > Florian Klaempfl <[hidden email]> wrote:
> > > However, there is currently (to my knowledge) no pascal syntax defined
> > > for OpenMp support.
> >
> > Right. AFAIK OpenMP is only a standard for C/C++ and Fortran. It's not an
> > implementation.
>
> If ever it needed an implementation (which I'm glad to hear it is
> not), maybe a section should be used like with asm (assembler) code.
> At first glance (2 minutes) I was not able to grasp the big thing
> about that; are we not yet able to do multi-threaded programming in
> FPC?

Yes, we are.
But creating and synchronizing threads needs often a lot of overhead,
measured in lines of code and in performance.
OpenMP is a specification, how to parallize code blocks easily and give
the compiler enough hints to optimize the code.
It is up to compiler developers to support it and provide an
implementation. Probably we can not name ours "OpenMP".


Mattias


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Marc Weustink
In reply to this post by Mattias Gaertner
Florian Klaempfl <[hidden email]> wrote:


>I'am currently thinking about implementing OpenMP support in FPC.

Is this similar as polyphinic C# ? (you gave me a link a while ago)

What I'm puzzeled with, usually an API specifies the interface to an
external library, where here it seems a spec how a language should
"behave" when implementing Multi Processing (and in this case for C++
and Fortran).

Is the idea to implement a similar, based on the ideas of openMP,
version for FPC?

Marc

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Prof A Olowofoyeku (The African Chief)
In reply to this post by Florian Klämpfl
On 17 Jul 2006 at 21:12, Florian Klaempfl  wrote:

> I'am currently thinking about implementing OpenMP support in FPC.
> However, there is currently (to my knowledge) no pascal syntax defined
> for OpenMp support. Do you think we can find a common syntax to simplify
> things for users? I've some ideas how it be done, but I want to hear
> other ideas first so they are maybe better if they aren't influenced by
> my ideas :)

The only suggestion that I have may be not very useful and may be very
obvious - but here goes anyway. Please make the interface as simple
(read "high level") as possible, providing high level wrappers for low
level routines if necessary. In many cases, writing Pascal interfaces
to C libraries often produces something that is no easier to use than
the original C interface, and for which one might as well use gcc.

Best regards, The Chief
--------
Prof. Abimbola A. Olowofoyeku (The African Chief)
web:  http://www.greatchief.plus.com/

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Steve Williams-3
In reply to this post by Florian Klämpfl
Florian Klaempfl wrote:

> I'am currently thinking about implementing OpenMP support in FPC.
> However, there is currently (to my knowledge) no pascal syntax defined
> for OpenMp support. Do you think we can find a common syntax to simplify
> things for users? I've some ideas how it be done, but I want to hear
> other ideas first so they are maybe better if they aren't influenced by
> my ideas :)
>
> I started also a wiki page about it
> http://www.freepascal.org/wiki/index.php/OpenMP_support where ideas can
> be written down and shared.
>  


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;

Example A.5.1:
uses omp;

begin
  omp_set_dynamic(1);
  {$omp parallel num_threads(10)}
  begin
    (* Do work here *)
  end;
end;

Example A.13.1:
interface

function dequeue(var a: Single): Integer;
procedure work(i: Integer; var a: Single);

implementation

procedure a13(var x: Single; var y: Single);
var
  ix_next, iy_next: Integer;
begin
  {$omp parallel shared(x, y) private(ix_next, iy_next)}
  begin
    {$omp critical (xaxis)}
      ix_next := dequeue(x);
    work(ix_next, x);

    {$omp critical (yaxis)}
      iy_next := dequeue(y);
    work(iy_next, y);
  end;
end;

--
Sly



This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Alexandre Leclerc
2006/7/20, Steve Williams <[hidden email]>:

> Florian Klaempfl wrote:
> > I'am currently thinking about implementing OpenMP support in FPC.
> > However, there is currently (to my knowledge) no pascal syntax defined
> > for OpenMp support. Do you think we can find a common syntax to simplify
> > things for users? I've some ideas how it be done, but I want to hear
> > other ideas first so they are maybe better if they aren't influenced by
> > my ideas :)
> >
> > I started also a wiki page about it
> > http://www.freepascal.org/wiki/index.php/OpenMP_support where ideas can
> > be written down and shared.
> >
>
>
> 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;

I fear this just looks like a terrible stranger-outsider pach to a
superbe language. :) If fpc peoples want to implement new language
syntax... may it be pascal-like and good looking. At least in the
previous example, a closing block would be required... as for myself:

{$omp parallel for}
...
[$omp end}

The same for the other examples. So if the directive is not understood
by the compiler, it becomes standard code without any problems. For
me, the best approach would be an unit to be used; not language
implementation. (In that unit you could have ugly compiler magic if
you want, but at least, when using this technology, it would be much
more like using a standard class or set of procedures.)

Any-way; Reagards.

--
Alexandre Leclerc
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Marco van de Voort

Isn't there a copascal that already has established concurent pascal syntax?

if not, the other wirthian languages look like logical providers?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Vinzent Höfler
Marco van de Voort wrote:

> Isn't there a copascal that already has established concurent pascal syntax?

Yes, there is, but its syntax is very limited AFAICS.

> if not, the other wirthian languages look like logical providers?

Ada tasking? Well, too much overkill, I think. ;)

My problem with the OpenMP stuff is that it's more C-centric than
concurrency-centric: Basically they give a compiler "hint"s that some
sequential statement could be executed concurrently.

A concurrent language goes a different way, there you would simply
instantiate the assignment multiple times whether its like "cobegin" in
ConcurrentPascal, "PAR" in Occam2, or "task" types in Ada.

So at first the question should be answered if OpenMP in FreePascal
should be implemented on language (means: special syntax) level or with
compiler directives more similar to the C-version.


Vinzent.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

John Coppens
In reply to this post by Florian Klämpfl
On Mon, 17 Jul 2006 21:12:31 +0200
Florian Klaempfl <[hidden email]> wrote:

> I'am currently thinking about implementing OpenMP support in FPC.

Florian,

Have you looked at Pascal-FC (a language developped based Pascal/0, I
believe, by Alan Burns)? I've used it to teach multiprogramming, and it
incorporates many of the items which are available in several other
MP languages (such as ADA). It's probably too basic, but there may be
some useful ideas.

Is _is_ very clean though. No {$xxx's etc...

John
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Vinzent Höfler
John Coppens wrote:
> On Mon, 17 Jul 2006 21:12:31 +0200
> Florian Klaempfl <[hidden email]> wrote:
>
>> I'am currently thinking about implementing OpenMP support in FPC.
>
> Florian,
>
> Have you looked at Pascal-FC (a language developped based Pascal/0, I
> believe, by Alan Burns)?

Alan Burns? That's a name which rings a bell. You could have send the
URL, though. ;)

http://www-users.cs.york.ac.uk/~burns/pf.html

Hmm, and taking a peek look at the examples, it doesn't really surprise
me, that this just looks like the Pascal version of Ada's tasking.


Regards,

Vinzent.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Marc Weustink
In reply to this post by Steve Williams-3
Steve Williams wrote:

> Florian Klaempfl wrote:
>
>> I'am currently thinking about implementing OpenMP support in FPC.
>> However, there is currently (to my knowledge) no pascal syntax defined
>> for OpenMp support. Do you think we can find a common syntax to simplify
>> things for users? I've some ideas how it be done, but I want to hear
>> other ideas first so they are maybe better if they aren't influenced by
>> my ideas :)
>>
>> I started also a wiki page about it
>> http://www.freepascal.org/wiki/index.php/OpenMP_support where ideas can
>> be written down and shared.
>>  
>
>
>
> 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;


so:

procedure a1(n: Integer; a: PSingleArray; b: PSingleArray);
var
  i: Integer;
begin
  for i := 1 to n - 1 do
  parallel
    b^[i] := (a^[i] + a^[i - 1]) / 2.0;
  end;
end;



> Example A.5.1:
> uses omp;
>
> begin
>  omp_set_dynamic(1);
>  {$omp parallel num_threads(10)}
>  begin
>    (* Do work here *)
>  end;
> end;


  uses omp;

  begin
   omp_set_dynamic(1);
//  {$omp parallel num_threads(10)}
// why not:
   omp_set_num_threads(10);
   parallel
     (* Do work here *)
   end;
  end;


>
> Example A.13.1:
> interface
>
> function dequeue(var a: Single): Integer;
> procedure work(i: Integer; var a: Single);
>
> implementation
>
> procedure a13(var x: Single; var y: Single);
> var
>  ix_next, iy_next: Integer;
> begin
>  {$omp parallel shared(x, y) private(ix_next, iy_next)}
>  begin
>    {$omp critical (xaxis)}
>      ix_next := dequeue(x);
>    work(ix_next, x);
>
>    {$omp critical (yaxis)}
>      iy_next := dequeue(y);
>    work(iy_next, y);
>  end;
> end;
>


  procedure a13(var ax: Single; var ay: Single);
  begin
   parallel
   shared
     x: Single; absolute ax;
     y: Single; absolute ay;
   private
     ix_next, iy_next: Integer;
   begin
     // where does xaxis come from ?
     // {$omp critical (xaxis)}
     ix_next := dequeue(x);
     work(ix_next, x);

     // where does yaxis come from ?
     // {$omp critical (yaxis)}
     iy_next := dequeue(y);
     work(iy_next, y);
   end;
  end;


or:


  procedure a13(var ax: Single; shared var y: Single);
  shared var
    x: Single; absolute ax;
// y: Single; absolute ay;
  private var
    ix_next, iy_next: Integer;
  begin
   parallel
     // where does xaxis come from ?
     // {$omp critical (xaxis)}
     ix_next := dequeue(x);
     work(ix_next, x);

     // where does yaxis come from ?
     // {$omp critical (yaxis)}
     iy_next := dequeue(y);
     work(iy_next, y);
   end;
  end;


Marc
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Vinzent Höfler
Marc Weustink wrote:

> Steve Williams wrote:
>>
>> 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.

"Not native". Well, I would have prefered the term "darn ugly". :)

> procedure a1(n: Integer; a: PSingleArray; b: PSingleArray);
> var
>  i: Integer;
> begin
>  for i := 1 to n - 1 do
>  parallel
>    b^[i] := (a^[i] + a^[i - 1]) / 2.0;
>  end;
> end;

Yes, this idea looks *much* nicer. And much more Pascalish.


Vinzent.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Steve Williams-3
In reply to this post by Marc Weustink
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.  That's
the reason behind using compiler directives instead of new keywords.  
Using compiler directives similar to the C/C++ directives also means
that the wealth of information already out there is instantly applicable
to the Pascal version.

--
Sly



This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

John Coppens
In reply to this post by Vinzent Höfler
On Thu, 20 Jul 2006 21:11:49 +0200
Vinzent Höfler <[hidden email]> wrote:

> Alan Burns? That's a name which rings a bell. You could have send the
> URL, though. ;)
>
> http://www-users.cs.york.ac.uk/~burns/pf.html
>
> Hmm, and taking a peek look at the examples, it doesn't really surprise
> me, that this just looks like the Pascal version of Ada's tasking.

Hi Vinzent.

Yes - quite famous.

But apart from the ADA style resources, it also implement a number of
other tools, such as channels/remote invocation, etc. The cobegin/coend
pair to specify concurrency is elegant, though maybe somewhat 'flat'.

John
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Marc Weustink
In reply to this post by Steve Williams-3
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.
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Steve Williams-3
Marc Weustink wrote:
>> 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.
>  

But then your code is locked to that version of FPC that supports those
new keywords.

--
Sly



This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Mattias Gaertner
On Fri, 21 Jul 2006 09:28:17 +1000
Steve Williams <[hidden email]> wrote:

> Marc Weustink wrote:
> >> 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.
> >  
>
> But then your code is locked to that version of FPC that supports those
> new keywords.

Other compilers will give you warnings about illegal compiler directives.
Therefore if your code should work with multiple compilers, you will
probably enclose the omp additions with IFDEFs anyway.

{$IFDEF HasOMP}cobegin{$ENDIF}


OpenMP uses pragmas, because
- They didn't want to break ANSI C. FPC has its own mode and compatibility
modes for others.
- It takes time before all the C compilers support the OMP additions.
  For example default gcc does not yet.
  Do we plan a syntax for FPC or for pascal in general?
- C programmers are more used to macros and pragmas, than pascal programmers
to compiler directives.
  IMO Directives are ugly.
- C programmers are more used to hints and notes, than pascal programmers.
  Although recent fpc additions changed that (hints about
unused/uninitialised variables).
  IMO Noisy notes make it harder to find the relevant compiler messages.


Mattias

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Common OpenMP syntax?

Marco van de Voort
> > new keywords.
>
> Other compilers will give you warnings about illegal compiler directives.

Bad assumption, the only one that matters, Delphi errors on unknown compiler directives. So
you will have to ifdef anyway. (tested D6)

And then I prefer the clean syntax.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
123