Karl Forner
2010-Sep-14 09:06 UTC
[Rd] Best way to manage configuration for openMP support
Hello, I've written a package that may use OpenMP to speed up computations. OpenMP is supported in recent Gcc versions by using the -fopenmp flag. The problem is that flag crashed gcc versions that do not support OpenMP. So what is the best way for a package to handle this issue. Has someone a configure script that deals with this ? Thanks, Karl [[alternative HTML version deleted]]
Dirk Eddelbuettel
2010-Sep-14 11:40 UTC
[Rd] Best way to manage configuration for openMP support
On 14 September 2010 at 11:06, Karl Forner wrote: | I've written a package that may use OpenMP to speed up computations. OpenMP | is supported in recent Gcc versions by using the -fopenmp flag. | The problem is that flag crashed gcc versions that do not support OpenMP. | So what is the best way for a package to handle this issue. Has someone a | configure script that deals with this ? I don't know off-hand of any CRAN packages that do that, but you could look at Luke Tierney's pnmath package which uses Open MP. It may have a test. Else, you can query gcc for minimum versions. I have some configure code from way back when then tested for a minimum version of 3.0 (!!): # We are using C++ AC_LANG(C++) AC_REQUIRE_CPP AC_PROG_CXX if test "${GXX}" = yes; then gxx_version=`${CXX} -v 2>&1 | grep "^.*g.. version" | \\ sed -e 's/^.*g.. version *//'` case ${gxx_version} in 1.*|2.*) AC_MSG_WARN([Only g++ version 3.0 or greater can be used with RQuantib.]) AC_MSG_ERROR([Please use a different compiler.]) ;; esac fi You could do the same for gcc and strip out major version (4) and minor (0 or 1) and then complain. With 4.2 you should be fine. Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com