Skip to content
Snippets Groups Projects
Commit 9a0ac83c authored by xo30xoqa's avatar xo30xoqa
Browse files

Added precompilation and the `visualise` setting

parent 67e13786
No related branches found
No related tags found
No related merge requests found
name = "Persefone"
uuid = "039acd1d-2a07-4b33-b082-83a1ff0fd136"
authors = ["Daniel Vedder <daniel.vedder@idiv.de>"]
version = "0.3.1"
version = "0.3.2"
[deps]
Agents = "46ada45e-f475-11e8-01d0-f70cc89e6671"
......
......@@ -24,7 +24,7 @@ using
Distributed,
FileIO,
#FIXME an upstream update broke GeoArrays for TableTransforms > 1.15.0
GeoArrays, #XXX this is a big dependency - can we get rid of it?
GeoArrays,
Logging,
LoggingExtras,
Random,
......@@ -114,7 +114,8 @@ include("nature/species/wyvern.jl")
include("core/simulation.jl") #this must be last
#XXX precompile? -> PrecompileTools doesn't really give an improvement
# https://julialang.org/blog/2021/01/precompile_tutorial/
# precompile important functions
precompile(initialise, (String,Int))
precompile(stepsimulation!, (AgentBasedModel,))
end
......@@ -22,7 +22,10 @@ function visualisemap(model::AgentBasedModel,date=nothing,landcover=nothing)
ax.aspect = DataAspect()
# check if there are individuals and plot them
inds = model.datatables["individuals"]
iszero(size(inds)[1]) && return f
if iszero(size(inds)[1])
@debug "No individual data to map"
return f
end
isnothing(date) && (date = inds.Date[end])
for s in unique(inds.Species)
points = @select!(@subset(inds, :Species .== s, :Date .== date),
......
......@@ -152,7 +152,7 @@ function finalise!(model::AgentBasedModel)
with_logger(model.logger) do
@info "Simulated $(model.date-@param(core.startdate))."
@info "Simulation run completed at $(Dates.now()),\nwrote output to $(@param(core.outdir))."
visualiseoutput(model)
@param(core.visualise) && visualiseoutput(model)
model
end
end
......@@ -11,6 +11,7 @@ configfile = "src/parameters.toml" # location of the configuration file
outdir = "results" # location and name of the output folder
overwrite = "ask" # overwrite the output directory? (true/false/"ask")
csvoutput = true # save collected data in CSV files
visualise = true # generate result graphs
storedata = true # keep collected data in memory
loglevel = "debug" # verbosity level: "debug", "info", "warn"
processors = 2 # number of processors to use on parallel runs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment