Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parallel module compilation in justfile #2729

Merged
merged 2 commits into from
Apr 16, 2024
Merged

Conversation

paulcadman
Copy link
Collaborator

@paulcadman paulcadman commented Apr 16, 2024

Thanks to @janmasrovira for figuring out that the stack --ghc-options=-j flag enables parallel module compilation in GHC.

This PR adds support for this in the project justfile.

You can configure the argument to -j using the numParallelJobs option, for example:

just numParallelJobs=24 build
+ stack build --fast -j24 --ghc-options=-j24

If numParallelJobs is not set then -j is passed with no arguments in --ghc-options (this is equivalent to passing the number of cpus of the machine.) and is passed with the number of cpus of the machine for the stack -j option (the stack -j option requires an argument).

The numParallelJobs option also sets the argument to the stack -j option.

To disable build parallelism set the disableParallel flag:

just disableParallel=yes build
+ stack build --fast

@paulcadman paulcadman added this to the 0.6.2 milestone Apr 16, 2024
@paulcadman paulcadman self-assigned this Apr 16, 2024
Copy link
Collaborator

@janmasrovira janmasrovira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏩ ⏩ ⏩

This option is not set if `disableParallel` is set.

You can configure the argument to `-j` by setting `numParallelJobs`.
@paulcadman paulcadman merged commit 622bedf into main Apr 16, 2024
4 checks passed
@paulcadman paulcadman deleted the just-parallel-modules branch April 16, 2024 13:16
janmasrovira pushed a commit that referenced this pull request Apr 18, 2024
This PR changes the CI build to use the justfile instead of the Makefile
to run builds and tests. CI builds now take advantage of parallel module
builds from #2729.

In order support this the runtime build target in the justfile now
supports `runtimeCcArg` and `runtimeLibtoolArg` so that the `CC` and
`LIBTOOL` Makefile argument can be set. This is required for the macOS
build.

In addition this PR upgrades the stack setup step action. Previously the
stack build flags included `--fast` which meant the whole project was
rebuilt in the `test` step, this has also been fixed.

Overall this speeds up the CI:
* Linux now takes 30mins (from 40mins)
* macOS now takes 60mins (from 80mins)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants