[Haskell-cafe] Cabal: Can only one processor core be used?

Volker Wysk post at volker-wysk.de
Tue Apr 2 11:55:11 UTC 2024


Am Dienstag, dem 02.04.2024 um 13:38 +0200 schrieb Henning Thielemann:
> On Tue, 2 Apr 2024, Volker Wysk wrote:
> 
> > I've searched the web and the cabal user guide on how to use more processor
> > cores for compilation via cabal. I couldn't find anything.
> 
> $ cabal install -j3
> 
> or
> 
> $ fgrep jobs ~/.cabal/config
> jobs: 3
> 
> 
> > Cabal compilation times can be a pain. It can't be that you can use only 
> > one processor core with cabal, can it ..?
> 
> There are two places where you can increase the use of multiple cores. The 
> one above controls the number of packages to be compiled in parallel, 
> whereas
> 
> $ cabal install --ghc-option=-j3
> 
> means that each instance of GHC compiles up to three modules in parallel.

This sounds better than compiling only whole packages in parallel.

> As far as I know it is currently not possible to interleave compilation of 
> modules and packages. I.e. optimally we would only need one 'jobs' option 
> and then Cabal and GHC manage to fill the working queue with any module 
> from any package. This would certainly require to run GHC in a server 
> mode.
> 
> 
> However, without a fast storage for temporary files you will hardly see an 
> actual speedup. I use to mount a ram disk with tmpfs at /ram and then 
> compile with
> 
> $ cabal install -j3 --ghc-option=-j3 --builddir=/ram/cabal

That's important. And so you're saying that an SSD isn't fast enough.
So I'll probably set up a RAM disk as well.

Thanks

Volker


More information about the Haskell-Cafe mailing list