Question

I'd like to configure my OCaml OPAM builds to run multiple worker processes in parallel. There's actually a ticket on the OPAM github for this

https://github.com/OCamlPro/opam/issues/310

which says I just need to write an ocp-build.conf file. Unfortunately, I have been completely unsuccessful in finding any documentation on the syntax of this config file. I have S'edTFW and would be delighted to RTFM if only I could find it.

Does anyone happen to know how to configure ocp-build for multiple worker processes?

Was it helpful?

Solution

The first time ocp-build is called, it creates both a global file ~/.ocp/ocp-build.conf (~ is your home directory) and a local file ocp-build.root in the project.

Depending on your version of ocp-build, both files define an option ncores (older versions) or njobs (recent versions). In ocp-build.root, the default value is None, meaning that the value is not set, and the default should be used (i.e. the value from the global file).

For example, in my ~/.ocp/ocp-build.conf file, I have ncores = 5 (and njobs = 5, as I use also the most recent version), which means that 5 processes can be started in parallel (I use a quad-core, so anything > 4 is good).

Note that ocp-build can only parallelize compilation if dependencies are not too strong, or you compile both in bytecode and native code at the same time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top