<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Katharina,<div class=""><br class=""></div><div class="">The break is for when you specify ‘cell’ parameter when calling std_precomp.m. This was implemented for debugging purposes, so removing the line with the break is fine. </div><div class="">There is no reason for returning different number of frequencies. My guess is that something did change. The parfor loop is very straightforward. It is just a loop performed in parallel. It will not change anything else.</div><div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">Arno</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 8, 2015, at 11:57 PM, Katharina Ledergerber <<a href="mailto:k.ledergerber@psychologie.uzh.ch" class="">k.ledergerber@psychologie.uzh.ch</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear Arno,<div class=""><br class=""></div><div class="">thanks a lot. The parallel pools work and computations is much faster.</div><div class="">However, I have now the problem that results are slightly different from what I calculated without parallel pools. I changed the line you told me. And the section looks like this:</div><div class=""><br class=""></div><div class=""><div class="">parfor index = 1:length(STUDY.design(g.design).cell)</div><div class="">            if ~isempty(g.cell)</div><div class="">                 desset = STUDY.design(g.design).cell(g.cell);</div><div class="">            else desset = STUDY.design(g.design).cell(index);</div><div class="">            end;</div><div class="">            if strcmpi(computewhat, 'channels')</div><div class="">                [tmpchanlist opts] = getchansandopts(STUDY, ALLEEG, chanlist, desset.dataset, g);</div><div class="">                std_ersp(ALLEEG(desset.dataset), 'channels', tmpchanlist, 'type', type, 'fileout', desset.filebase, 'trialindices', desset.trials, opts{:}, tmpparams{:});</div><div class="">            else</div><div class="">                if length(desset.dataset)>1 && ~isequal(chanlist{desset.dataset})</div><div class="">                    error(['ICA decompositions must be identical if' 10 'several datasets are concatenated to build' 10 'the design, abording' ]);</div><div class="">                end;</div><div class="">                std_ersp(ALLEEG(desset.dataset), 'components', chanlist{desset.dataset(1)}, 'type', type, 'fileout', desset.filebase, 'trialindices', desset.trials, tmpparams{:});</div><div class="">            end;</div><div class="">            if ~isempty(g.cell), break; end;</div><div class="">        end;</div></div><div class=""><br class=""></div><div class="">The problem here is, that there is a break argument in the second last line, which is not valid for parfor loops (produces huge error messages). What does the  if ~isempty(g.cell), break; end; exactly do? </div><div class="">To make the function work I removed this line including the break argument. Could this be the reason for why I have different results? I also noticed that before I used the parfor loop, the precomputation gave me 102 ersptimes and 40 erspfreqs. With the parfor loop I now obtain still 102 ersptime, but also 102 erspfreqs. Why do I suddenly have a higher frequency resolution? Apart from canceling the line with the break argument, I did not change anything at all.</div><div class=""><br class=""></div><div class="">Thanks in advance for your help.</div><div class="">Best,</div><div class="">Katharina</div><div class=""><div class=""><br class="webkit-block-placeholder"></div><div class=""><br class="webkit-block-placeholder"></div><div apple-content-edited="true" class="">
<div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Katharina Ledergerber, MSc.<br class="">PhD student<br class="">University of Zurich<br class="">Developmental Psychology:<br class="">Childhood and Infancy <br class="">Binzmuehlestrasse 14, Box 21<br class="">CH-8050 Zurich<br class=""></div>
</div>

<br class=""><div class=""><div class="">Am 08.06.2015 um 08:00 schrieb Arnaud Delorme <<a href="mailto:arno@ucsd.edu" class="">arno@ucsd.edu</a>>:</div><br class="Apple-interchange-newline"><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear Katharina,<div class=""><br class=""></div><div class="">I think the standard way to change line 483 of std_precomp (in my version) from </div><div class=""><br class=""></div><div class="">        for index = 1:length(STUDY.design(g.design).cell)<br class=""><br class="">to</div><div class=""><br class=""></div><div class="">        parfor index = 1:length(STUDY.design(g.design).cell)<br class=""><br class="">Then type in on the command line </div><div class=""><br class=""></div><div class="">matlabpool(4);</div><div class=""><br class=""></div><div class="">Then run the spectral computation. It would make sense to change this line by default since parfor defaults to for by default (so we will do it).</div><div class="">Best,</div><div class=""><br class=""></div><div class="">Arno</div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jun 7, 2015, at 5:18 PM, Makoto Miyakoshi <<a href="mailto:mmiyakoshi@ucsd.edu" class="">mmiyakoshi@ucsd.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Dear Arno and Ramon,<div class=""><br class=""></div><div class="">Please help me with this question about the use of parfor().</div><div class=""><br class=""></div><div class="">Makoto</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jun 4, 2015 at 6:48 AM, Katharina Ledergerber <span dir="ltr" class=""><<a href="mailto:k.ledergerber@psychologie.uzh.ch" target="_blank" class="">k.ledergerber@psychologie.uzh.ch</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everyone,<br class="">
<br class="">
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.<br class="">
<br class="">
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):<br class="">
<br class="">
[STUDY ALLEEG] = std_precomp(STUDY, ALLEEG, {}, 'design', 1, 'ersp', 'on', 'itc', 'on');<br class="">
STUDY = pop_savestudy( STUDY, ALLEEG, 'filename', STUDY.filename, 'filepath', STUDY.filepath, 'savemode', 'resave');<br class="">
<br class="">
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.<br class="">
<br class="">
parpool (‚local‘, 8)<br class="">
[STUDY ALLEEG] = std_precomp(STUDY, ALLEEG,{} , 'design', 1, 'ersp', 'on', 'itc', 'on');<br class="">
STUDY = pop_savestudy( STUDY, ALLEEG, 'filename', STUDY.filename, 'filepath', STUDY.filepath, 'savemode', 'resave‘);<br class="">
delete(gcp);<br class="">
<br class="">
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.<br class="">
Does anyone have a function already modified with parfor loops? Otherwise, I am grateful for any advice about using parallel pools and ERSP precomputation.<br class="">
<br class="">
Thanks,<br class="">
Katharina<br class="">
<br class="">
Katharina Ledergerber, MSc.<br class="">
PhD student<br class="">
University of Zurich<br class="">
Developmental Psychology:<br class="">
Childhood and Infancy<br class="">
Binzmuehlestrasse 14, Box 21<br class="">
CH-8050 Zurich<br class="">
_______________________________________________<br class="">
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank" class="">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br class="">
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" class="">eeglablist-unsubscribe@sccn.ucsd.edu</a><br class="">
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" class="">eeglablist-request@sccn.ucsd.edu</a><br class="">
</blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class="">Makoto Miyakoshi<br class="">Swartz Center for Computational Neuroscience<br class="">Institute for Neural Computation, University of California San Diego<br class=""></div></div>
</div>
</div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>