-
Notifications
You must be signed in to change notification settings - Fork 1
/
RunParallel2.jl
72 lines (58 loc) · 2.73 KB
/
RunParallel2.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
addprocs(4)
using ProgressMeter
using PmapProgressMeter
using Parameters
using DataArrays,DataFrames
using QuadGK
using Distributions
using StatsBase
using ParallelDataTransfer
using Match
using Lumberjack
using FileIO
println("added $(nworkers()) processors")
info("starting @everywhere include process...")
@everywhere include("basicModelSlurm.jl")
################## To run this files, You must check the return of BasicModel.jl
#######################3
function dataprocess(results,P::InfluenzaParameters,numberofsims)
resultsL = Matrix{Int64}(P.sim_time,numberofsims)
resultsA = Matrix{Int64}(P.sim_time,numberofsims)
resultsS = Matrix{Int64}(P.sim_time,numberofsims)
resultsGD = Matrix{Float64}(P.sim_time,numberofsims)
resultsR0 = Vector{Int64}(numberofsims)
resultsP = Matrix{Float64}(P.matrix_strain_lines,numberofsims)
resultsEf = Matrix{Float64}(P.matrix_strain_lines,numberofsims)
for i=1:numberofsims
resultsL[:,i] = results[i][1]
resultsS[:,i] = results[i][2]
resultsA[:,i] = results[i][3]
resultsR0[i] = results[i][4]
resultsP[:,i] = results[i][5]
resultsGD[:,i] = results[i][6]
resultsEf[:,i] = results[i][7]
end
directory = "July19/results2/"
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_latent.dat"),resultsL)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_symp.dat"),resultsS)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_asymp.dat"),resultsA)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_R0.dat"),resultsR0)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_P.dat"),resultsP)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_GD.dat"),resultsGD)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_Ef.dat"),resultsEf)
end
function run_main(P::InfluenzaParameters,numberofsims::Int64)
results = pmap((cb, x) -> main(cb, x, P), Progress(numberofsims*P.sim_time), 1:numberofsims, passcallback=true)
dataprocess(results,P,numberofsims)
end
for Vef = 0.2:0.3:0.8
@everywhere P=InfluenzaParameters(
GeneralCoverage = 1,
VaccineEfficacy = $Vef,
Prob_transmission = 0.079,
sim_time = 200,
grid_size_human = 1000,
mutation_rate = 0.00416
)
run_main(P,100)
end