[petsc-dev] OpenMP support

Gerard Gorman g.gorman at imperial.ac.uk
Mon Feb 13 19:31:45 CST 2012


Matthew Knepley emailed the following on 14/02/12 00:34:
>
>     As a first step - can we add OpenMP support to PETSc conf?
>     Lawrence made
>     a first pass at this:
>     https://bitbucket.org/wence/petsc-dev-omp/src/52afd5fd2c25/config/PETSc/packages/openmp.py
>     It does need extending because it will fail in it is current state
>     for a
>     number of compilers. I am guessing we would have to reimplement
>     something like ax_openmp or similar...what is the right thing to
>     do here?
>
>
> Can you explain the right test?

The definitive test would be to try to compile a test code: eg

int main(){
#ifndef _OPENMP
choke me
#endif
return 0;
}

The OpenMP standard specifies that the preprocessor macro name _OPENMP
should be set.

As for the actual compile flag ... reading FindOpenMP.cmake you can see
that they take the test compile approach as above, and they have a list
of candidates (OpenMP_C_FLAG_CANDIDATES) which are tested. Another
option would be to allow --with-openmp[=magic_flag] for the odd compiler
not recognised. For example I notice that the Fujitsu compiler is not
listed in FindOpenMP.cmake.

Cheers
Gerard




More information about the petsc-dev mailing list