Investigates how the topology of networks of chemostats influence the complexity of the chemistry.
- Installation
- Interactive usage
- Usage from the command line
- Running simulations using the SLURM scheduler
-
Install Julia, preferably version
1.11.2or similar. -
Clone repo and install requirements.
git clone https://github.com/colemathis/flow-complexity
cd flow-complexity
julia --project=.then, from the Julia prompt,
julia> using Pkg
julia> Pkg.instantiate()- Add folder
flow-complexityto PATH
e.g., by adding this line to .bashrc or .zshrc
export PATH="$PATH:[path to repo]/flow-complexity"The code is designed to work both in command-line (shell) mode and in interactive mode (e.g., Jupyter Notebook).
You can launch the code using the flow command line, followed by one of these commands:
paramscreates a parameter file namedparams.jlin the current directoryqueuecreates a csv file nameddata/params.csvcontaining the parameters for an ensemble of simulations to be executedslurmcreates a SLURM script file namedrun.slurmin the current directorylaunch <sim number>launches simulation number<sim_number>from the queue file
In interactive mode, load Julia using
cd flow-complexity
julia --project=.then load the FlowComplexity module with
julia> include("src/FlowComplexity.jl")A Simulation object can be created using
s = FlowComplexity.Simulation();Then it can be launched with either
julia> FlowComplexity.run_simulation(s);or
julia> s.run()A simulation from an array can be launched using
julia> s.from_sim_array(1);Data is automatically saved in ./data/<sim_number>. It can be accessed either from the object itself,
using Plots
df = s.output[:timeseries]
plt = plot()
for i in 1:10
d = df[(df.chemostat_id .== 1) .& (df.integer .== i), :]
plot!(plt, d.time, d.frequency, label="int $i")
end
display(plt)or from the files written to disk
using CSV, DataFrames, Plots
df = CSV.read("./data/sims/000001/timeseries.csv", DataFrame)
plt = plot()
for i in 1:10
d = df[(df.chemostat_id .== 1) .& (df.integer .== i), :]
plot!(plt, d.time, d.frequency, label="int $i")
end
display(plt)The A matrix can be saved/loaded using
julia> s.save_R_matrix("R-matrix.jld2")
julia> s.load_R_matrix("R-matrix.jld2")To execute an ensemble of simulations simultaneously on the SLURM scheduler on ASU’s high performance computing cluster, the first step is to create a SLURM job file using
flow slurmThis creates a file named run.slurm in the current directory.
You can edit the file to adjust the parameters. For example, if your params.jl defines an array of 100 simulations, the following line will let SLURM know to execute simulations 1 to 100:
#SBATCH --array=1-100 # simulation indicesOther parameters that you can customize include wall time (the time interval after which SLURM will kill a simulation that has not completed) and memory (the amount of RAM memory allocated to each simulation):
#SBATCH --time=24:00:00 # wall time (hh:mm:ss)
#SBATCH --mem=4G # memoryYou should not have to customize other parameters, or modify the rest of the script.
After you have made sure the parameters in slurm.run are set correctly, you can send your job description to SLURM using
sbatch slurm.runThis will add your list of simulations to the queue. You can confirm the job has been added using the command myjobs.
The priority with which they will be run depends on your "fairshare score" — the more you use the cluster, the longer it will take before your jobs are executed.
Refer to the page on Sol in the wiki for more information about the cluster.