NeilwBailey / RELAX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Out of memory error on MATLAB while running RELAX

chengq19 opened this issue · comments

Hi!!! I'm using the RELAX pipeline to automate preprocesing of ERPs for my data on Ubuntu focal. However, for some reason, parpool keeps shutting down MATLAB when it got to the the stage where MWF is used to clean up EEG artifacts. I checked my kernel log and noticed that the shutdown was due to Out of Memory error and I also noticed that this is likely due to parpool. Hence, I tried to optimise my parallel processing profile (restricting the number of workers) to avoid OOM error. However, my attempts were unsuccesful thus far and the thing is that my desktop specs are pretty good (13th gen i7 processsor with 6 cores i.e., 12 threads, 32 gb RAM etc). I am a bit stuck on how best to resolve the issue and would like to look for some advice on the following:

  1. Is there any way to switch off parpool to bypass the OOM error?
  2. Is there any way to optimise parpool to avoid OOM error (besides physically increasing the amount of RAM on my computer)?

Thank you!

Best Regards,
Xiaoqin

Dear Neil,

Thanks so much for your advice and so sorry for only replying when this is marked by you as completed/closed. I tried out a few things and thought to just list down what resolve the issue for me in case it will help other people. So in my case, the issue was because my file size is huge (I had a 1 hour 20 minutes recording acquired at 500 Hz) and the delay period set was too large. So I had to delete data segments that I am not analysing (e.g., EEG data recorded during breaks) and reduced the delay from the default 8 to 6 so the MWF can run. I now use a delay period of 5 and when I manually scanned through the data, it seems that that does already provide a pretty good cleaning. Also, I have to add that because PREP already call parfor, in my case, it was essential to shut down the parallel pool called during PREP findNoisyChannels and have fieldtrip call the parallel pool again so that workers do not get aborted or lose connection during parallel processing when fieldtrip functions are called. Hope this can be useful!

Again, thanks so much for the prompt reply and sorry for my delay in replying!!!

Best Regards,
Xiaoqin

Dear Xiaoqin

Thank you for replying and listing these solutions, I'm sure they will be helpful for other users of RELAX as well, much appreciated.

Kind regards,

Neil