Searchlight in rsa-toolbox (memory issues)

Hi Everyone,

I’m working on my first searchlight analysis on data from fMRI project. Since I collaborate on it, we use the rsa-toolbox from MRC CBSU in matlab to setup the analysis on computing cluster. The experiment had 4 runs (612 scans each) per participant and 36 participants in total. All data were prepared for SL according to standards and 4 runs were concatenated before beta extraction. However, when I run SL analysis it seems that after 21 participants the memory requirements peaks above 512GB (!) limit of our cluster.
Does any one have experience with such problems? Is it normal that searchlight has such gigantic memory requirements? What can be done?

Any advice will be much appreciated!

PS. Do you have any suggestions/opinions for alternative MVPA/RSA toolboxes (matlab, python, fsl…anything else by that matter) that will work on SPM data?

Hi,
In the case you do not need to keep all the subjects in memory at once, my guess is that the memory management is the issue here, there are some applications (eg Neuroelf) that requires specific commands (other than simple “clear” or overwrite variables) to actually free the memory associated to the variable. Another issue could arise from the fact that the toolbox is not treating the searchlight matrices as Sparse matrix (which is quite unlikely i guess, but you never know).

Just to give you some numbers: let’s say S=size of the brain you want to divide in searchlights (size can vary a lot, for my data 7T at 1.6mm res i have approx 300000 voxels) a searchlight matrix has size SxS if you keep 300000 as ref, you have 90 *1e9 times the nsub = 3,24 1e12. Now, if this matrix is not treated as sparse but as a double, we need to muliplty by 8 giving us the number 25930 1e9 bytes…25930 Gb. Given this number probably even a sparse matrix wouldn’t fit in memory, that’s why i thought about the thing that memory is not been freed properly by the toolbox. What you could do is debug the code and actually see what the script is doing and how is treating each subject.

Also another good RSA toolbox for matlab is the one of Niko Kriegeskorte & Co:
Paper: * https://doi.org/10.1371/journal.pcbi.1003553
Link to the toolbox: http://www.mrc-cbu.cam.ac.uk/methods-and-resources/toolboxes/license/

Thanks for reply and advice. The toolbox you referring to is the one I’m using. We’re upgrading memory for now in push not to change the pipeline. However, I’ve also read recommendation for the use of pyMVPA for searchlight. I guess trying different platform won’t hurt.

MANAGED BY INCF