This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to clear unknown pragma warning for OpenMP?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Thu, 23 Jul 2015 14:19:19 -0400
- Subject: Re: How to clear unknown pragma warning for OpenMP?
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8m6XU1LW9cyRL1nZ5eMH_hizr38CLcKRbnm+33Hn6np3Q at mail dot gmail dot com> <CAH6eHdRq2W9ArCiN4avKZbvvD+kTCPsPS7=q3WixRH=6-V_qRw at mail dot gmail dot com> <CAH8yC8mGgmT7fEyFp+hbFC0itLDjAOw9XTE=k+oRF+D9njqjoA at mail dot gmail dot com> <CAH6eHdSV2bLkGqDb0emj96ivL0H_PhzT_BEn=25KRrN8ZzerCA at mail dot gmail dot com>
- Reply-to: noloader at gmail dot com
> You might be able to use _Pragma
>
> #if _OPENMP
> #define OMP_PARALLEL _Pragma("omp parallel")
> #else
> #define OMP_PARALLEL
> #endif
>
> And then use that instead of the #pragma omp directive:
>
> OMP_PARALLEL
> for (int i = 0; i < 10; ++i)
> ;
Yeah, that crossed my mind. I realized I was attacking the defines
from the wrong end.
> Again, I haven't actually tested whether this still parallelizes
> anything, only that it compiles.
It gets even better: benchmarking, I found some of the routines slowed
down. Hence the reason for that weird looking tail on the pragma:
#pragma omp parallel sections if(CRYPTOPP_RW_USE_OMP)
{
#pragma omp section
m_pre_2_9p = modp.Exponentiate(2, (9 * m_p - 11)/8);
#pragma omp section
m_pre_2_3q = modq.Exponentiate(2, (3 * m_q - 5)/8);
#pragma omp section
m_pre_q_p = modp.Exponentiate(m_q, m_p - 2);
}
(The 'if' clause has been around since OMP 1.0, so its available everywhere).
Jeff