[Eeglablist] How to use parallel pools in the std_precomp function?

Katharina Ledergerber k.ledergerber at psychologie.uzh.ch
Thu Jun 4 06:48:52 PDT 2015

Hi everyone,

I am quite new to EEGLAB and I hope that I can explain my problem properly. I have a question on how to use parallel pools with the std_precomp function.

Currently I am applying time-frequency analyses on my high-density EEG data, recorded with a 128 electrode system. Therefore I use the standard std_precomp function to precompute channel measure ERSP/ITC on my files in the STUDY (for all subjects and all channels):

[STUDY ALLEEG] = std_precomp(STUDY, ALLEEG, {}, 'design', 1, 'ersp', 'on', 'itc', 'on'); 
STUDY = pop_savestudy( STUDY, ALLEEG, 'filename', STUDY.filename, 'filepath', STUDY.filepath, 'savemode', 'resave');

As it is an FFT, it takes quite a while to compute (right now approx. 100 min per subject). Since I do not have a very powerful computer (4 cores, 8GB RAM), I thought I could try the precomputation on a more powerful computer (16 cores, 32GB RAM) to save time. To make use of all the cores I tried to apply parpool.

parpool (‚local‘, 8) 
[STUDY ALLEEG] = std_precomp(STUDY, ALLEEG,{} , 'design', 1, 'ersp', 'on', 'itc', 'on'); 
STUDY = pop_savestudy( STUDY, ALLEEG, 'filename', STUDY.filename, 'filepath', STUDY.filepath, 'savemode', 'resave‘);

It seemed to work, since all 16 cores showed activity. Strangely, the more powerful computer took as much time as my computer. Could it be that jobs are not distributed among cores, but all cores do exactly the same? Since I am very new to EEGLAB I have still some trouble understanding what the std_precomp function does in detail. I guess to distribute jobs among cores I should implement parfor loops in the std_precomp function instead of the ordinary for loops? I think, though that it is not as easy to implement, since parfor loops do have some restrictions in terms of what you can put in the loop.
Does anyone have a function already modified with parfor loops? Otherwise, I am grateful for any advice about using parallel pools and ERSP precomputation.


Katharina Ledergerber, MSc.
PhD student
University of Zurich
Developmental Psychology:
Childhood and Infancy 
Binzmuehlestrasse 14, Box 21
CH-8050 Zurich

More information about the eeglablist mailing list