Mozaik is a workflow system for spiking neuronal network simulations written in Python that integrates model, experiment and stimulation specification, simulation execution, data storage, data analysis and visualization into a single automated workflow. This way, Mozaik increases the productivity of running virtual experiments on complex heterogenous spiking neuronal networks.
From https://github.com/CSNG-MFF/mozaik
The installation of Mozaik requires a large number of dependencies and is specifically only tested on modern Ubuntu Linux distributions. As part of its mandatory requirements, it includes:
Outside of a single user environment where that user has complete admin control over the Linux environment it can be difficult to manage these requirements in such a way that it does not impact other users. Therefore, it is suggested that a container environment is used to encapsulate the entire software requirements and allow the application to run on non-Ubuntu platforms - this includes Comet.
A pre-written container definition/build file is provided for anyone who wishes to build Mozaik for themselves.
On Comet you will first need to load the Apptainer module, then use the Mozaik definition file to build the container image
This should be as simple as running:
$ module load apptainer
$ apptainer build mozaik.sif mozaik.def
Note that due to the number of additional libraries and dependencies this can be a reasonably long process. Ultimately when the process is finished you will find a large mozaik.sif file - this is your container with Ubuntu Linux, all the software dependencies and the Mozaik application. You do not need to run the apptainer build process again, unless you decide to upgrade the version of Mozaik.
While running the container some of the Nest and Mozaik models want to write to their own install/lib directories - this is unusual, and another reason why Mozaik doesn't appear to work very well outside a single user. However, we can fake this by mounting a temporary filesystem over the top of the container at runtime.
In the test below we:
./input within the container as /inputtest.sh from our ./input directory as the single command to exec
$ module load apptainer
$ apptainer exec --writable-tmpfs --bind input:/input mozaik.sif /input/test.sh
The contents of the test.sh file matches the Running Examples test given from the Mozaik Github repository - it is intended to demonstrate that the installation is working.
#!/bin/bash
# Extend the system and python search paths
export PATH=$PATH:/opt/nest/bin
export PYTHONPATH=/opt/nest/lib/python3.12/site-packages
cd /opt/mozaik/examples/VogelsAbbott2005
python3 run.py nest 2 param/defaults 'test'
After running the apptainer command you should see output that matches that included below:
(OSS 2410.0) [n1234@cometlogin02(comet)]$ apptainer exec --writable-tmpfs --bind input:/input mozaik.sif /input/test.sh
INFO: gocryptfs not found, will not be able to use gocryptfs
-- N E S T --
Copyright (C) 2004 The NEST Initiative
Version: 3.4
Built: Nov 17 2025 21:30:00
This program is provided AS IS and comes with
NO WARRANTY. See the file LICENSE for details.
Problems or suggestions?
Visit https://www.nest-simulator.org
Type 'nest.help()' to find out more about NEST.
Nov 18 08:45:47 Install [Info]:
loaded module PyNN extensions for NEST
START MPI
Loading parameters
Finished loading parameters
mozaik.sheets.vision.VisualCorticalUniformSheet
0 Loaded component VisualCorticalUniformSheet from module mozaik.sheets.vision
0 Loaded component VisualCorticalUniformSheet from module mozaik.sheets.vision
0 Creating VisualCorticalUniformSheet with 3200 neurons.
0 Creating VisualCorticalUniformSheet with 800 neurons.
0 Creating UniformProbabilisticArborization between VisualCorticalUniformSheet and VisualCorticalUniformSheet
0 Connector UniformProbabilisticArborization took 3s to compute
0 Creating UniformProbabilisticArborization between VisualCorticalUniformSheet and VisualCorticalUniformSheet
0 Connector UniformProbabilisticArborization took 1s to compute
0 Creating UniformProbabilisticArborization between VisualCorticalUniformSheet and VisualCorticalUniformSheet
0 Connector UniformProbabilisticArborization took 2s to compute
0 Creating UniformProbabilisticArborization between VisualCorticalUniformSheet and VisualCorticalUniformSheet
0 Connector UniformProbabilisticArborization took 0s to compute
0 Loaded component RCRandomPercentage from module mozaik.sheets.population_selector
0 Loaded component RCRandomPercentage from module mozaik.sheets.population_selector
0 Starting Experiemnts
0 Starting experiment: PoissonNetworkKick
0 Running model
0 Loaded component RCRandomN from module mozaik.sheets.population_selector
0 Loaded component RCRandomN from module mozaik.sheets.population_selector
0 Loaded component RCRandomN from module mozaik.sheets.population_selector
0 Loaded component RCRandomN from module mozaik.sheets.population_selector
0 Simulating the network for 56 ms
0 Finished simulating the network for 56 ms
0 Sheet Exc_Layer average rate: 20.661157
0 Sheet Inh_Layer average rate: 24.609844
0 Stimulus presentation took 2 s, of which 1 s was simulation time
0 Stimulus 1/1 finished. Memory usage: 475MB
0 Experiment 1/2 finished
0 Starting experiment: NoStimulation
0 Running model
0 Simulating the network for 270.0 ms
0 Finished simulating the network for 270.0 ms
0 Sheet Exc_Layer average rate: 11.906948
0 Sheet Inh_Layer average rate: 13.787737
0 Stimulus presentation took 2 s, of which 2 s was simulation time
0 Stimulus 1/1 finished. Memory usage: 477MB
0 Experiment 2/2 finished
0 Total simulation run time: 5s
0 Simulator run time: 2s (46%)
0 Mozaik run time: 2s (53%)
Final memory usage: 479MB
Starting visualization
0 Starting PSTH analysis
0 PSTH analysis took: 0.00044417381286621094seconds
0 Starting TrialAveragedFiringRate analysis
0 TrialAveragedFiringRate analysis took: 0.00011348724365234375seconds
0 Starting Irregularity analysis
0 Irregularity analysis took: 8.130073547363281e-05seconds
0 Starting NeuronToNeuronAnalogSignalCorrelations analysis
0 NeuronToNeuronAnalogSignalCorrelations analysis took: 8.20159912109375e-05seconds
0 Starting PopulationMeanAndVar analysis
0 PopulationMeanAndVar analysis took: 0.0014793872833251953seconds
0 DSV info:
0 Number of recordings: 4
0 InternalStimulus : 4
0 Number of ADS: 1
0 Connections : 1
0 RECORDING RESULTS
0 {"module_path" :"mozaik.stimuli","direct_stimulation_name":'Kick', "direct_stimulation_parameters":MozaikExtendedParameterSet({'exc_firing_rate': 100.0, 'exc_weight': 0.1, 'drive_period': 56.0, 'population_selector': {'component': 'mozaik.sheets.population_selector.RCRandomPercentage', 'params': {'percentage': 20.0}}}), "duration":56, "frame_duration":56, "name":'InternalStimulus', "trial":0}
0 {"module_path" :"mozaik.stimuli","direct_stimulation_name":'Kick', "direct_stimulation_parameters":MozaikExtendedParameterSet({'exc_firing_rate': 100.0, 'exc_weight': 0.1, 'drive_period': 56.0, 'population_selector': {'component': 'mozaik.sheets.population_selector.RCRandomPercentage', 'params': {'percentage': 20.0}}}), "duration":56, "frame_duration":56, "name":'InternalStimulus', "trial":0}
0 {"module_path" :"mozaik.stimuli","direct_stimulation_name":None, "direct_stimulation_parameters":None, "duration":270.0, "frame_duration":270.0, "name":'InternalStimulus', "trial":0}
0 {"module_path" :"mozaik.stimuli","direct_stimulation_name":None, "direct_stimulation_parameters":None, "duration":270.0, "frame_duration":270.0, "name":'InternalStimulus', "trial":0}
0 ANALYSIS RESULTS
0 {"module_path" :"mozaik.analysis.data_structures","analysis_algorithm":'connection storage', "identifier":'Connections', "name":'Connections', "neuron":None, "proj_name":'ExcExcConnection', "sheet_name":None, "source_name":'Exc_Layer', "stimulus_id":None, "target_name":'Exc_Layer'}
0 OverviewPlot plotting took: 0.2823832035064697seconds
0 OverviewPlot plotting took: 0.20375967025756836seconds
0 OverviewPlot plotting took: 0.29886937141418457seconds
0 RasterPlot plotting took: 0.32535862922668457seconds
0 RasterPlot plotting took: 0.35002732276916504seconds
(OSS 2410.0) [n1234@cometlogin02(comet)]$
Running Mozaik via Slurm on a compute node is quite simple; all you need to do is load the Apptainer module in your sbatch file. In the example below we:
#!/bin/bash
#SBATCH --partition=default_free
#SBATCH --account=my_account_code
#SBATCH -c 8
#SBATCH -t 00:30:00
module load apptainer
# This assumes:
# 1. You want to mount $HOME/data as a writeable directory in the container
# 2. Your container image is on the /nobackup filesystem
# 3. The commands you want mozaik to run (including the path to Python and
# your Mozaik model commands) are in the runner.sh script in $HOME/data/runner.sh
apptainer exec --writable-tmpfs --bind $HOME/data:/data /nobackup/proj/my_project/mozaik.sif /data/runner.sh
As detailed with Apptainer, Podman and Docker you can only create new containers on the login nodes. Do not attempt to create new containers whilst your job is running on a compute node.
Once your container exists you can then run it on any compute node via a Slurm job, or an interactive Open OnDemand desktop session.