<div dir="ltr">Dear Jens,<div><br></div><div>Actually I found that runica() does not use pcsquash() any more, so I investigated how pca dimension reduction is handled in the current runica() which I have been curious too. Based on this experience, I wrote code and tested following steps:</div>

<div><br></div><div>1. Reduce dimensions from 37 to 20</div><div>2. Run cudaica to obtain 20 ICs</div><div>3. Backproject the obtained 20 IC activities to 37 channels for comparison</div><div><br></div><div>It worked, at least for me, so let me share it with you.</div>

<div>CAUTION: The attached code is with ABSOLUTELY NO GUARANTEE! Please use it at your own risk.</div><div><br></div><div>Makoto</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-23 7:57 GMT-07:00 Bernhardsson Jens <span dir="ltr"><<a href="mailto:Jens.Bernhardsson@miun.se" target="_blank">Jens.Bernhardsson@miun.se</a>></span>:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>
      <p style="margin-bottom:0in">Dear Makoto,</p>
      <p style="margin-bottom:0in"><br>
        It states on the cudaica web site that the pca option is not
        currently supported,
        <a href="http://liaa.dc.uba.ar/?q=node/10" target="_blank">http://liaa.dc.uba.ar/?q=node/10</a>
        . Cudaica does however create rank reduced weight and sphere
        matrices before it crashes when trying to read in the weight and
        sphere [wts sph] results.
      </p>
      <p style="margin-bottom:0in">It would be great if you could
        provide some information on pcsquash() and what to do with the
        wts and sph matrices generated by cudaica() as I get matrices
        with n-c*n-c dimensions after using pcsquash() and not n-c*n.<br>
        <br>
      </p>
      Thank you<span class="HOEnZb"><font color="#888888"><br>
      Jens</font></span><div><div class="h5"><br>
      <br>
      <br>
      On 04/18/2014 04:52 AM, Makoto Miyakoshi wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">Dear Jens,
        <div><br>
        </div>
        <div>Look like cudaica does have pca option, so just 'pca', 10
          for example.</div>
        <div><br>
        </div>
        <div>If it does not work, or for AMICA (which does not support
          pca although in the help it says it does), you can always use
          pcsquash() and pcexpand() included in the EEGLAB package.</div>
        <div>If you need more details let us know.</div>
        <div><br>
        </div>
        <div>Makoto</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2014-04-15 2:54 GMT-07:00 Bernhardsson
          Jens <span dir="ltr"><<a href="mailto:Jens.Bernhardsson@miun.se" target="_blank">Jens.Bernhardsson@miun.se</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div link="blue" vlink="purple" lang="SV">
              <div>
                <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Dear Makoto</span></p>
                <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"> </span></p>
                <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">When you run CUDAICA how do you reduce
                    the rank of your data? </span></p>
                <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"> </span></p>
                <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Best,</span></p>
                <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Jens </span></p>
                <div>
                  <div>
                    <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"> </span></p>
                    <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"> </span></p>
                    <p class="MsoNormal"><span lang="EN-US"> </span></p>
                    <div>
                      <p class="MsoNormal"><span lang="EN-US">Dear Avi,</span></p>
                      <div>
                        <p class="MsoNormal"><span lang="EN-US"> </span></p>
                      </div>
                      <div>
                        <p class="MsoNormal"><span lang="EN-US">runica()
                            runs slowly, and spending 50 min is not
                            surprising (assuming you have >32
                            channels and >30min data). binica() runs
                            faster, but does not run on windows. We have
                            cudaica() which runs super-fast but requires
                            configuration of GPU.</span></p>
                      </div>
                      <div>
                        <p class="MsoNormal"><span lang="EN-US"> </span></p>
                      </div>
                      <div>
                        <p class="MsoNormal">Makoto</p>
                      </div>
                      <div>
                        <p class="MsoNormal" style="margin-bottom:12.0pt"> </p>
                        <div>
                          <p class="MsoNormal">
                            2013/6/9 Avi Lazarovits <<a href="mailto:avila@post.bgu.ac.il" target="_blank">avila@post.bgu.ac.il</a>></p>
                          <blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
                            <div>
                              <div>
                                <p class="MsoNormal"><span lang="EN-US">Hello, </span></p>
                              </div>
                              <div>
                                <p class="MsoNormal"><span lang="EN-US">Thank
                                    you very much, I will try to run
                                    this function with the new filter.</span></p>
                              </div>
                              <div>
                                <p class="MsoNormal"><span lang="EN-US">About
                                    the inconsistency, actually I run a
                                    bandpass filter and by mistake I
                                    quoted the code for the low pass
                                    filter which is much faster. The
                                    code for the highpass is: EEG =
                                    pop_eegfilt( EEG, 1, 0, [], 0,</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif"" lang="EN-US">0,0, 0, ‘firls’, 0</span><span lang="EN-US">);</span></p>


                              </div>
                              <div>
                                <div>
                                  <p class="MsoNormal"><span lang="EN-US"> </span></p>
                                </div>
                                <div>
                                  <p class="MsoNormal"><span lang="EN-US">Another function I
                                      intend to use is running ICA on
                                      these files. Is there any way to
                                      accelerate the ICA (in my computer
                                      it took about 50 min wuth deafult
                                      settings of ICA)?</span></p>
                                </div>
                                <div>
                                  <p class="MsoNormal"><span lang="EN-US"> </span></p>
                                </div>
                                <div>
                                  <p class="MsoNormal"><span lang="EN-US">Thanks</span></p>
                                </div>
                                <div>
                                  <p class="MsoNormal"><span style="color:#888888" lang="EN-US">Avi</span></p>
                                </div>
                                <div>
                                  <p class="MsoNormal"><span style="color:#888888" lang="EN-US"> </span></p>
                                </div>
                                <div>
                                  <p class="MsoNormal"><span style="color:#888888" lang="EN-US"> </span></p>
                                </div>
                              </div>
                            </div>
                            <div>
                              <div>
                                <div>
                                  <p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US"> </span></p>
                                  <div>
                                    <div>
                                      <p class="MsoNormal"><span lang="EN-US">2013/6/9 Andreas
                                          Widmann <</span><a href="mailto:widmann@uni-leipzig.de" target="_blank"><span lang="EN-US">widmann@uni-leipzig.de</span></a><span lang="EN-US">></span></p>
                                    </div>
                                    <blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
                                      <p class="MsoNormal"><span lang="EN-US">Hi Avi,<br>
                                          <br>
                                          short answer:<br>
                                          upgrading to a recent 12.x
                                          EEGLAB version and using
                                          pop_eegfiltnew should solve
                                          your problem.<br>
                                          <br>
                                          Long answer:<br>
                                          * I have to slightly correct
                                          my previous statement. The
                                          legacy (fir1/firls) FIR filter
                                          uses MATLAB filtfilt instead
                                          of MATAB filter and is thus
                                          not multi-threaded by default.<br>
                                          * The legacy filter is flawed
                                          (see e.g. </span><a href="http://www.frontiersin.org/Perception_Science/10.3389/fpsyg.2012.00233/full" target="_blank"><span lang="EN-US">http://www.frontiersin.org/Perception_Science/10.3389/fpsyg.2012.00233/full</span></a><span lang="EN-US"> and </span><a href="https://sccn.ucsd.edu/bugzilla/show_bug.cgi?id=631for" target="_blank"><span lang="EN-US">https://sccn.ucsd.edu/bugzilla/show_bug.cgi?id=631for</span></a><span lang="EN-US"> a more detailed
                                          description) and is not
                                          recommended.<br>
                                          * The new FIR filter in EEGLAB
                                          12.x uses plain MATLAB filter
                                          an is thus genuinely
                                          multi-threaded. Filtering a
                                          1086734-point 66-channel
                                          dataset takes 5 seconds with
                                          265-point filter (default for
                                          100 Hz-lowpass) and 2 min 16
                                          seconds with 6145-point filter
                                          (your filter length) on my 1.7
                                          Ghz dual core i5. Should be
                                          much faster on your machine.<br>
                                          * Note: there is an
                                          inconsistency between your
                                          command (EEG = pop_eegfilt(
                                          EEG, 0, 100, [], 0,0, 0,
                                          ‘firls’, 0);) and your
                                          reported output. This command
                                          should give a 60-point lowpass
                                          filter and *not* a 6144-point
                                          highpass. Did you change
                                          something in your EEGLAB code?<br>
                                          <br>
                                          Hope this helps! Best,<br>
                                          Andreas</span></p>
                                      <div>
                                        <div>
                                          <p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US"><br>
                                              > I am using EEGlab to
                                              process EEG recordings,
                                              and running low pass 100
                                              Hz is very slow. I am
                                              looking for code
                                              modifications I can make
                                              to accelerate the running
                                              time, and also
                                              recommendation for optimal
                                              hardware specs for this
                                              process.<br>
                                              ><br>
                                              > The files I process
                                              are recordings of 66
                                              channles @ 2KHz ~10
                                              minutes long (1086734
                                              samples) bug. I can’t
                                              resample the files because
                                              I need high temporal
                                              resolution.<br>
                                              ><br>
                                              > I use EEGlab version
                                              11.0.3.1b, and run “firls”
                                              filter. I run the filter
                                              with the following
                                              command:<br>
                                              > EEG = pop_eegfilt(
                                              EEG, 0, 100, [], 0,0, 0,
                                              ‘firls’, 0);<br>
                                              > When I run this
                                              command I get the
                                              following message:<br>
                                              ><br>
                                              > eegfilt() -
                                              performing 6144-point
                                              highpass filtering.<br>
                                              > eegfilt() - highpass
                                              transition band width is
                                              0.2 Hz.<br>
                                              ><br>
                                              > The computer I run
                                              the processing on now is
                                              i5 3470 (4 cores@ 3.2 Ghz)
                                              with 4Gb RAM running
                                              windows 7 enterprise 64
                                              bit and Matlab 2012a.<br>
                                              ><br>
                                              > I tried running the
                                              same process on an i7
                                              extreme edition 3930k with
                                              64Gb RAM system and it
                                              didn't shorten the running
                                              time at all. I also tried
                                              running this filter on a
                                              workstation with Xeon CPU
                                              and it shortened the
                                              running time, but not
                                              significantly. I looked on
                                              the CPU monitor and found
                                              that it doesn’t use more
                                              than 1 core, and that the
                                              maximal RAM memory usage
                                              during the processing was
                                              about 6.5 Gb.<br>
                                              ><br>
                                              > 1.     I found that
                                              using SSD shortens the
                                              time significantly, and
                                              therefore I assume that
                                              one of the big bottlenecks
                                              of this processing is that
                                              the process is made on the
                                              hard disk and not on the
                                              RAM. Is there a way to
                                              “make” Matlab use RAM
                                              instead of the hard drive?<br>
                                              ><br>
                                              > 2.     Are there code
                                              changes I can make in
                                              EEGlab’s code to run this
                                              filter multithreaded so
                                              that the process will use
                                              all the cores of my CPU?
                                              Is there any way to make
                                              this process on GPU? Will
                                              it accelerate the process
                                              more than using parallel
                                              computing of the CPU?<br>
                                              ><br>
                                              ><br>
                                              > Thank you<br>
                                              ><br>
                                              > Avi<br>
                                              ><br>
                                              ><br>
                                              ><br>
                                              > 2013/6/8 Arnaud
                                              Delorme <</span><a href="mailto:arno@sccn.ucsd.edu" target="_blank"><span lang="EN-US">arno@sccn.ucsd.edu</span></a><span lang="EN-US">><br>
                                              > Thanks Andreas for
                                              the clarification.<br>
                                              ><br>
                                              > Arno<br>
                                              ><br>
                                              > On 8 Jun 2013, at
                                              06:58, Andreas Widmann
                                              wrote:<br>
                                              ><br>
                                              > > Hi Avi and Arno,<br>
                                              > ><br>
                                              > > no using parfor
                                              won't help here, filtering
                                              is already multithreaded
                                              since MATLAB R2007a.<br>
                                              > > </span><a href="http://www.mathworks.de/support/solutions/en/data/1-4PG4AN/" target="_blank"><span lang="EN-US">http://www.mathworks.de/support/solutions/en/data/1-4PG4AN/</span></a><span lang="EN-US"><br>


                                              > ><br>
                                              > > I can try to
                                              narrow down the problem,
                                              but please on list
                                              (eeglablist). This might
                                              be interesting also for
                                              others. Many relevant
                                              parameters are missing:<br>
                                              > > * Length of
                                              dataset (samples or time
                                              and fs)<br>
                                              > > * Filter length
                                              or order<br>
                                              > > * OS and version<br>
                                              > > * EEGLAB version<br>
                                              > > * Why legacy
                                              filter (fir1/firls)? Using
                                              the new filter will
                                              immediately halve
                                              computation time.<br>
                                              > ><br>
                                              > > Best,<br>
                                              > > Andreas<br>
                                              > ><br>
                                              > > Am 07.06.2013 um
                                              22:20 schrieb Arnaud
                                              Delorme <</span><a href="mailto:arno@sccn.ucsd.edu" target="_blank"><span lang="EN-US">arno@sccn.ucsd.edu</span></a><span lang="EN-US">>:<br>
                                              > ><br>
                                              > >> Dear Avi,<br>
                                              > >><br>
                                              > >> yes, it is
                                              possible to shorten the
                                              time.<br>
                                              > >> If you have
                                              multiple processor, you
                                              could try replacing line
                                              74 of firfilt.m<br>
                                              > >><br>
                                              > >> for iDc =
                                              1:(length(dcArray) - 1)<br>
                                              > >><br>
                                              > >> with<br>
                                              > >><br>
                                              > >> parfor iDc =
                                              1:(length(dcArray) - 1)<br>
                                              > >><br>
                                              > >><br>
                                              > >> Channels
                                              will be filtered in
                                              parallel.<br>
                                              > >> GPU could
                                              help as well, but that's
                                              another story.<br>
                                              > >><br>
                                              > >> Hope this
                                              helps,<br>
                                              > >><br>
                                              > >> Arno<br>
                                              > >><br>
                                              > >> On 2 Jun
                                              2013, at 23:53, Avi
                                              Lazarovits wrote:<br>
                                              > >><br>
                                              > >>> Hello,<br>
                                              > >>> My name
                                              is Avi and I work in lab
                                              with EEG recordings. I am
                                              using the EEGlab on matlab
                                              2012b and would like to
                                              thank you for writing this
                                              useful toolbox.<br>
                                              > >>><br>
                                              > >>> the
                                              Processing time of the
                                              fir1/firls lowpass filters
                                              is very long (20 minutes
                                              for 66 channels SSD and I
                                              am looking for ways to
                                              shorten it. Is there any
                                              way to shorten it by
                                              changing the code for
                                              using parallel
                                              computingqGPU computing?
                                              will EEGlab use parallel
                                              computing in next
                                              versions?<br>
                                              > >>> If not,
                                              what are the best hardware
                                              specs to run these
                                              filters? I tried running
                                              it on an i7 3930k with
                                              64Gb RAM system and it
                                              didn't shorten the time
                                              vs. my i5 3470 4Gb RAM
                                              system. I also tried to
                                              run this filter on a
                                              workstation system with
                                              Xeon CPU and it shortened
                                              the running time, but not
                                              significantly. I found
                                              that using SSD shortens
                                              the time significantly. Do
                                              you have any other
                                              hardware specs
                                              recommendations?<br>
                                              > >>><br>
                                              > >>> Thank
                                              you<br>
                                              > >>> Avi<br>
                                              > >><br>
                                              > ><br>
                                              ><br>
                                              ></span></p>
                                        </div>
                                      </div>
                                    </blockquote>
                                  </div>
                                  <p class="MsoNormal"><span lang="EN-US"> </span></p>
                                </div>
                              </div>
                            </div>
                            <p class="MsoNormal"><span lang="EN-US"><br>
_______________________________________________<br>
                                Eeglablist page: </span><a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank"><span lang="EN-US">http://sccn.ucsd.edu/eeglab/eeglabmail.html</span></a><span lang="EN-US"><br>


                                To unsubscribe, send an empty email to </span><a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank"><span lang="EN-US">eeglablist-unsubscribe@sccn.ucsd.edu</span></a><span lang="EN-US"><br>


                                For digest mode, send an email with the
                                subject "set digest mime" to </span><a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank"><span lang="EN-US">eeglablist-request@sccn.ucsd.edu</span></a><span lang="EN-US"></span></p>


                          </blockquote>
                        </div>
                        <p class="MsoNormal"><span lang="EN-US"><br>
                            <br clear="all">
                          </span></p>
                        <div>
                          <p class="MsoNormal"><span lang="EN-US"> </span></p>
                        </div>
                        <p class="MsoNormal"><span lang="EN-US">-- </span></p>
                        <div>
                          <p class="MsoNormal"><span lang="EN-US">Makoto
                              Miyakoshi<br>
                              Swartz Center for Computational
                              Neuroscience<br>
                              Institute for Neural Computation,
                              University of California San Diego</span></p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div dir="ltr">Makoto Miyakoshi<br>
          Swartz Center for Computational Neuroscience<br>
          Institute for Neural Computation, University of California San
          Diego<br>
        </div>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Makoto Miyakoshi<br>Swartz Center for Computational Neuroscience<br>Institute for Neural Computation, University of California San Diego<br></div>


</div>