<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Hi Jose,</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">When calling mcc from Matlab, a dependency analysis is first carried out (at least in more recent versions of Matlab) - basically, Matlab goes through the script you're compiling and finds all the functions that are called (which must be on the path). These are all added to the executable. In principle, if all the folders you need are on the path (which should be okay when you call ft_default), the executable can run.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Now, only in the case when the dependency analysis doesn't recognize certain functions (because they are, for example, generated through str2func) you should add them manually. I found this out through trial and error - I'd first try to compile using the bare bones</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><div id="bloop_customfont" style="margin:0px">mcc('-mv', '-N',  '-R', '-nodisplay', '-R', '-singleCompThread', 'FT_0.m');</div><div id="bloop_customfont" style="margin:0px"><br></div><div id="bloop_customfont" style="margin:0px">when you then run the executable, you'll get an error message if a function or a toolbox is missing (and then you can add only those that you need and compile again). </div><div id="bloop_customfont" style="margin:0px"><br></div></div> <div>In your FT_0.sh, you should indeed load the MCR - otherwise, the executable can't run. For this, I'd recommend contacting the admin of the supercomputer cluster, since the way I do it on the cluster here is specific to the setup. You'll probably have to activate this in your FT_0.sh yourself and add the path to the cache of each node (something like export MCR_CACHE_ROOT=$TMPDIR).</div><div><br></div><div>Good luck!</div><br> <div id="bloop_sign_1466066194708201984" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px"><div>— </div><div><span style="font-family:'helvetica Neue',helvetica">Anne E. Urai, MSc</span></div><div><span style="font-family:'helvetica Neue',helvetica">PhD student | Institut für Neurophysiologie und Pathophysiologie </span></div><div><span style="font-family:'helvetica Neue',helvetica">Universitätsklinikum Hamburg-Eppendorf | </span><span style="font-family:'helvetica Neue',helvetica">Martinistrasse 52, 20246 | Hamburg, Germany </span></div><div><span style="font-family:'helvetica Neue',helvetica"><a href="http://www.anneurai.net">www.anneurai.net</a> / </span><a href="https://twitter.com/AnneEUrai"><span style="font-family:'helvetica Neue',helvetica">@AnneEUrai</span></a></div></div></div> <div class="airmail_ext_on" style="color:black"><br>From: <span style="color:black">Jose</span> <a href="mailto:joseluisblues@gmail.com"><joseluisblues@gmail.com></a><br>Reply: <span style="color:black">Jose</span> <a href="mailto:joseluisblues@gmail.com"><joseluisblues@gmail.com></a><br>Date: <span style="color:black">15 June 2016 at 19:14:43</span><br>To: <span style="color:black">Anne Urai</span> <a href="mailto:anne.urai@gmail.com"><anne.urai@gmail.com></a><br>Subject: <span style="color:black"> Re: [FieldTrip] running FT scripts in a supercomputing cluster <br></span></div><br> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>


<title></title>


<div dir="ltr">
<div>
<div>
<div>Hi Anne,<br>
<br></div>
Thanks for the detailed response,<br></div>
<div>I have a couple questions if I may,<br></div>
<div><br></div>
So, if I understand well I need to know a priori which functions I
want to use?. That's a bit strange, no? Because I don't know if any
given function depend of another one which I might not notice if
don't inspect all the scripts,<br>
<br></div>
<div>The other thing is that I was trying to compile in the
cluster, not locally, but anyway I tried locally with something
like this:<br></div>
<div>
<div><br>
% these paths will be added at compilation<br>
addpath('/home/joseluis/Documents/Software/fieldtrip-20160317');  
ft_defaults,<br>
addpath('/home/joseluis/Documents/Software/fieldtrip-20160317/qsub');<br>

addpath('/home/joseluis/Documents/Software/fieldtrip-20160317/fileio');<br>

addpath('/home/joseluis/Documents/Software/fieldtrip-20160317/fileio/private');<br>

<br>
% options: compile verbose, only use the toolboxes we really
need<br>
% !!! runtime options should be preceded by - to work!<br>
% dont need to activate the -nojvm flag, can still plot from
executable<br>
<br>
mcc('-mv', '-N', '-p', 'stats', '-p', 'images', '-p', 'signal',
...<br>
    '-R', '-nodisplay', '-R', '-singleCompThread',
...<br>
    '-a',
'/home/joseluis/Documents/Software/fieldtrip-20160317/fileio/ft_read_event.m',
...<br>
    '-a',
'/home/joseluis/Documents/Software/fieldtrip-20160317/fileio/private/read_ctf_cls.m',
...<br>
    '-a',
'/home/joseluis/Documents/Software/fieldtrip-20160317/ft_preprocessing',
...<br>
    'FT_0.m');<br>
<br></div>
<div>However when I copy FT_0 and run_FT_0.sh and run the job I
get:<br></div>
<div><br>
./FT_0: error while loading shared libraries: libmwmclmcrrt.so.8.1:
cannot open shared object file: No such file or directory<br>
<br></div>
<div>Which looking in Internet seems to be associated to the fact I
need to run a mrc installer in the cluster?<br>
<br></div>
<div>thanks<br>
<br></div>
<div>Jose<br></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 15 June 2016 at 11:03, Anne Urai
<span dir="ltr"><<a href="mailto:anne.urai@gmail.com" target="_blank">anne.urai@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Jose,
<div><br></div>
<div>I ran into similar dependencies issues when compiling
fieldtrip, and converged on the following:</div>
<div><br></div>
<div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
 </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% these paths will be added at compilation</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
addpath(genpath(<span style="color:rgb(178,69,243)">'~/code/Tools'</span>));</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">addpath(</span>'~/Documents/fieldtrip'<span style="color:rgb(0,0,0)">);</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
<span style="color:rgb(0,0,0)">ft_defaults;</span> % add everything
to path that we need</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
 </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">addpath(</span>'~/Documents/fieldtrip/qsub'<span style="color:rgb(0,0,0)">);</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">addpath(genpath(</span>'~/Documents/fieldtrip/template/'<span style="color:rgb(0,0,0)">));</span>
<span style="color:rgb(37,153,45)">% neighbouring
matfile</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
 </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
<span style="color:rgb(4,51,255)">if</span> <span style="color:rgb(0,0,0)">strcmp(fname,</span> <span style="color:rgb(178,69,243)">'B3a_clusterStatsERF.m'</span><span style="color:rgb(0,0,0)">) || strcmp(fname,</span> <span style="color:rgb(178,69,243)">'B3b_clusterStatsTFR.m'</span><span style="color:rgb(0,0,0)">),</span><br></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
<span style="color:rgb(0,0,0)">   
addpath(</span><span style="color:rgb(178,69,243)">'~/Documents/fieldtrip/statfun/'</span><span style="color:rgb(0,0,0)">);</span>
% need the combineClusters mex file</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">   
addpath(</span>'~/Documents/fieldtrip/external/spm8/'<span style="color:rgb(0,0,0)">);</span> <span style="color:rgb(37,153,45)">%
for neighbour definition</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
<span style="color:rgb(0,0,0)">   </span> % <a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2014-July/008238.html" target="_blank">http://mailman.science.ru.nl/pipermail/fieldtrip/2014-July/008238.html</a></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
end</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255);min-height:12px">
 </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% options: compile verbose, only use the toolboxes we really
need</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% !!! runtime options should be preceded by - to work!</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% dont need to activate the -nojvm flag, can still plot from
executable</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(4,51,255)">if</span> <span style="color:rgb(0,0,0)">strcmp(fname,</span>
'B3a_clusterStatsERF.m'<span style="color:rgb(0,0,0)">) ||
strcmp(fname,</span> 'B3b_clusterStatsTFR.m'<span style="color:rgb(0,0,0)">),</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
    </p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
<span style="color:rgb(0,0,0)">   </span> % statfun is
called with a weird eval construction, so not recognized</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
<span style="color:rgb(0,0,0)">   </span> % by the
dependency analysis of mcc</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">   
mcc(</span>'-mv'<span style="color:rgb(0,0,0)">,</span>
'-N'<span style="color:rgb(0,0,0)">,</span> '-p'<span style="color:rgb(0,0,0)">,</span> 'stats'<span style="color:rgb(0,0,0)">,</span> '-p'<span style="color:rgb(0,0,0)">,</span> 'images'<span style="color:rgb(0,0,0)">,</span> '-p'<span style="color:rgb(0,0,0)">,</span> 'signal'<span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">       </span>
'-R'<span style="color:rgb(0,0,0)">,</span>
'-nodisplay'<span style="color:rgb(0,0,0)">,</span>
'-R'<span style="color:rgb(0,0,0)">,</span>
'-singleCompThread'<span style="color:rgb(0,0,0)">,</span>
<span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">       </span>
'-a'<span style="color:rgb(0,0,0)">,</span>
'~/Documents/fieldtrip/ft_statistics_montecarlo.m'<span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">       </span>
'-a'<span style="color:rgb(0,0,0)">,</span>
'~/Documents/fieldtrip/statfun/ft_statfun_depsamplesT.m'<span style="color:rgb(0,0,0)">,</span>
<span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
        fname);</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
else</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
<span style="color:rgb(0,0,0)">   </span> % no need to
specify additional files</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">   
mcc(</span>'-mv'<span style="color:rgb(0,0,0)">,</span>
'-N'<span style="color:rgb(0,0,0)">,</span> '-p'<span style="color:rgb(0,0,0)">,</span> 'stats'<span style="color:rgb(0,0,0)">,</span> '-p'<span style="color:rgb(0,0,0)">,</span> 'images'<span style="color:rgb(0,0,0)">,</span> '-p'<span style="color:rgb(0,0,0)">,</span> 'signal'<span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)">       </span>
'-R'<span style="color:rgb(0,0,0)">,</span>
'-nodisplay'<span style="color:rgb(0,0,0)">,</span>
'-R'<span style="color:rgb(0,0,0)">,</span>
'-singleCompThread'<span style="color:rgb(0,0,0)">,</span>
<span style="color:rgb(4,51,255)">...</span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
        fname);</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
end</p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px">
<br></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px">
<span style="font-family:arial,sans-serif;font-size:small">So, the
trick is to add everything to your path before comping, and then
use the -N option and define specific folders and possible
functions using -a. Make sure to only include additional subfolders
from Fieldtrip (such as the templates folder) only if you need
them, for including them will increase the size of the executable
considerably. Also, some functions like the ft_statistics ones are
not directly called but instead evaluated
using </span><span style="font-family:arial,sans-serif;font-size:small">statmethod =
str2func(['ft_statistics_' cfg.method]) - this causes the
dependency analysis of the compiler to skip those functions, so
you'll have to add them manually.</span><br></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px">
<span style="font-family:arial,sans-serif;font-size:small"><br></span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px">
<span style="font-family:arial,sans-serif;font-size:small">PS a
similar setup should work directly from the command line mcc, but I
found it easier to run ft_defaults from Matlab and then compile
from within a Matlab script.</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px">
<span style="font-family:arial,sans-serif;font-size:small"><br></span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px">
<span style="font-family:arial,sans-serif;font-size:small">Hope
this helps!</span></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Courier;min-height:14px">
<span style="font-family:arial,sans-serif;font-size:small"><br></span></p>
<div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px">
— </div>
<div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px">
<span style="font-family:'helvetica Neue',helvetica">Anne E. Urai,
MSc</span></div>
<div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px">
<span style="font-family:'helvetica Neue',helvetica">PhD student |
Institut für Neurophysiologie
und Pathophysiologie </span></div>
<div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px">
<span style="font-family:'helvetica Neue',helvetica">Universitätsklinikum
Hamburg-Eppendorf | </span><span style="font-family:'helvetica Neue',helvetica">Martinistrasse
52, 20246 | Hamburg, Germany </span></div>
<div style="color:rgb(0,0,0);font-family:helvetica,arial;font-size:13px">
<span style="font-family:'helvetica Neue',helvetica"><a href="http://www.anneurai.net/" target="_blank">www.anneurai.net</a> / </span><a href="https://twitter.com/AnneEUrai" target="_blank"><span style="font-family:'helvetica Neue',helvetica">@AnneEUrai</span></a></div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">
<div>
<div class="h5">On 10 June 2016 at 10:42, Jose <span dir="ltr"><<a href="mailto:joseluisblues@gmail.com" target="_blank">joseluisblues@gmail.com</a>></span> wrote:<br></div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div class="h5">
<div dir="ltr">
<div>dear list,<br>
<br>
I'm trying to analyse <span>CTF</span> MEG data through the Flemish
Supercomputer Centre,<br>
I did a matlab script to run the foremost FT functions in my
pipeline (ft_read_event, read_ctf_cls, and ft_preprocessing). This
script works well when I run it locally. To compile my function in
the supercomputing cluster I initially used addpath to include FT
and ft_defaults to set the configuration inside my script, but this
wasn't working. I tried using a startup.m script but this doesn't
work neither. Maybe I'm missing something? My bash script to
compile looks like this:<br>
<br>
#!/bin/bash<br>
module load MATLAB/2013b<br>
FTDIR=$VSC_DATA_VO_USER/fieldtrip-20160317<br>
mcc -mv FT_0.m<br>
<br>
I also tried mcc -mv FT_0.m -I $FTDIR<br>
I run my compilation in the same folder where I have the FT
folder.<br>
When I run my bash job I get always the same error: Undefined
function 'ft_read_event' for input arguments of type 'char'.<br>
<br></div>
I've been looking elsewhere but still I haven't find a
solution,<br>
<div><br>
Any hints about this would really appreciated,<br>
best,<br>
Jose<br></div>
</div>
<br></div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br></div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
--<br>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">José Luis ULLOA FULGERI<br>
+32 (0)4 77 42 90 07<br>
+32 <span>(0)4</span> 92 64 64 77</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>


</div></div></span></blockquote></body></html>