ScottishCovidResponse / SCRCIssueTracking

Central issue tracking repository for all repos in the consortium
6 stars 0 forks source link

Deterministic models and testing #575

Closed jwscook closed 4 years ago

jwscook commented 4 years ago

Hi all,

I've made a repo out of the @replace. I've registered it with Julia's "General Registry" but it might take a while to merge in.

So far it can be added via ]add git@github.com:jwscook/Replace.jl.git.

With using Replace at the top of Scotland_run.jl I can make these changes to the lines near the call to simulate_record!

    # only arguments that have a `median` method will compile
    replacement(a) = median(a) 
    replacement(a, n) = median(a) .+ zeros(typeof(median(a)), n)
    @replace rand replacement simulate_record!(abuns, epi, times, interval, timestep, save = save, save_path = savepath)

and it doesn't crash...

github-actions[bot] commented 4 years ago

Heads up @claireh93 @richardreeve @jwscook @sdl1 @wytbella - the "Simulation.jl" label was applied to this issue.

jwscook commented 4 years ago

turned rand(d, n) into median(d) .+ zeros(typeof(median(d)), n)

image

whereas originally:

image

which is diffferent!

jwscook commented 4 years ago

Cassette.overdub wasn't replacing calls to rand and rand! in code in @threads for blocks. I've submitted issue https://github.com/jrevels/Cassette.jl/issues/176 about it. In the meantime @spawn does work so i'll see if I can get it going with that.

jwscook commented 4 years ago

A potential work around might exist according to https://github.com/jrevels/Cassette.jl/issues/120 but I'll have to go through it more carefully tomorrow

jwscook commented 4 years ago

The proof of principle exists in https://github.com/ScottishCovidResponse/Simulation.jl/pull/68. Closing this issue in favour of more specific issues on the topic - tbd.