[FieldTrip] running FT scripts in a supercomputing cluster

Anne Urai anne.urai at gmail.com
Wed Jun 15 11:03:04 CEST 2016

Hi Jose,

I ran into similar dependencies issues when compiling fieldtrip, and
converged on the following:

% these paths will be added at compilation



ft_defaults; % add everything to path that we need


addpath(genpath('~/Documents/fieldtrip/template/')); % neighbouring matfile

if strcmp(fname, 'B3a_clusterStatsERF.m') || strcmp(fname,

    addpath('~/Documents/fieldtrip/statfun/'); % need the combineClusters
mex file

    addpath('~/Documents/fieldtrip/external/spm8/'); % for neighbour

    % http://mailman.science.ru.nl/pipermail/fieldtrip/2014-July/008238.html


% options: compile verbose, only use the toolboxes we really need

% !!! runtime options should be preceded by - to work!

% dont need to activate the -nojvm flag, can still plot from executable

if strcmp(fname, 'B3a_clusterStatsERF.m') || strcmp(fname,

    % statfun is called with a weird eval construction, so not recognized

    % by the dependency analysis of mcc

    mcc('-mv', '-N', '-p', 'stats', '-p', 'images', '-p', 'signal', ...

        '-R', '-nodisplay', '-R', '-singleCompThread', ...

        '-a', '~/Documents/fieldtrip/ft_statistics_montecarlo.m', ...

        '-a', '~/Documents/fieldtrip/statfun/ft_statfun_depsamplesT.m', ...



    % no need to specify additional files

    mcc('-mv', '-N', '-p', 'stats', '-p', 'images', '-p', 'signal', ...

        '-R', '-nodisplay', '-R', '-singleCompThread', ...



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 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.

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.

Hope this helps!

Anne E. Urai, MSc
PhD student | Institut für Neurophysiologie und Pathophysiologie
Universitätsklinikum Hamburg-Eppendorf | Martinistrasse 52, 20246 |
Hamburg, Germany
www.anneurai.net / @AnneEUrai <https://twitter.com/AnneEUrai>

On 10 June 2016 at 10:42, Jose <joseluisblues at gmail.com> wrote:

> dear list,
> I'm trying to analyse CTF MEG data through the Flemish Supercomputer
> Centre,
> 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:
> #!/bin/bash
> module load MATLAB/2013b
> FTDIR=$VSC_DATA_VO_USER/fieldtrip-20160317
> mcc -mv FT_0.m
> I also tried mcc -mv FT_0.m -I $FTDIR
> I run my compilation in the same folder where I have the FT folder.
> When I run my bash job I get always the same error: Undefined function
> 'ft_read_event' for input arguments of type 'char'.
> I've been looking elsewhere but still I haven't find a solution,
> Any hints about this would really appreciated,
> best,
> Jose
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160615/5fdd0100/attachment-0002.html>

More information about the fieldtrip mailing list