Skip to content

Commit 0107072

Browse files
authored
Merge pull request #7 from mathworks/v2.3.0
v2.3.0
2 parents 161b94c + 04827be commit 0107072

File tree

4 files changed

+50
-11
lines changed

4 files changed

+50
-11
lines changed

communicatingJobWrapper.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# The following environment variables are set by Grid Engine:
1919
# PE_HOSTFILE - list of hostnames with their associated number of processors allocated to this Grid Engine job
2020

21-
# Copyright 2006-2024 The MathWorks, Inc.
21+
# Copyright 2006-2025 The MathWorks, Inc.
2222

2323
# If PARALLEL_SERVER_ environment variables are not set, assign any
2424
# available values with form MDCE_ for backwards compatibility
@@ -45,10 +45,17 @@ if [ ! -z "${PARALLEL_SERVER_DEBUG}" ] && [ "${PARALLEL_SERVER_DEBUG}" != "false
4545
MPI_VERBOSE="${MPI_VERBOSE} -v -print-all-exitcodes"
4646
fi
4747

48+
if [ ! -z "${PARALLEL_SERVER_BIND_TO_CORE}" ] && [ "${PARALLEL_SERVER_BIND_TO_CORE}" != "false" ] ; then
49+
BIND_TO_CORE_ARG="-bind-to core:${PARALLEL_SERVER_NUM_THREADS}"
50+
else
51+
BIND_TO_CORE_ARG=""
52+
fi
53+
4854
# Construct the command to run.
4955
CMD="\"${FULL_MPIEXEC}\" \
56+
${PARALLEL_SERVER_MPIEXEC_ARG} \
5057
-genvlist ${PARALLEL_SERVER_GENVLIST} \
51-
-bind-to core:${PARALLEL_SERVER_NUM_THREADS} \
58+
${BIND_TO_CORE_ARG} \
5259
${MPI_VERBOSE} \
5360
\"${PARALLEL_SERVER_MATLAB_EXE}\" \
5461
${PARALLEL_SERVER_MATLAB_ARGS}"

communicatingSubmitFcn.m

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,25 @@ function communicatingSubmitFcn(cluster, job, environmentProperties)
9393
'PARALLEL_SERVER_CMR', strip(cluster.ClusterMatlabRoot, 'right', '/'); ...
9494
'PARALLEL_SERVER_TOTAL_TASKS', num2str(environmentProperties.NumberOfTasks); ...
9595
'PARALLEL_SERVER_NUM_THREADS', num2str(cluster.NumThreads)};
96+
% Starting in R2025a, IntelMPI is supported via MPIImplementation="IntelMPI"
97+
if ~verLessThan('matlab', '25.1') && ...
98+
isprop(cluster.AdditionalProperties, 'MPIImplementation') %#ok<VERLESSMATLAB>
99+
mpiImplementation = cluster.AdditionalProperties.MPIImplementation;
100+
mustBeMember(mpiImplementation, ["IntelMPI", "MPICH"]);
101+
variables = [variables; {'PARALLEL_SERVER_MPIEXEC_ARG', ['-', char(mpiImplementation)]}];
102+
end
103+
104+
% Avoid "-bind-to core:N" if AdditionalProperties.UseBindToCore is false (default: true).
105+
if validatedPropValue(cluster.AdditionalProperties, 'UseBindToCore', 'logical', true)
106+
bindToCoreValue = 'true';
107+
else
108+
bindToCoreValue = 'false';
109+
end
110+
variables = [variables; {'PARALLEL_SERVER_BIND_TO_CORE', bindToCoreValue}];
111+
112+
if ~verLessThan('matlab', '25.1') %#ok<VERLESSMATLAB>
113+
variables = [variables; environmentProperties.JobEnvironment];
114+
end
96115
% Environment variable names different prior to 19b
97116
if verLessThan('matlab', '9.7')
98117
variables(:,1) = replace(variables(:,1), 'PARALLEL_SERVER_', 'MDCE_');
@@ -118,6 +137,11 @@ function communicatingSubmitFcn(cluster, job, environmentProperties)
118137
% Prior to R2019a, only the SMPD process manager is supported.
119138
if verLessThan('matlab', '9.6') || ...
120139
isprop(cluster.AdditionalProperties, 'UseSmpd') && cluster.AdditionalProperties.UseSmpd
140+
if ~verLessThan('matlab', '25.1') %#ok<VERLESSMATLAB>
141+
% Starting in R2025a, smpd launcher is not supported.
142+
error('parallelexamples:GenericGridEngine:SmpdNoLongerSupported', ...
143+
'The smpd process manager is no longer supported.');
144+
end
121145
jobWrapperName = 'communicatingJobWrapperSmpd.sh';
122146
parallelEnvironment = 'matlabSmpd';
123147
else

independentSubmitFcn.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function independentSubmitFcn(cluster, job, environmentProperties)
66
%
77
% See also parallel.cluster.generic.independentDecodeFcn.
88

9-
% Copyright 2010-2023 The MathWorks, Inc.
9+
% Copyright 2010-2024 The MathWorks, Inc.
1010

1111
% Store the current filename for the errors, warnings and dctSchedulerMessages.
1212
currFilename = mfilename;
@@ -97,6 +97,9 @@ function independentSubmitFcn(cluster, job, environmentProperties)
9797
'MLM_WEB_ID', environmentProperties.LicenseWebID; ...
9898
'PARALLEL_SERVER_LICENSE_NUMBER', environmentProperties.LicenseNumber; ...
9999
'PARALLEL_SERVER_STORAGE_LOCATION', storageLocation};
100+
if ~verLessThan('matlab', '25.1') %#ok<VERLESSMATLAB>
101+
variables = [variables; environmentProperties.JobEnvironment];
102+
end
100103
% Environment variable names different prior to 19b
101104
if verLessThan('matlab', '9.7')
102105
variables(:,1) = replace(variables(:,1), 'PARALLEL_SERVER_', 'MDCE_');

private/runSchedulerCommand.m

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function [status, result] = runSchedulerCommand(cluster, cmd)
22
%RUNSCHEDULERCOMMAND Run a command on the cluster.
33

4-
% Copyright 2019-2022 The MathWorks, Inc.
4+
% Copyright 2019-2024 The MathWorks, Inc.
55

66
persistent wrapper
77

@@ -17,17 +17,22 @@
1717
% the system call to the scheduler on UNIX within a shell script to
1818
% sanitize any exit codes in this range.
1919
if isempty(wrapper)
20-
if verLessThan('matlab', '9.7') % folder renamed in 19b
21-
dirName = 'distcomp';
22-
else
23-
dirName = 'parallel';
24-
end
25-
wrapper = fullfile(toolboxdir(dirName), ...
26-
'bin', 'util', 'shellWrapper.sh'); %#ok<*DCRENAME>
20+
wrapper = iBuildWrapperPath();
2721
end
2822
cmd = sprintf('%s %s', wrapper, cmd);
2923
end
3024
[status, result] = system(cmd);
3125
end
3226

3327
end
28+
29+
function wrapper = iBuildWrapperPath()
30+
if verLessThan('matlab', '9.7')
31+
pctDir = toolboxdir('distcomp'); %#ok<*DCRENAME>
32+
elseif verLessThan('matlab', '25.1') %#ok<*VERLESSMATLAB>
33+
pctDir = toolboxdir('parallel');
34+
else
35+
pctDir = fullfile(matlabroot, 'toolbox', 'parallel');
36+
end
37+
wrapper = fullfile(pctDir, 'bin', 'util', 'shellWrapper.sh');
38+
end

0 commit comments

Comments
 (0)