bench-runner icon indicating copy to clipboard operation
bench-runner copied to clipboard

Simplifying Third party libraries availability

Open saatvikshah opened this issue 4 years ago • 1 comments

Since quick-bench does not support including 3rd party libraries(like Godbolt does) via github links(https://github.com/FredTingaud/quick-bench-back-end/issues/5), I was wondering what options existed to set this up locally?

Based on my understanding the way quick-bench works is to download the docker image from within a bench-runner image container corresponding to the compiler selected on the frontend locally by mounting docker.sock. So the only ways I can see to make a 3rd party library available is:

  • ssh into a container corresponding to the compiler I want to benchmark with(eg. fredtingaud/quick-bench:clang-10.0), build my 3rd party dependency there and then run ./quick-bench.
  • Similar to the above, build a new Dockerfile using fredtingaud/quick-bench:clang-10.0 as a base image and have RUN <steps to clone and build my 3rd party library> as a command. I'll also need to set the built image name and tag appropriately.

I'm curious if a simpler approach to this is possible? For example a way for the user to supply a the build step for the 3rd party library as a shell script and supported compilers to the ./quick-bench script and it set these up. Alternately implementing support for the issue mentioned above.

saatvikshah avatar Jan 24 '21 23:01 saatvikshah

Hi @saatvikshah , A simpler solution would be to run a command identical to the one in ./quick-bench without the finale ./start-quick-bench. Then you will be in the bench-runner container as ROOT. You can run apt update && apt install your-favorite-editor and edit the file run-docker to change the line that calls docker and $BUILD_COMMAND with a bunch of parameters. You can add your own parameters here, that will be passed to the compiler. You could pass additional -v to docker, to mount directories and -l to the compiler using the newly mounted directories:

    docker run --rm $ANNOTATE -v $INFILE:/home/builder/bench-file.cpp $MEMORY_LIMITS --cidfile=$CIDFILE -v $TARG_OUTFILE:/home/builder/bench.out -t fredtingaud/quick-bench:$COMPILER /bin/bash -c "./$BUILD_COMMAND $OPTIM $VERSION && $ANNOTATE_RECORD ./run $ANNOTATE_CMD"

could become something like

    docker run --rm $ANNOTATE -v/path/to/3rdparty:/libraries -v $INFILE:/home/builder/bench-file.cpp $MEMORY_LIMITS --cidfile=$CIDFILE -v $TARG_OUTFILE:/home/builder/bench.out -t fredtingaud/quick-bench:$COMPILER /bin/bash -c "./$BUILD_COMMAND $OPTIM $VERSION -L/libraries -lsome-lib && $ANNOTATE_RECORD ./run $ANNOTATE_CMD"

FredTingaud avatar Feb 03 '21 20:02 FredTingaud