opencascade.js icon indicating copy to clipboard operation
opencascade.js copied to clipboard

Custom Build Docker Image Only Uses One CPU Core

Open flolu opened this issue 3 years ago • 1 comments

Lately, I found myself using custom builds quite often. And one build takes several minutes, which makes it really annoying.

I've noticed, that only one CPU core is used during the build. Is this a limitation of Docker? Can I somehow use all my cores for building?

docker run \
  --rm \
  -it \
  -v "$(pwd):/src" \
  -u "$(id -u):$(id -g)" \
  donalffons/opencascade.js \
  test.yml

flolu avatar Jul 14 '22 10:07 flolu

That's not a docker limitation, but an issue with the current implementation. (To be fair though: OCCT is a huge library and the process of generating bindings is also very complex. At some point build times were in the order of days. Since then many parts of the build process have been parallelized and have gotten better :wink:). But there's certainly opportunity for improvements, here.

Here is a high level overview of the build process. For the "docker run" stage, there is opportunity for the steps prior to "link" (which means running "emcc" to link the final library - which is fully handled by Emscripten). "Link" starts with a console output of "Running build: ". A good first step would be to create a profile / measure execution times first.

From the top of my head, the steps prior to "link" currently include

  • parsing the entire OCCT source base with libclang
  • checking for incorrect "bindings" in the YML file
  • generating and compiling bindings for "additionalCppCode" (if existing)
  • compiling bindings for "additionalBindCode" (if existing)

donalffons avatar Jul 14 '22 11:07 donalffons