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.
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/
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 had a quick look at OpenMP specification some time ago and my first thought was to do obvious thing: declare that OpenMP directives have form of Pascal directives:
{$omp omp_directive}
looking at the wiki page I see that you quickly dismissed such possibility. I would like to mention here what I consider as main advantage of directive approach: it modularizes the specifiaction, allowing independent evolution of the language standard and OpenMP specification.
Some remarks:
1) some (most ??) OpenMP directives make sense only on statements, so it make sense to follow C/Fortran path and attach them to statements 2) directives take extra options/parameters and use a number of keywords so integrating them into Pascal syntax may turn some identifiers into reserved words (breaking compatibility) and/or significantly complicate pascal parser 3) there are other parallel programing paradigms, integrated OpenMP syntax may pre-empt some better solution.
Waldek Hebisch 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 had a quick look at OpenMP specification some time ago and my first thought was to do obvious thing: declare that OpenMP directives have form of Pascal directives:
{$omp omp_directive}
looking at the wiki page I see that you quickly dismissed such possibility. I would like to mention here what I consider as main advantage of directive approach: it modularizes the specifiaction, allowing independent evolution of the language standard and OpenMP specification.
I'd object that I generally dislike compiler directives directly coupled with some specific part of the code (in contrast to changing general compiler behaviour etc., as most existing options do), both for "historical" reasons, but also because of the way they're handled (in GPC, roughly on the lexer level, not in the parser -- in particular, they can occur at any point between tokens, and it might not even always be clear which construct they should refer to, e.g. a structured-statement vs. an enclosed statement). I also don't find them very readable within code. Insofar I agree with Florian.
OTOH, I don't like adding new keywords (as is well-known here :-), so I agree with Waldek's point 2). Since reusing existing keywords (or combinations) seems difficult here (several ones needed, little correlation with existing keywords at first sight, should work with different dialects and their different keywords), I'd tend to favour attributes -- mostly for the same reasons I do in other cases. They require no new keyword except "attribute" itself (which GPC already has; don't know about FPC); they can be part of the syntax proper (unlike compiler directives), so the grammar can specify exactly where it wants to allow attributes (we probably want them either at the beginning or ending of the statement, not both, and certainly not in the middle); the attribute syntax itself is rather independent of the Pascal syntax and keywords (we have already extended it in comparison to the C attribute syntax, introducing "=", and if necessary, more extensions could be made).
Readability is debatable, but one can always wrap them in a macro (something which GPC currently doesn't allow with compiler directives, BTW, though this might change in the future).
Frank