octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enabling OpenMP by default


From: John W. Eaton
Subject: Re: Enabling OpenMP by default
Date: Sun, 10 Mar 2013 22:55:20 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11

On 03/10/2013 08:14 PM, Susi Lehtola wrote:
On Sun, 10 Mar 2013 17:50:05 -0300
Júlio Hoffimann<address@hidden>  wrote:
For every occurrence (239 so far) of a parallel region we ideally
want the pragma to be wrapped by a #ifdef directive (e.g. #if
defined(_OPENMP) ... #endif), but this would cause an unacceptable
decrease in readability since 239*3 = 717 new lines of boilerplate.
The number of regions is that high because the array classes don't
satisfy the DRY principle, and probably can't.

This is just a thought, but if you want to avoid a lot of #ifdef's,
then maybe you could just #define some pragmas to be used inside
Octave, e.g.

#ifdef _OPENMP
#pragma omp parallel for
#endif

could be just e.g.

#octave_omp_parfor

and this macro could be defined to be empty if OpenMP is disabled...

That doesn't work as you can not #define a #pragma. But your message prompted me to do some searching and it appears we could use the _Pragma keyword. _Pragma will work in macros and I think it should be portable to any compiler that can compile Octave's C++.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]