wdm update pt 3
This commit is contained in:
@@ -6,5 +6,29 @@ else
|
||||
addpath(genpath('/work_beegfs/sutef391/imdd_simulation'));
|
||||
end
|
||||
|
||||
% Define where results should be written (used by WDM_model.m)
|
||||
output_root = '/work_beegfs/sutef391/results_WDM';
|
||||
% Quiet the ambiguous CET warning (best is to set TZ in sbatch; see below)
|
||||
warning('off','MATLAB:datetime:AmbiguousTimeZone');
|
||||
|
||||
% How many workers?
|
||||
cpus = str2double(getenv('SLURM_CPUS_PER_TASK'));
|
||||
if ~isfinite(cpus) || cpus < 1, cpus = max(1, feature('numcores')); end
|
||||
|
||||
% Use a per-job, node-local JobStorageLocation to avoid stale locks on $HOME
|
||||
% Prefer $TMPDIR if your cluster provides it, else tempdir().
|
||||
tmpbase = getenv('TMPDIR');
|
||||
if isempty(tmpbase), tmpbase = tempdir; end
|
||||
jsl = fullfile(tmpbase, sprintf('matlab_jobstorage_%s_%s', ...
|
||||
getenv('USER'), getenv('SLURM_JOB_ID')));
|
||||
if ~exist(jsl,'dir'); mkdir(jsl); end
|
||||
|
||||
% Configure the local cluster explicitly and start the pool
|
||||
c = parcluster('local');
|
||||
c.NumWorkers = cpus;
|
||||
c.JobStorageLocation = jsl;
|
||||
|
||||
p = gcp('nocreate');
|
||||
if isempty(p) || p.NumWorkers ~= cpus
|
||||
if ~isempty(p), delete(p); end
|
||||
p = parpool(c, cpus); % avoids the “queued” state
|
||||
end
|
||||
fprintf('parpool up with %d workers; JobStorage=%s\n', p.NumWorkers, c.JobStorageLocation);
|
||||
Reference in New Issue
Block a user