Skip to content

Conversation

@grantmcdermott
Copy link
Collaborator

@grantmcdermott grantmcdermott commented Oct 27, 2025

At present, CRAN's Mac binary builds of fixest don't enable OpenMP support. This is pretty well documented in other issues around the repo, where our current workaround advice is for users to configure their .R/Makevars and install from source if they want multi-threaded performance.

However... it turns out that CRAN has actually supported binary MacOS builds with the OpenMP runtime enabled since R 4.3.0. I know of several packages taking advantage of this service, including data.table. (See @kevinushey's initial PR here: Rdatatable/data.table#6034)

The key thing is to make CRAN's build system aware of OpenMP detection in order to enable the appropriate compiler flags.

This PR steals borrows the same basic configuration that data.table uses to enable the same out-of-the-box OpenMP runtime support for fixest. The solution basically involves shipping a configure script that actively detects OpenMP availability. This configure script:

  • Tests for OpenMP support using platform-specific flags
  • Generates appropriate src/Makevars based on detection results
  • Falls back gracefully to single-threaded build if OpenMP unavailable

Testing

Local testing shows the configure script works correctly:

$ R_HOME=/Library/Frameworks/R.framework/Resources ./configure
* checking if R installation supports OpenMP with "-Xclang -fopenmp" ... yes

I would also suggest that we submit a version to CRAN's MacOS builder, but @lrberge should probably do that as the listed maintainer.

Expected Impact

After this change, CRAN's Mac binary builds should include OpenMP support, giving Mac users the same multithreaded performance as other platforms without requiring source installation.

Refs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants