Select Git revision
AnalyseComputationalEnvironment.m
Forked from
Dynare / dynare
Source project has a limited visibility.
AnalyseComputationalEnvironment.m 24.13 KiB
function [ErrorCode] = AnalyseComputationalEnvironment(DataInput, DataInputAdd)
% PARALLEL CONTEXT
% In a parallel context, this function is used to check the cluster defined by the user.
% If no error happen the function returns 0. The function complies with
% Windows/Linux operating systems and Matlab/Octave software.
%
%
% INPUT/OUTPUT description:
%
%
% DataInput
% is the strcture option_.parallel, with the follow fields:
%
% Local 1 is on local machine, 0 remote
% ComputerName the computer name.
% CPUnbr the CPU's
% UserName the user name for the ComputerName.
% Password the password for the user name in ComputerName.
% RemoteDrive Drive used for Remote computation (data exchange, etc): must be contain 'RemoteFolder'.
% RemoteDirectory Folder in RemoteDrive used for Remote computation.
% MatlabOctavePath Path to MATLAB or Octave executable.
% DynarePath Path to matlab directory within the Dynare installation directory.
%
% This information is typed by the user in the DYNARE configuration file and is parsed by the preprocessor,
% the goal of this function is to check if configuration is correct and if dynare
% can be executed successfully in parallel mode.
%
%
% DataInputAdd
% it is the structure options_.parallel_info. Currently , only the string in the
% field RemoteTmpFolder (the temporary directory created/destroyed on remote
% computer) is used.
if ispc
[tempo, MasterName]=system('hostname');
MasterName=deblank(MasterName);
end
RemoteTmpFolder=DataInputAdd.RemoteTmpFolder;
dynareParallelMkDir(RemoteTmpFolder,DataInput);
% The variable ErrorCode is initialized at 0. If there are non problems with
% Local, ComputerName connections,... in general with parallel software execution,
% the ErrorCode is unchanged, in the others cases 1, 2 , ... The values
% table is below.
%
%
% Table for ErrorCode Values.
%
% ErrorCode -> 0 Initial Value -> No Error Detected!!!
% ErrorCode -> 1 ... When an error is detected, the values 1, 2, 3... are
% used to specify the type of error or warning.
%
% Value 1: The variable 'Local' has a bad value!
%
% Value 2: The variable 'CPUnbr' has a bad value. For more information
% see http://www.dynare.org/DynareWiki/ParallelDynare.
% 2.1 [warning] The user asks to use more CPU's than those available.
% 2.2 [warning] There are unused CPU's!
% 2.3 [error] NumberOfThreadsPerJob is not a divisor of CPUnbr
%
%
% Value 3: The remote computer is unreachable!!!
%
% Value 4: The fields user name and/or password are/is empty!
%
% Value 5: Remote Drive and/or Remote Folder do not exist!
%
% Value 6: It is impossible write/read files on the remote computer.