Currently, the Julia test-runner starts Julia from a small shell script with the line
julia --project --sysimage test-runner-sysimage.so run.jl "$1" "$2" "$3"
This starts Julia with the default single thread: Threads.nthreads() returns 1 if you abuse the online editor by embedding this in a return string ("Hello World!" lends itself to this, with the number embedded in an error message).
I'm starting to think (with some trepidation!) about how we add the two main practice exercises using multi-threading:
bank-account needs to send tests in parallel, and student solutions need to handle this and avoid race conditions.
parallel-letter-frequency needs the student to parallelize code, with a scatter-gather strategy across multiple threads.
To deal with this, we could change the start of the above line of code to either julia --threads auto or something like julia --threads 4.
Should we?
I haven't yet tried a test build of the docker image with this sort of change. On my Linux box, starting with --threads auto then running Threads.nthreads() returns 16 (for a Ryzen 7 CPU, 8 physical cores dual-pipelined).
I have no idea how many threads will auto-start on the AWS system running our docker image in production. We could maybe try it, and if we end up with a crazy huge number we could back off to 4 or 8.
Currently, the Julia test-runner starts Julia from a small shell script with the line
This starts Julia with the default single thread:
Threads.nthreads()returns 1 if you abuse the online editor by embedding this in a return string ("Hello World!" lends itself to this, with the number embedded in an error message).I'm starting to think (with some trepidation!) about how we add the two main practice exercises using multi-threading:
bank-accountneeds to send tests in parallel, and student solutions need to handle this and avoid race conditions.parallel-letter-frequencyneeds the student to parallelize code, with a scatter-gather strategy across multiple threads.To deal with this, we could change the start of the above line of code to either
julia --threads autoor something likejulia --threads 4.Should we?
I haven't yet tried a test build of the docker image with this sort of change. On my Linux box, starting with
--threads autothen runningThreads.nthreads()returns 16 (for a Ryzen 7 CPU, 8 physical cores dual-pipelined).I have no idea how many threads will auto-start on the AWS system running our docker image in production. We could maybe try it, and if we end up with a crazy huge number we could back off to 4 or 8.