https://github.com/bluebrain/multiscalerun
Python package to run brain cells simulation at different scales
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.9%) to scientific vocabulary
Keywords
Repository
Python package to run brain cells simulation at different scales
Basic Info
- Host: GitHub
- Owner: BlueBrain
- License: lgpl-3.0
- Language: Jupyter Notebook
- Default Branch: main
- Homepage: https://multiscalerun.rtfd.io
- Size: 95.9 MB
Statistics
- Stars: 2
- Watchers: 10
- Forks: 1
- Open Issues: 9
- Releases: 1
Topics
Metadata Files
README.md
[!WARNING] The Blue Brain Project concluded in December 2024, so development has ceased under the BlueBrain GitHub organization. Future development will take place at: https://github.com/openbraininstitute/MultiscaleRun
MultiscaleRun

MultiscaleRun is a Python package to run brain cells simulation at different scales. It orchestrates the coupling between several brain simulators like Neuron and STEPS but also solvers like AstroVascPy for the cerebral blood flow. The package also embeds a Julia solver to simulate the astrocytes activity.
The Python package includes a program called multiscale-run that lets you run
and analyze multiscale simulations from start to finish.
Dependencies
This Python package requires Python 3.8 or higher.
How to install MultiscaleRun?
Apart from supercomputers where MultiscaleRun may be provided as a module, the general way to install MultiscaleRun is via the pip utility:
pip install multiscale-run
How to use the MultiscaleRun executable?
The multiscale-run executable provides several commands to initialize, configure and execute simulations
Setup a new simulation
shell
multiscale-run init /path/to/my-sim
This command creates the following files in /path/to/my-sim providing both the circuit, the configuration files, and the runtime dependencies:
circuit_config.json: description of the circuit to simulatenode_sets.json: subsets of cells acting as targets for different reports or stimulations. See also https://github.com/AllenInstitute/sonata/blob/master/docs/SONATADEVELOPERGUIDE.md#node-sets-filesimulation_config.json: ties together the definition of the simulation on the circuit, see section Simulation Configuration below to have an understanding of the dedicated "multiscale_run" section.simulation.sbatch: An example of SLURM script to launch the simulation on BB5postproc.ipynb: An example of Jupyter notebook making use of the simulation results to build a report
The generated setup is ready to compute, but feel free to browse and tweak the JSON configuration files at will, especially the "multiscalerun" section of file `simulationconfig.json`
:ledger: See
multiscale-run init --helpfor more information
Verify a simulation configuration
This command performs a series of check to identify common mistakes in the configuration. It is recommended to perform this operation before starting a simulation.
shell
multiscale-run check [/path/to/my/sim]
Compute the simulation
On the current machine / allocation
shell
multiscale-run compute [/path/to/my-sim]
:ledger: To use multiple ranks, use
srun -n X multiscale-run computewhere X is the number of ranks. Notice that steps requires this to be a power of 2.:ledger: See
multiscale-run compute --helpfor more information:exclamation: You may need to load the
intel-oneapi-mklmodule on BB5 if not already loaded otherwise you will probably experience the following error when running the compute phase:libmkl_intel_thread.so.1: undefined symbol: omp_get_num_procs
Three more folders will be created during the simulation:
* cache: it keeps some cached communication matrices, useful for subsequent runs
* mesh: mesh files for steps. If the folder is missing a standard mesh will be generated Just In Time
* RESULTS: the results of the simulation. Various data are recorded here in HDF5 files. The variables are per-neuron based. MultiscaleRun mimics the structure of Neurodamus result files so that they can be post-processed with the same method
:For efficiency reasons, MultiscaleRun result files are filled with 0s at the beginning of the simulation. Thus, if the simulation dies early, these files will be full of 0s for the time steps after the simulation died
On SLURM cluster:
sbatch simulation.sbatch
Other operations
Custom Neuron mechanisms
This operation clones the Neurodamus mod files library for local editing.
shell
multiscale-run edit-mod-files [/path/to/my-sim]
Troubleshooting
The command build_neurodamus.sh mod may fail with the following error:
=> LINKING shared library ./libnrnmech.so
/usr/bin/ld: /path/to/install_oneapi-2023.2.0-skylake/neuron-9.0.a15-lrspl6/lib/libnrniv.so: unable to initialize decompress status for section .debug_info
/usr/bin/ld: /path/to/install_oneapi-2023.2.0-skylake/neuron-9.0.a15-lrspl6/lib/libnrniv.so: unable to initialize decompress status for section .debug_info
/path/to/install_oneapi-2023.2.0-skylake/neuron-9.0.a15-lrspl6/lib/libnrniv.so: file not recognized: File format not recognized
icpx: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/path/to/install_oneapi-2023.2.0-skylake/neuron-9.0.a15-lrspl6/bin/nrnmech_makefile:133: mech_lib_shared] Error 1
This happens because Neuron was built with Intel oneAPI compiler but the compiler is not available in the environment. Loading the proper module on BB5 may fix the issue module load unstable intel-oneapi-compilers
Convert BlueConfig to SONATA compatible JSON file
- Setup a development environment with the
multiscale-run virtualenvoperation - Clone the bluepy-configfile repository
- Go to the repository and execute:
pip install . - In the BlueConfig (BC) of interest comment out the
RunModefield, theCircuit GLIAsection, theProjection NeuroGliasection, and the theProjection GlioVascularsection. - Go back to the MultiscaleRun repo and run
blueconfig convert-to-sonata /gpfs/bbp.cscs.ch/project/proj62/Circuits/O1/20190912_spines/sonata/circuit_config.json ngv.json user.target BlueConfig. The first argument, i.e. circuit_config, should point to an existing SONATA circuit config file, which can be found by searching the folder defined inCircuitPathfield of the BlueConfig. The second argument is the name of the SONATA simulation config file to be created from the BlueConfig. The third argument is the path to an existing SONATA nodesets file, and the fourth argument is the BlueConfig that we want to convert. - Now the
ngv.jsoncan be used from the Jupyter notebook for the visualizations.
Profile MultiscaleRun script with ARM MAP
- Load ARM MAP in the environment:
module load arm-forge - Run the simulation:
map --profile --output OUT.map srun [...] multiscale-run compute [/path/to/my-sim] - Open
OUT.mapwith the Arm Forge Client (locally)
For more on how to use ARM MAP on BB5, please check this page.
Changelog
- Remove upload gitlab logs as the CI logs are used only internally.
- New vasculature-segment-based reports are available now. Postproc and docs have been updated as well to address these new functionalities.
0.8.2 - 2024-08-27
Project governance
- Open-source release on GitHub https://github.com/BlueBrain/MultiscaleRun
- Publication of the documentation on https://multiscalerun.rtfd.io
- Move some of the GitLab CI/CD tasks to GitHub workflows.
Bugfixes
- Add the command
multiscale_run statsto retrieve some simple stats from the simulation. virtualenvwas not setting correctlyHOC_LIBRARY_PATHwhen called from a python environment itself.
0.8.1 - 2024-07-03
Bugfixes
edit-mod-fileswas not working anymore because neurodamus changed the position of themodfolder. Updated.edit-mod-fileswas giving wrong suggestions since we should usebuild_neurodamus.sh mod --only-neuronnow.
0.8 - 2024-06-04
Major Changes
- The configuration file has changed in the
connectionssection:- you can specify where the connection takes place and if you want to write the connection results (
vals) in the source simulator too. - matrices are now part of the
opoperation and can be used throughout the code. - A
dest_simulatorkey is now required for every connection asconnect_tokeys do not dictate which simulator is the destination simulator anymore. - Previous
simulation_config.jsonfiles must be adapted since backward compatibility is not possible. However, changes should be small and self-explanatory if a new template is compared to an old version (v 0.7,config_format: 2) of the configuration file.
- you can specify where the connection takes place and if you want to write the connection results (
- New thorough verification of the MultiscaleRun configuration in file
simulation_config.jsonduring thecheckandcomputeoperations.
Internal Changes
- Improve memory usage of class
multiscale_run.MsrConfig - Add
update_currents.shin root for temporary storage. We still need to figure out where to put it or if we want to keep it at all. Sofia Farina and Alexis Arnaudon know more about this file.
0.7 - 2024-04-10
Major Changes
Rework of the config object and the config file
- The configuration file
msr_config.jsondoes not exist anymore. All the MultiscaleRun configurations have been merged intosimulation_config.jsonin a new root section:multiscale_run. This is not yet SONATA. The configuration is in the same file but Neurodamus is not aware of it. [BBPP40-455]. - The configuration has changed significantly from 0.6. The documentation has now a dedicated page to explain how to use it.
- All the
magic numbersin metabolism have been moved to the configuration or eliminated. For this reason, simulation behavior changed. Currently, neurons develop an ATP deficiency that breaks the simulations after a certain amount of time. This requires studies that will be incorporated in a future release.
Rework of metabolism
- All the
magic numbersthat were used as glue among the various simulators have been moved to the configuration file (simulation_config.json) or removed. - Value checking before a metabolism time step can now be changed from the config file. For example you can now say that if a neuron has an ATP that is lower than 0.25 it should be kicked out of the simulation and the simulation needs to continue without it. More information on how to do it is available in the configuration documentation.
- The metabolism model and metabolism object are not connected with fixed numbers anymore. Thus, if you want to change the model just a change in the configuration file is required.
Rework of the connections among simulators
- Connections among simulators can now be changed programmatically from the configuration. Just after a simulator (called
destination simulator) does anadvancethe connection manager loops over its connections, picks thesource simulatorand performs the connections. Currently there are 3 types of connections:sumsums the values from thesourceand thedestinationin the destination simulator.setsets the values fromsourceintodestination.mergemerges the two discording values $V{\text{source}}$ and $V{\text{destination}}$ using the formula: $V{\text{source}} + V{\text{destination}} - V{n-1} = Vn$. $V_n$ is then set in bothsourceanddestination. This is the only connection type that also changes thesource. Notice that swappingsourceanddestinationis not exactly equivalent because the sync is performed after adestinationadvance.
Rework of the reporting
- The reporting structure has been changed significantly (mostly simplified and improved). However, these changes are mostly under the hood except for the changes in the configuration file. Consider reading the appropriate section in the documentation to know more MultiscaleRun reports.
Minor Changes
- Added documentation for the configuration file.
- Added docstrings in the code.
bf->bloodflowkeyword change for simpler future development [BBPP40-440].- Added type suggestions for function signatures in the code.
- Formatted docstrings for
sphinxdocumentation. - Updated
postprocto handle the new configuration. - Reworked the Python
importstatements and the initialization of the MPI library to fix possible hanging issues whenMPI_Finalizewas called. - Add static analysis of the code in the continuous-integration process.
Bug Fixes
- Fix a bug in the pytest CI that made it pass even if some tests were failing
- Fix hanging simulations when an error is thrown [BBPP40-427] when MPI is used
0.6 - 2024-03-04
- virtualenv command:
- Improvement: the command now installs spack pkg if necessary. There is no need to run spack commands manually anymore. [!104]
- Fix issue when MultiscaleRun was loaded from BB5 module
py-multiscale-run. [BBPP40-430]
- edit-mod-file command: load intel compilers module if required (!104)
- improved the documentation of the Python API
0.5.1 - 2024-02-07
- Fix: init with julia create was not pointing to the correct location
0.5 - 2024-01-29
- Improved README
msr_config.jsonis a template now. Prepared for the bbp workflowbase_pathis now specified in the main config file. This is breaking change. Add to yourmsr_config.jsonfile a field:"base_path": "."ndamis now forced to useRoundRobin
0.4 - 2024-01-19
- New commands:
edit-mod-files: Clone the Neurodamus mod files library for local editingvirtualenv: Create a Python virtual environment to ease development of MultiscaleRun Python package
- Fix possible program hang due to sensitive MPI initialization
- Improved README
- Added a section for
spack environments - Increased standard mesh refinement for ratV10 to not have ranks without tets (omega_h cannot handle them)
- Align to bbp workflow
0.3 - 2024-01-10
- new
post-processingcommand creates an HTML report based on simulation results. Usage:multiscale-run post-processing [sim-path]. Usemultiscale-run post-processing -hfor more information. initcommand:- new option
--no-checkto skip the tests of Julia environment which lasts several minutes - new keys in
msr_config.json: config_format: an integer, the version of this file structuremsr_version: a string indicating the version of MultiscaleRun that created this config
- new option
computecommand: now creates a Neurodamus success file at the end of the simulation- Compatibility notes for simulations created with previous versions of MultiscaleRun
- rename directory
julia_environmentto.julia_environment - it is not possible to override the JSON configuration keys with environment variables.
- rename directory
- GitLab CI on BB5 now relies on spack
0.2 - 2023-12-14
- Rework reporting [BBPP40-402, BBPP40-407, BBPP40-410, BBPP40-411, BBPP40-415]
0.1 - 2023-11-30
First release of the code shipped as a Python package
Authors
Polina Shichkova, Alessandro Cattabiani, Christos Kotsalos, and Tristan Carel
Funding and Acknowledgments
The development of this software was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government’s ETH Board of the Swiss Federal Institutes of Technology.
Copyright (c) 2023-2024 Blue Brain Project/EPFL
Owner
- Name: The Blue Brain Project
- Login: BlueBrain
- Kind: organization
- Email: bbp.opensource@epfl.ch
- Location: Geneva, Switzerland
- Website: https://portal.bluebrain.epfl.ch/
- Repositories: 226
- Profile: https://github.com/BlueBrain
Open Source Software produced and used by the Blue Brain Project
GitHub Events
Total
- Create event: 1
- Release event: 1
- Issues event: 5
- Watch event: 2
- Delete event: 1
- Issue comment event: 5
- Push event: 39
- Pull request event: 3
- Fork event: 1
Last Year
- Create event: 1
- Release event: 1
- Issues event: 5
- Watch event: 2
- Delete event: 1
- Issue comment event: 5
- Push event: 39
- Pull request event: 3
- Fork event: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 9
- Total pull requests: 10
- Average time to close issues: 24 days
- Average time to close pull requests: 14 days
- Total issue authors: 1
- Total pull request authors: 2
- Average comments per issue: 0.11
- Average comments per pull request: 2.4
- Merged pull requests: 7
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 9
- Pull requests: 7
- Average time to close issues: 24 days
- Average time to close pull requests: 21 days
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 0.11
- Average comments per pull request: 0.29
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- cattabiani (9)
- tristan0x (1)
Pull Request Authors
- tristan0x (11)
- cattabiani (8)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v4 composite
- actions/checkout v4 composite
- actions/checkout v4 composite
- actions/download-artifact v4 composite
- actions/setup-python v4 composite
- actions/upload-artifact v4 composite
- pypa/gh-action-pypi-publish release/v1 composite
- docutils ==0.19
- astrovascpy >=0.1.5
- bluepysnap >=2
- diffeqpy >=1.1
- gmsh >=4.2
- jinja2 >=3
- jsonschema >=4
- julia >=0.6, <0.7
- libsonata >=0.1.20
- mpi4py >=3
- notebook >=6
- numpy >=1.22
- pandas >=1.4
- psutil >=5.8
- scipy >=1.11.1
- simpleeval >=0.9.13
- tqdm >=4.65
- trimesh >=3