Hi François,
I would like to run Bs3 scripts from a server in which cannot open any window.
I found the option to start brainstorm without a gui (brainstorm nogui) from a Matlab window.
However if I run matlab from a terminal (matlab -nodisplay) I can not run this 'brainstorm nogui' (or brainstorm server). I get the following error message (below).
Is there by chance a way around this (ie to open both matlab and brainstorm without any window from a terminal)?
thanks! and sorry for the spamming!
-- the error message:
BST> Starting Brainstorm:
BST> =================================
BST> Version: 12-Mar-2018
BST> Emptying temporary directory...
BST> Deleting old process reports...
BST> Loading configuration file...
BST> Initializing user interface...
Error using gui_layout>GetScreenClientArea (line 162)
Java exception occurred:
java.awt.HeadlessException
at sun.java2d.HeadlessGraphicsEnvironment.getScreenDevices(HeadlessGraphicsEnvironment.java:72)
Error in gui_layout (line 33)
eval(macro_method);
Error in bst_startup (line 318)
GlobalData.Program.ScreenDef = gui_layout('GetScreenClientArea');
Error in brainstorm (line 138)
bst_startup(BrainstormHomeDir, 0, BrainstormDbDir);
This is something I was hoping to work on before at some point…
http://neuroimage.usc.edu/brainstorm/Next
But it’s something that requires a LOT of developement (all the software is currently based on the interface…)
So it won’t happen immediately.
1 Like
Hello Francois,
Any update on this? We are trying to use brainstorm on a cluster and no gui, and getting an error message related to the bst_report function.
Thanks!
No update on this front, sorry.
Can you please copy-paste here the error message you get?
Hello Francois,
thanks for the prompt reply.
Here is the log (copy paste), something wrong with bst_report, I think.
I can attach the txt, if it's better.
< M A T L A B (R) >
Copyright 1984-2017 The MathWorks, Inc.
R2017b (9.3.0.713579) 64-bit (glnxa64)
September 14, 2017
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
BST> Starting Brainstorm:
BST> =================================
BST> Version: 27-Jun-2018
BST> Emptying temporary directory...
BST> Deleting old process reports...
BST> Loading configuration file...
BST> Loading default montages...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
PROGRESS> Import montage: Loading montage files...
BST> Initializing user interface...
{Error using gui_layout>GetScreenClientArea (line 162)
Java exception occurred:
java.awt.HeadlessException
at
sun.java2d.HeadlessGraphicsEnvironment.getScreenDevices(HeadlessGraphicsEnvironment.java:72)
Error in gui_layout (line 33)
eval(macro_method);
Error in bst_startup (line 318)
GlobalData.Program.ScreenDef = gui_layout('GetScreenClientArea');
Error in brainstorm (line 138)
bst_startup(BrainstormHomeDir, 0, BrainstormDbDir);
}
{Error using bst_process>CallProcess (line 2080)
Please start Brainstorm before calling bst_process().
Error in bst_process (line 36)
eval(macro_method);
}
{Struct contents reference from a non-struct array object.
Error in bst_report>Save (line 579)
ProtocolName =
file_standardize(GlobalData.ProcessReports.Reports{iStart,4}.Comment);
Error in bst_report (line 58)
eval(macro_method);
}
{Undefined function or variable 'ReportFile'.
}
Hello Francois,
Just a quick update on this;
Apparently, the easiest solution (which was hard to find, indeed), is to use ssh -X and login to our cluster.
In this way we do use brainstorm as in a “local” machine (with not such big delays or major difficulties).
We experimented another couple of options, but ultimately we though that this is really easy to do.
If anyone has more Qs about this, feel free to reach out, and I’ll share more details.
Best,
Recap:
ssh -X <login_to_your_cluster>
{do whatever you have to do in between}
load module fieldtrip
load module matlab
matlab
in matlab
brainstorm
in brainstorm
edit preference and add the path to your fieldtrip module in the cluster env.
use the GUI of brainstorm to do exactly what you were doing local. If needed, you can generate your .m script on brainstorm, batch whatever you need to, and then run it local on matlab. that also worked for us.
That’s all for now;
@bnmorillon @SpagnaPhd
I’ve just push a large commit that should allow the use of Brainstorm in a headless context (on a cluster, or any remote server without display):
https://github.com/brainstorm-tools/brainstorm3/commit/78a8c1fe31da6603de66a655920f4156f89c418d
Instead of starting with “brainstorm nogui”, use “brainstorm server”.
There are probably plenty of little things to adjust, let me know how this work for you.
2 Likes
Thanks Francois,
we just finished our testing of brainstorm server, and we are very happy with the results. It works perfectly on our cluster at ICM.
We are also able to call field-trip funcitons on matlab, through brainstorm server. no issues.
If any additional info regarding what we are actually doing is needed, do not hesitate to ask.
AWESOME job!
1 Like
Good to know!
Thanks for keeping me posted.
Don’t hesitate to tell us if you have any suggestion in the future
FYI: Brainstorm now supports the direct execution of custom Matlab scripts, including from the compiled version of Matlab, including all the SPM and FieldTrip dependencies. This means that you can write your own .m scripts and execute them on a computation cluster on which you don't have a Matlab license but only the MCR installer.
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Starting_Brainstorm
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Running_scripts_on_a_cluster