-
Notifications
You must be signed in to change notification settings - Fork 1
/
RunParallelSlurm.jl
136 lines (112 loc) · 5 KB
/
RunParallelSlurm.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
include("SlurmConnect.jl")
using ProgressMeter
using PmapProgressMeter
using Parameters
using DataArrays,DataFrames
using QuadGK
using Distributions
using StatsBase
using ParallelDataTransfer
using Match
using Lumberjack
using FileIO
using SlurmConnect
add_truck(LumberjackTruck("processrun.log"), "my-file-logger")
remove_truck("console")
info("lumberjack process started up, starting repl")
info("adding procs...")
s = SlurmManager(128)
@eval Base.Distributed import Base.warn_once
addprocs(s, partition="defq", N=16)
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)
resultsR02 = Vector{Int64}(numberofsims)
resultsPV = Matrix{Float64}(P.matrix_strain_lines,numberofsims)
resultsPNV = Matrix{Float64}(P.matrix_strain_lines,numberofsims)
resultsEf = Matrix{Float64}(P.matrix_strain_lines,numberofsims)
resultsTimeInf = Matrix{Int64}(P.grid_size_human,numberofsims)
resultsTimeRec = Matrix{Int64}(P.grid_size_human,numberofsims)
resultsDistance = Matrix{Int64}(P.grid_size_human,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]
resultsPV[:,i] = results[i][5]
resultsPNV[:,i] = results[i][6]
resultsGD[:,i] = results[i][7]
resultsEf[:,i] = results[i][8]
resultsTimeInf[:,i] = results[i][9]
resultsDistance[:,i] = results[i][10]
resultsTimeRec[:,i] = results[i][11]
resultsR02[i] = results[i][12]
end
directory = "Calibration/"
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)","_PV.dat"),resultsPV)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_PNV.dat"),resultsPNV)
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)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_TimeInf.dat"),resultsTimeInf)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_Distance.dat"),resultsDistance)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_TimeRec.dat"),resultsTimeRec)
writedlm(string("$directory","result","$(P.Prob_transmission)","Mut","$(P.mutation_rate)","Ef","$(P.VaccineEfficacy)","_R02.dat"),resultsR02)
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
@everywhere P=InfluenzaParameters(
VaccineEfficacy = 0.0,
GeneralCoverage = 0,
Prob_transmission = 0.05,
sim_time = 200,
grid_size_human = 10000,
matrix_strain_lines = 1200,
mutation_rate = 0.3,
initial_p = 0.01,
initial_p2 = 0.005,
initial_p3 = 0.015,
start_different = 0
)
run_main(P,1000)
@everywhere P=InfluenzaParameters(
VaccineEfficacy = 0.0,
GeneralCoverage = 0,
Prob_transmission = 0.023,
sim_time = 200,
grid_size_human = 10000,
matrix_strain_lines = 1200,
mutation_rate = 0.3,
initial_p = 0.01,
initial_p2 = 0.005,
initial_p3 = 0.015,
start_different = 0
)
run_main(P,1000)
@everywhere P=InfluenzaParameters(
VaccineEfficacy = 0.0,
GeneralCoverage = 0,
Prob_transmission = 0.079,
sim_time = 200,
grid_size_human = 10000,
matrix_strain_lines = 1200,
mutation_rate = 0.3,
initial_p = 0.01,
initial_p2 = 0.005,
initial_p3 = 0.015,
start_different = 0
)
run_main(P,1000)