file naming for WDM simulation
This commit is contained in:
@@ -2,60 +2,3 @@
|
||||
|
||||
|
||||
|
||||
% Add the imdd_simulation framework to the path
|
||||
if ispc
|
||||
addpath(genpath('C:\Users\Silas\Documents\MATLAB\imdd_simulation'));
|
||||
else
|
||||
% Linux path on the cluster
|
||||
addpath(genpath('/work_beegfs/sutef391/imdd_simulation'));
|
||||
end
|
||||
|
||||
% 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);
|
||||
|
||||
|
||||
|
||||
|
||||
% result filename (timestamp + optional job id)
|
||||
t = datetime('now','TimeZone','local','Format','yyyyMMdd_HHmmss');
|
||||
jobid = getenv('SLURM_JOB_ID'); if isempty(jobid), jobid = 'nojid'; end
|
||||
host = getenv('HOSTNAME'); if isempty(host), host = 'localhost'; end
|
||||
|
||||
% Output directory depends on platform
|
||||
if ispc
|
||||
output_root = fullfile('C:\Users\Silas\Documents\MATLAB\Datensätze\FWM_2025\');
|
||||
else
|
||||
output_root = '/work_beegfs/sutef391/results_WDM';
|
||||
end
|
||||
if ~exist(output_root,'dir'), mkdir(output_root); end
|
||||
|
||||
% Build filename
|
||||
t = datetime('now','TimeZone','local','Format','yyyyMMdd_HHmmss');
|
||||
jobid = getenv('SLURM_JOB_ID'); if isempty(jobid), jobid = 'nojid'; end
|
||||
host = getenv('HOSTNAME'); if isempty(host), host = 'localhost'; end
|
||||
|
||||
fname = sprintf('WDM_%s_%s_%s.mat', char(t), host, jobid);
|
||||
Reference in New Issue
Block a user