Open additional brainstorm instances at the same time

I'm trying to open an additional brainstorm instance using "Open Additional Instance of MATLAB". While the approach succeeded in opening more than two brainstorm programs simultaneously, I found that multiple brainstorm programs seem to be unable to work together, as one instance appeared to change the settings of another instance. My goal is to deal with various datasets simultaneously, is there any solution?
Thank you!

Best wishes,
Peng-Hu Wei

At the moment, Brainstorm is not safe for running multiple instances in parallel: the database is not robust for concurrent accesses, and indeed the changes in user preferences from one instance are not reported to the other instances.

We are working on a major update of the database using a SQLite database engine, it will allow multiple users to work on the same database.
Even with this, a single users will not be able to work on different different protocols at the same time, or expect all the user preferences to be managed synchronously between multiple instances.

While you have a long process running, it is possible to start a second instance to work interactively (eg. data reviewing) if and only if:

  1. you do not change the protocol
  2. you work on a different subject
  3. every time you start Brainstorm you reload the protocol
  4. the processes you are using are not saving anything in the Brainstorm temporary folder ($HOME/.brainstorm/tmp) - this excludes everything that calls external programs (OpenMEEG, SPM, CAT, DUNEuro...)

Note that in most cases, there is not computation advantage in running multiple instances of Matlab in parallel. Since most standard Matlab functions are already nicely multithreaded (using all the cores of your processors), running two instances of the whole environment simultaneously is most of the time not improving the full computation time, but on the other hand it can be detrimental to your system capacity to provide the resource MATLAB requests (a packed working memory might require some super slow disk swapping, and multiple I/O intensive processes should never be executed in parallel).

Unless you have more than 16 computation cores and 64Gb RAM, I would not recommend running two instances of Matlab simultaneously if the goal is to save computation time.
To optimize your processing stream with Brainstorm: script your analysis with loops over the multiple files you want to process and let it run sequentially, instead of starting multiple things simultaneously from the GUI. Additionally, you will gain in reproducibility, and you'd be able to re-run your analysis automatically if you need to change one parameter.

1 Like

Francois. Thank you so much!