-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_vbhmm_HCP_264nodes.m
executable file
·47 lines (38 loc) · 1.21 KB
/
main_vbhmm_HCP_264nodes.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
function main_vbhmm_HCP_264nodes(ss)
warning('off')
addpath('/home/sryali/VB-HMM/Scripts')
K = 25; % # of states
maxIter = 100; % maximum number of allowed iterations
tol = 10^-3; % tolerance for convergence
init_option = 3; %1-random, 2-task,3-kmeans
% Please set an output directory and unique filename
saveDir = '/home/sryali/VB-HMM/Results/';
result_fname = sprintf('HCP_264nodes-%d.mat',ss);
% Input data filename
inFile = '/home/sryali/VB-HMM/Data/data_264nodes_1_25.mat';
% Get the Data
task = [];
load(inFile)
% Setup parcluster -- create unique job directory
cwd = pwd;
mkdir(fullfile(cwd,'temp'));
jobDir = fullfile(cwd,'temp',sprintf('job%d',ss));
if exist(jobDir,'dir')
rmdir(jobDir,'s');
end
mkdir(jobDir);
pc = parcluster()
pc.NumWorkers = str2num(getenv('SLURM_JOB_CPUS_PER_NODE'));
pc.JobStorageLocation = jobDir;
delete(pc.Jobs)
%% We delay for 0-5s because simultaneous starts of the parcluster cause problems
% even when the job directory is unique
rng(ss);
delay = 5*rand(1); %0-5s delay
pause(delay)
rng default; %reset the rng
matlabpool(pc)
[Model]= vb_cont_hmm_multi_subj_1rep_264nodes(data,K,maxIter,tol,task,init_option,ss);
save([saveDir result_fname], 'Model')
delete(gcp('nocreate'))
rmdir(jobDir)