This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
psom_gb_vars.m
197 lines (157 loc) · 5.86 KB
/
psom_gb_vars.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
%% Here are important PSOM variables. Whenever needed, PSOM will call
%% this script to initialize the variables. If PSOM does not behave the way
%% you want, this might be the place to fix that.
if ~exist('gb_psom_gb_vars', 'var')
gb_psom_gb_vars = true;
else
return
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The following variables need to be changed to configure the pipeline %%
%% system %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% how to invoke matlab
gb_psom_command_matlab = [matlabroot filesep 'bin' filesep 'matlab'];
% how to invoke octave
gb_psom_command_octave = [matlabroot filesep 'bin' filesep 'octave'];
% Options for the sge qsub/msub/condor system. For condor, see the help of
% psom_condor.sh
% Example : '-q all.q@yeatman,all.q@zeus'
% will force qsub to only use the yeatman and zeus workstations through the
% queue called all.q
gb_psom_qsub_options = '';
% Options for the shell in batch, qsub, msub or condor modes
gb_psom_shell_options = '';
% Options for the execution mode of the pipeline
gb_psom_mode = 'background';
% Path of the singularity image, used only if gb_psom_mode == 'singularity';
gb_psom_singularity_image=getenv('SINGULARITY_IMAGE');
% Options for the execution mode of the pipeline manager
gb_psom_mode_pm = 'session';
% Options for the execution mode of the deamon
gb_psom_mode_deamon = 'background';
% Options for the execution mode of the garbage collector
gb_psom_mode_garbage = 'background';
% Options for the maximal number of jobs
gb_psom_max_queued = 2;
% Default number of attempts of re-submission for failed jobs
% [] is 0 for session, batch and background modes, and 1 for
% qsub/msub modes.
gb_psom_nb_resub = [];
% Initialization of matlab (is appendeds it to other init values in the code)
if ~isempty(getenv('PSOM_LOCAL_CONF_DIR'))
gb_psom_init_matlab = sprintf('addpath(genpath(\\\"%s\\\"))', getenv('PSOM_LOCAL_CONF_DIR'));
else
gb_psom_init_matlab = '';
end
% Matlab search path. An empty value will correspond to the search path of
% the session used to invoke PSOM_RUN_PIPELINE. A value 'gb_psom_omitted'
% will result in no search path initiated (the default Octave path is
% used).
gb_psom_path_search = '';
% where to store temporary files
gb_psom_tmp = tempdir;
if ~strcmp(gb_psom_tmp(end),filesep)
gb_psom_tmp = [gb_psom_tmp filesep];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The following variables should not be changed %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PSOM version
gb_psom_version = '2.2.2'; % PSOM release number
% Is the environment Octave or Matlab ?
if exist('OCTAVE_VERSION','builtin')
% this is octave !
gb_psom_language = 'octave';
else
% this is not octave, so it must be matlab
gb_psom_language = 'matlab';
end
% Options to start matlab
switch gb_psom_language
case 'matlab'
if ispc
gb_psom_opt_matlab = '-automation -nodesktop -singleCompThread -r';
else
gb_psom_opt_matlab = '-nosplash -nodesktop -singleCompThread -r';
end
case 'octave'
gb_psom_opt_matlab = '--silent --eval';
otherwise
error('\"%s\" is an unknown session mode. Sorry dude, I must quit ...', gb_psom_language);
end
% Get langage version
if strcmp(gb_psom_language,'octave');
gb_psom_language_version = OCTAVE_VERSION;
else
gb_psom_language_version = version;
end
%% In which path is PSOM ?
str_gb_vars = which('psom_gb_vars');
if isempty(str_gb_vars)
error('PSOM is not in the path ! (could not find PSOM_GB_VARS)')
end
gb_psom_path_psom = fileparts(str_gb_vars);
if strcmp(gb_psom_path_psom,'.')
gb_psom_path_psom = pwd;
end
gb_psom_path_psom = [gb_psom_path_psom filesep];
% In which path is the PSOM demo ?
gb_psom_path_demo = cat(2,gb_psom_path_psom,'data_demo',filesep);
% What is the operating system ?
if isunix
gb_psom_OS = 'unix';
elseif ispc
gb_psom_OS = 'windows';
else
warning('System %s unknown!\n',comp);
gb_psom_OS = 'unkown';
end
% Getting user name.
switch (gb_psom_OS)
case 'unix'
gb_psom_user = getenv('USER');
devnull = '1>/dev/null 2>&1';
case 'windows'
gb_psom_user = getenv('USERNAME');
devnull = '1>NUL 2>&1';
otherwise
gb_psom_user = 'unknown';
end
if exist('flag_gb_niak_fast_gb','var')&&flag_gb_niak_fast_gb
return
end
% Getting the local computer's name
switch (gb_psom_OS)
case 'unix'
[gb_psom_tmp_var,gb_psom_localhost] = system('uname -n');
gb_psom_localhost = deblank(gb_psom_localhost);
otherwise
gb_psom_localhost = 'unknown';
end
% How to open pdf files, will choose the first one that exists
gb_psom_list_pdf = {'xpdf' , 'evince', 'okular' ,'reader', 'undefined'};
for gb_psom_pdf_viewer = gb_psom_list_pdf
gb_psom_pdf_viewer = gb_psom_pdf_viewer{1};
[gb_psom_retcode,gb_psom_txt] = system([ gb_psom_pdf_viewer ' --help ' devnull]);
if gb_psom_retcode ~= 127
break
end
end
if exist('psom_gb_vars_local.m','file')
psom_gb_vars_local
return
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Any following line will be executed at the begining of every PSOM command and every job %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Uncomment the following line to load the image processing package in Octave
% pkg load image
%% Don't use more to verbose "on-the-fly" in Octave
% more off
%% Use .mat files compatible with Matlab in Octave
% default_save_options('-7');
%% This is a bit of a dangerous option, but it makes things run faster in Octave.
%% You'll have to exit octave and start again if you want any change in the functions to be
%% taken into account.
% ignore_function_time_stamp ('all')