Skip to content

[R-pkg-devel] openmp

6 messages · Joshua N Pritikin, Dirk Eddelbuettel, Zhian Kamvar

#
On Sun, Aug 23, 2015 at 08:01:08AM +0200, Mark van der Loo wrote:
So I take that answer as, "No, CRAN cannot possibly enable openmp for 
binary builds." Is that correct?

  
    
#
On 24 August 2015 at 09:14, Joshua N Pritikin wrote:
| On Sun, Aug 23, 2015 at 08:01:08AM +0200, Mark van der Loo wrote:
| >    Afaik, openmp is available on windows. According to writing R
| >    extensions:
| > 
| >    There is nothing to say what version of OpenMP is supported: version
| >    3.0 (May 2008) is supported by recent versions of the Linux, _Windows_
| >    and Solaris platforms, but portable packages cannot assume that end
| >    users have recent versions. OS X nowadays uses clang, and the Apple
| >    builds currently have no OpenMP support.
| 
| So I take that answer as, "No, CRAN cannot possibly enable openmp for 
| binary builds." Is that correct?

The CRAN maintainers are not withholding OpenMP from you because they are meanies.

But they may do so because it is not reliable or performant on some of the
platforms.  This issue has been discussed before, Luke Tierney in particular
is quite on top of this has made comments in the past that performance might
"soon" catch up in the OS X implementation.  OpenMP _is_ used in R itself and
by a number of packages.  Your best bet may be to test for it with a
configure script, and maybe to talk to the respective CRAN maintainers for
Windows and OS X if you have particular questions, there.

| 
| >    Op 21 aug. 2015 22:50 schreef "Joshua N Pritikin"
| >    <[1]jpritikin at pobox.com>:
| >      Many CRAN packages offer improved performance when compiled with
| >      OpenMP. However, the MacOS and Windows binaries built by CRAN are
| >      built
| >      without openmp enabled. Would it be possible to build openmp enabled
| >      binaries for some CRAN packages?
| 
| -- 
| Joshua N. Pritikin
| Department of Psychology
| University of Virginia
| 485 McCormick Rd, Gilmer Hall Room 102
| Charlottesville, VA 22904
| http://people.virginia.edu/~jnp3bc
| 
| ______________________________________________
| R-package-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-package-devel
#
On Mon, Aug 24, 2015 at 09:29:34AM -0500, Dirk Eddelbuettel wrote:
Currently, we have a configure script for package OpenMx that only 
enables openmp if gcc is the compiler (OS X only). Nice to hear that 
openmp is supported on Windows.

Are there any CRAN packages that actually compile to openmp enabled 
binaries on CRAN? I'd prefer if we weren't breaking new ground here. I'd 
love to copy an already working configure script instead of trying to 
write it for the first time.
#
On 24 August 2015 at 11:02, Joshua N Pritikin wrote:
| Currently, we have a configure script for package OpenMx that only 
| enables openmp if gcc is the compiler (OS X only). Nice to hear that 
| openmp is supported on Windows.

Interesting that you opt to ignore OpenMP support on the platform that
probably supports it best ...

| 
| Are there any CRAN packages that actually compile to openmp enabled 
| binaries on CRAN? I'd prefer if we weren't breaking new ground here. I'd 
| love to copy an already working configure script instead of trying to 
| write it for the first time.

edd at xmcorsairs:~/CRAN$ grep -l openmp */src/Makevars*
FRESA.CAD/src/Makevars.win
laGP/src/Makevars
maptpx/src/Makevars
mvnfast/src/Makevars
ndl/src/Makevars.win
PropClust/src/Makevars
rpf/src/Makevars
SOD/src/Makevars.in
SOD/src/Makevars.win
edd at xmcorsairs:~/CRAN$ 

That is highly incomplete as I didn't even bother tp grep configure scripts.
Maybe you can take it from here.  Gabor's excellent MetaCRAN also gives you
search tools.

Dirk
#
On Mon, Aug 24, 2015 at 10:14:10AM -0500, Dirk Eddelbuettel wrote:
Do you mean Linux? Yeah, we do enable OpenMP on gcc+Linux but CRAN 
doesn't compile binaries for Linux so it's up to the user to have things 
set up properly.
#
The way several packages have implemented OpenMP is to wrap it in pre-compiler statements i.e.:

// Include openMP if the compiler supports it
#ifdef _OPENMP
#include <omp.h>
#endif

This way, all compilers can build the code and those that have OpenMP (even modified versions of clang: https://clang-omp.github.io/) can do so in a parallel fashion.