<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Frans<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Yes, there are two places with the parfor.  I did grep on the programs in the fieldtrip folder<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">./external/simbio/JERLab_sb_transfer.m:%JERLab start the parallel pool, use parfor<o:p></o:p></p>
<p class="MsoNormal">./external/simbio/JERLab_sb_transfer.m:parfor i=2:length(vol.elecnodes)<o:p></o:p></p>
<p class="MsoNormal">./JERLab_ft_prepare_leadfield.m:% with max number of nodes; primarily parfor loop for ft_compute_leadfield<o:p></o:p></p>
<p class="MsoNormal">./JERLab_ft_prepare_leadfield.m:   parfor i=1:length(insideindx)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I also modified the ft_prepare_leadfield, but don’t use it. <o:p>
</o:p></p>
<p class="MsoNormal">./ft_prepare_leadfield.m:   parfor i=1:length(insideindx)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I also added a cfg option that I named “computeparallel”, probably in JERLab_ft_prepare_leadfield, which controls if a parfor is used or if this is done in the default version.  Several of the examples in the FT documentation use 10 mm
 or larger hex source model and head models, likely because these can be computed relatively quickly, and we “could” use the default version.   I use 3mm hex or 3mm tetra for child/adults, and 2mm for infants, which take “several hours” in the default non-parallel
 version.   We also run these on a large linux cluster.   With only one subject we request machines with the max no of cores (28, or 48).  However, there is some “optimal speed-size” tradeoff for no of cores, and some times we do several subjects at the same
 time with smaller heads and so can designate the no of cores.   Generally our pipeline gets one EEG subject, possibly with individual MRI on that subject or with “close MRI” or “average template”, and we run one subject in the LF with 48 cores.   However,
 we also have done some studies with 87+ subjects with multiple head models and run them on the 28 core machines in a slurm cluster system.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">FYI, in our cluster we have a “home” folder that is used by all the machines.  MATLAB places the programs for the parfor in the home .matlab folder.  If we run more than one program on the same machine we have to explicitly declare the
 folder to be used in the parfor procedure so the two programs do not overwrite their work.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">John <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:Consolas;color:black">***********************************************<br>
John E. Richards<br>
Carolina Distinguished Professor<br>
Department of Psychology<br>
University of South Carolina<br>
Columbia, SC  29208<br>
Dept Phone: 803 777 2079<br>
Fax: 803 777 9558<br>
Email: </span><span style="color:#1F497D"><a href="mailto:richards-john@sc.edu"><span style="font-size:10.0pt;font-family:Consolas;color:#0563C1">richards-john@sc.edu</span></a></span><u><span style="font-size:10.0pt;font-family:Consolas;color:blue"><br>
</span></u><span style="font-size:10.0pt;font-family:Consolas;color:black"><a href="https://jerlab.sc.edu"><span style="color:#0563C1">https://jerlab.sc.edu</span></a><br>
*************************************************</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>