Home > matlab > parallel > AnalyseComputationalEnvironment.m

AnalyseComputationalEnvironment

PURPOSE ^

PARALLEL CONTEXT

SYNOPSIS ^

function [ErrorCode] = AnalyseComputationalEnvironment(DataInput, DataInputAdd)

DESCRIPTION ^

 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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ErrorCode] = AnalyseComputationalEnvironment(DataInput, DataInputAdd)
0002 % PARALLEL CONTEXT
0003 % In a parallel context, this function is used to check the cluster defined by the user.
0004 % If no error happen the function returns 0. The function complies with
0005 % Windows/Linux operating systems and Matlab/Octave software.
0006 %
0007 %
0008 % INPUT/OUTPUT description:
0009 %
0010 %
0011 % DataInput
0012 %   is the strcture option_.parallel, with the follow fields:
0013 %
0014 %             Local         1 is on local machine, 0 remote
0015 %      ComputerName         the computer name.
0016 %            CPUnbr         the CPU's
0017 %          UserName         the user name for the ComputerName.
0018 %          Password         the password for the user name in ComputerName.
0019 %       RemoteDrive         Drive used for Remote computation (data exchange, etc): must be contain 'RemoteFolder'.
0020 %   RemoteDirectory         Folder in RemoteDrive used for Remote computation.
0021 %  MatlabOctavePath         Path to MATLAB or Octave executable.
0022 %        DynarePath         Path to matlab directory within the Dynare installation directory.
0023 %
0024 %   This information is typed by the user in the DYNARE configuration file and is parsed by the preprocessor,
0025 %   the goal of this function is to check if configuration is correct and if dynare
0026 %   can be executed successfully in parallel mode.
0027 %
0028 %
0029 % DataInputAdd
0030 %   it is the structure options_.parallel_info. Currently , only the string in the
0031 %   field RemoteTmpFolder (the temporary directory created/destroyed on remote
0032 %   computer) is used.
0033 
0034 
0035 RemoteTmpFolder=DataInputAdd.RemoteTmpFolder;
0036 dynareParallelMkDir(RemoteTmpFolder,DataInput);
0037 
0038 
0039 % The variable ErrorCode is initialized at 0. If there are non problems with
0040 % Local, ComputerName connections,... in general with parallel software execution,
0041 % the ErrorCode is unchanged, in the others cases 1, 2 , ... The values
0042 % table is below.
0043 %
0044 %
0045 %   Table for ErrorCode Values.
0046 %
0047 %   ErrorCode -> 0      Initial Value -> No Error Detected!!!
0048 %   ErrorCode -> 1 ...  When an error is detected, the values 1, 2, 3... are
0049 %   used to specify the type of error or warning.
0050 %
0051 %   Value 1:    The variable 'Local' has a bad value!
0052 %
0053 %   Value 2:    The variable 'CPUnbr' has a bad value. For more information
0054 %               see http://www.dynare.org/DynareWiki/ParallelDynare.
0055 %         2.1   [warning] The user asks to use more CPU's than those available.
0056 %         2.2   [warning] There are unused CPU's!
0057 %
0058 %
0059 %   Value 3:    The remote computer is unreachable!!!
0060 %
0061 %   Value 4:    The fields user name and/or password are/is empty!
0062 %
0063 %   Value 5:    Remote Drive and/or Remote Folder do not exist!
0064 %
0065 %   Value 6:    It is impossible write/read files on the remote computer.
0066 %
0067 %   Value 7:    The values user and/or passwd are incorrect or the user has
0068 %               no permissions to execute a Matlab session. Or simply
0069 %               Matlab path (MatlabOctavePath) is incorrect!
0070 %
0071 %   Value 8:    Dynare path (DynarePath) is incorrect!
0072 %
0073 %   Value 9:    It is impossible delete remote computational temporary files!
0074 %
0075 %
0076 %
0077 %
0078 % Currently when errors are detected execution simply stops and users can
0079 % fix configuration errors according to the error type.
0080 
0081 % Copyright (C) 2009-2011 Dynare Team
0082 %
0083 % This file is part of Dynare.
0084 %
0085 % Dynare is free software: you can redistribute it and/or modify
0086 % it under the terms of the GNU General Public License as published by
0087 % the Free Software Foundation, either version 3 of the License, or
0088 % (at your option) any later version.
0089 %
0090 % Dynare is distributed in the hope that it will be useful,
0091 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0092 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0093 % GNU General Public License for more details.
0094 %
0095 % You should have received a copy of the GNU General Public License
0096 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0097 
0098 
0099 ErrorCode=0;
0100 
0101 
0102 for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
0103     % and use AnalyseComputationalEnvironment with differents input!
0104     
0105     
0106     % Determine the operating system or software version when necessary
0107     % for different command types.
0108    
0109     OScallerUnix=~ispc;
0110     OScallerWindows=ispc;
0111     OStargetUnix=strcmpi('unix',DataInput(Node).OperatingSystem);
0112     if isempty(DataInput(Node).OperatingSystem),
0113         OStargetUnix=OScallerUnix;
0114     end
0115     OStargetWindows=strcmpi('windows',DataInput(Node).OperatingSystem);
0116     if isempty(DataInput(Node).OperatingSystem),
0117         OStargetWindows=OScallerWindows;
0118     end
0119     
0120     Environment= (OScallerUnix || OStargetUnix);
0121     
0122     disp(' ');
0123     disp(' ');
0124     disp(['Testing computer -> ',DataInput(Node).ComputerName,' <- ...']);
0125     disp(' ');
0126     disp(' ');
0127     
0128     % The function is composed by two main blocks, determined by the 'Local'
0129     % variable.
0130     
0131     % This check can be removed ... according to the dynare parser
0132     % strategy.
0133     
0134     if ((DataInput(Node).Local == 0) |(DataInput(Node).Local == 1))
0135         % Continue it is Ok!
0136         disp('Check on Local Variable ..... Ok!');
0137         disp(' ');
0138         disp(' ');
0139         
0140     else
0141         disp('The variable "Local" has a bad value!');
0142         disp(' ');
0143         disp('ErrorCode 1.');
0144         disp(' ');
0145         disp(' ');
0146         ErrorCode=1;
0147         return
0148         
0149     end
0150     
0151     %         %%%%%%%%%%  Local (No Network) Computing   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0152     %         Here only the multi-core, or multi-processor avaiable on local
0153     %         machine are involved in parallel computing. No network
0154     %         comunications are required!
0155     
0156     
0157     % In this case we need to check only the variable 'CPUnbr'.
0158     
0159     % We run the parallel code on local computer, so the others fields are automatically
0160     % fixed by Dynare parser. Then the user can also fill them with wrong values.
0161     
0162     
0163     %         %%%%%%%%%%  Cluster Computing   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0164     %         Here we can have many computer with multi-core, or multi-processor avaiable on the
0165     %         network and involved in parallel computing.
0166     %         So in this case we need more sophisticated check.
0167     
0168     
0169     if (DataInput(Node).Local == 0)
0170         
0171         % Now we verify if it is possibile to be connected with the
0172         % remote computer.
0173         
0174         si1=[];
0175         de1=[];
0176         
0177         if Environment
0178             if OScallerWindows
0179                 [si1 de1]=system(['ping ', DataInput(Node).ComputerName]);
0180             else
0181                 [si1 de1]=system(['ping ', DataInput(Node).ComputerName, ' -c 4']);
0182             end
0183         else
0184             [si1 de1]=system(['ping ', DataInput(Node).ComputerName]);
0185         end
0186         
0187         if (si1)
0188             disp(['It is impossibile to be connected to the computer with name "',DataInput(Node).ComputerName,'" using the network!']);
0189             disp(' ');
0190             disp('ErrorCode 3.');
0191             ErrorCode=3;
0192             disp(' ');
0193             disp(' ');
0194             return;
0195         else
0196             disp('Check on ComputerName Variable ..... Ok!');
0197             disp(' ');
0198             disp(' ');
0199         end
0200         
0201         
0202         % Now we verify if user name and password are correct and if remote
0203         % drive and remote folder exist on the remote computer and it is
0204         % possible to exchange data with them.
0205         
0206         if Environment
0207             % This check can be removed ... according to the dynare parser
0208             % strategy.
0209             
0210             if (isempty(DataInput(Node).UserName))
0211                 disp('The fields UserName is empty!');
0212                 disp(' ');
0213                 disp('ErrorCode 4.');
0214                 disp(' ');
0215                 disp(' ');
0216                 ErrorCode=4;
0217                 return
0218             end
0219             disp('Check on UserName Variable ..... Ok!');
0220             disp(' ');
0221             disp(' ');
0222             
0223             % This check can be removed ... according to the dynare parser
0224             % strategy.
0225                 if (~isempty(DataInput(Node).Password))
0226                     disp('[WARNING] The field Password should be empty under unix or mac!');
0227                     disp(' ');
0228                     disp(['Remove the string ',DataInput(Node).Password,' from this field!']);
0229                     disp(' ');
0230                     disp('ErrorCode 4.');
0231                     disp(' ');
0232                     disp(' ');
0233                     ErrorCode=4;
0234                     %                 return
0235                 else
0236                     disp('Check on Password Variable ..... Ok!');
0237                     disp(' ');
0238                     disp(' ');
0239                 end
0240         else
0241             
0242             % This check can be removed ... according to the dynare parser
0243             % strategy.
0244             
0245             if (isempty(DataInput(Node).UserName)) || (isempty(DataInput(Node).Password))
0246                 disp('The fields UserName and/or Password are/is empty!');
0247                 disp(' ');
0248                 disp('ErrorCode 4.');
0249                 disp(' ');
0250                 disp(' ');
0251                 ErrorCode=4;
0252                 return
0253             end
0254             disp('Check on UserName Variable ..... Ok!');
0255             disp(' ');
0256             disp(' ');
0257             disp('Check on Password Variable ..... Ok!');
0258             disp(' ');
0259             disp(' ');
0260             
0261         end
0262         
0263         % Now we very if RemoteDrive and/or RemoteDirectory exist on remote
0264         % computer!
0265         
0266         if Environment
0267             
0268             % This check can be removed ... according to the dynare parser
0269             % strategy.
0270             
0271             if  isempty(DataInput(Node).RemoteDirectory)
0272                 disp('The field RemoteDirectory is empty!');
0273                 disp(' ');
0274                 disp('ErrorCode 5.');
0275                 disp(' ');
0276                 disp(' ');
0277                 ErrorCode=5;
0278                 return
0279             end
0280             
0281             % This check can be removed ... according to the dynare parser
0282             % strategy.
0283             
0284                 if (~isempty(DataInput(Node).RemoteDrive))
0285                     disp('[WARNING] The fields RemoteDrive should be empty under unix or mac!');
0286                     disp(' ');
0287                     disp(['remove the string ',DataInput(Node).RemoteDrive,' from this field!']);
0288                     disp(' ');
0289                     disp('ErrorCode 5.');
0290                     disp(' ');
0291                     disp(' ');
0292                     ErrorCode=5;
0293                     %                 return
0294                 end
0295             
0296             si2=[];
0297             de2=[];
0298             
0299             [si2 de2]=system(['ssh ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' ls ',DataInput(Node).RemoteDirectory,'/',RemoteTmpFolder,'/']);
0300             
0301             if (si2)
0302                 disp ('Remote Directory does not exist or is not reachable!');
0303                 disp(' ');
0304                 disp('ErrorCode 5.');
0305                 disp(' ');
0306                 disp(' ');
0307                 ErrorCode=5;
0308                 return
0309             end
0310             
0311             disp('Check on RemoteDirectory Variable ..... Ok!');
0312             disp(' ');
0313             disp(' ');
0314             disp('Check on RemoteDrive Variable ..... Ok!');
0315             disp(' ');
0316             disp(' ');
0317             
0318         else
0319             % This check can be removed ... according to the dynare parser
0320             % strategy.
0321             
0322             if (isempty(DataInput(Node).RemoteDrive)||isempty(DataInput(Node).RemoteDirectory))
0323                 disp('Remote RemoteDrive and/or RemoteDirectory is/are empty!');
0324                 disp(' ');
0325                 disp('ErrorCode 5.');
0326                 disp(' ');
0327                 disp(' ');
0328                 ErrorCode=5;
0329                 return
0330             end
0331             
0332             
0333             si2=[];
0334             de2=[];
0335             [s12 de2]=system(['dir \\',DataInput(Node).ComputerName,'\',DataInput(Node).RemoteDrive,'$\',DataInput(Node).RemoteDirectory,'\',RemoteTmpFolder]);
0336             
0337             if (si2)
0338                 disp ('Remote Directory does not exist or it is not reachable!');
0339                 disp(' ');
0340                 disp('ErrorCode 5.');
0341                 disp(' ');
0342                 disp(' ');
0343                 ErrorCode=5;
0344                 return
0345             end
0346             
0347             disp('Check on RemoteDirectory Variable ..... Ok!');
0348             disp(' ');
0349             disp(' ');
0350             disp('Check on RemoteDrive Variable ..... Ok!');
0351             disp(' ');
0352             disp(' ');
0353             
0354         end
0355         
0356         
0357         % Now we verify if it possible to exchange data with the remote
0358         % computer:
0359         
0360         
0361         % Build a command file to test the matlab execution and dynare path ...
0362         
0363         fid = fopen('Tracing.m', 'w+');
0364         s1=(['fT = fopen(''MatlabOctaveIsOk.txt'',''w+'');\n']);
0365         s2='fclose(fT);\n';
0366         SBS=strfind(DataInput(Node).DynarePath,'\');
0367         DPStr=DataInput(Node).DynarePath;
0368         if isempty(SBS),
0369             DPStrNew=DPStr;
0370         else
0371             DPStrNew=[DPStr(1:SBS(1)),'\'];
0372             for j=2:length(SBS),
0373                 DPStrNew=[DPStrNew,DPStr(SBS(j-1)+1:SBS(j)),'\'];
0374             end
0375             DPStrNew=[DPStrNew,DPStr(SBS(end)+1:end)];
0376         end
0377         s3=['addpath(''',DPStrNew,'''),\n'];
0378         s4=['try,\n  dynareroot = dynare_config();\n'];
0379         s41=(['  fT = fopen(''DynareIsOk.txt'',''w+'');\n']);
0380         s42='  fclose(fT);\n';
0381         s5=['catch,end,\n'];
0382         s51=(['  fT = fopen(''DynareFailed.txt'',''w+'');\n']);
0383         s52='  fclose(fT);\n';
0384         send='exit';
0385         StrCommand=([s1,s2,s3,s4,s41,s42,s5,s51,s52,send]);
0386         
0387         % Mettere controllo su NbW ...
0388         % if exist('OCTAVE_VERSION')
0389         %     NbW = fprintf(fid,StrCommand, '%s');
0390         % else
0391         NbW = fprintf(fid,StrCommand, '%s');
0392         % end
0393         fclose(fid);
0394         
0395         dynareParallelSendFiles('Tracing.m', RemoteTmpFolder,DataInput(Node));
0396         FindTracing = dynareParallelDir('Tracing.m', RemoteTmpFolder,DataInput(Node));
0397         
0398         delete ('Tracing.m');
0399         
0400         if (isempty(FindTracing))
0401             disp ('It is impossible to exchange data with Remote Drive and/or Remote Directory! ErrorCode 6.');
0402             disp(' ');
0403             disp('ErrorCode 6.');
0404             disp(' ');
0405             disp(' ');
0406             ErrorCode=6;
0407             return
0408         else
0409             disp('Check on Exchange File with Remote Computer ..... Ok!');
0410             disp(' ');
0411             disp(' ');
0412         end
0413         
0414         
0415         % Now we verify if it is possible execute a matlab/octave section on remote
0416         % machine when the user is .UserName with password .Password and
0417         % the path is MatlabOctavePath.
0418         
0419         if Environment
0420             if strfind([DataInput(Node).MatlabOctavePath], 'octave') % Hybrid computing Matlab(Master)->Octave(Slaves) and Vice Versa!
0421                 system(['ssh ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' "cd ',DataInput(Node).RemoteDirectory,'/',RemoteTmpFolder,  '; ', DataInput(Node).MatlabOctavePath, ' Tracing.m;" &']);
0422             else
0423                 system(['ssh ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' "cd ',DataInput(Node).RemoteDirectory,'/',RemoteTmpFolder,  '; ', DataInput(Node).MatlabOctavePath, ' -nosplash -nodesktop -minimize -r Tracing;" &']);
0424             end
0425         else
0426             if  strfind([DataInput(Node).MatlabOctavePath], 'octave') % Hybrid computing Matlab(Master)->Octave(Slaves) and Vice Versa!
0427                 [NonServeS NenServeD]=system(['start /B psexec \\',DataInput(Node).ComputerName,' -e -u ',DataInput(Node).UserName,' -p ',DataInput(Node).Password,' -W ',DataInput(Node).RemoteDrive,':\',DataInput(Node).RemoteDirectory,'\',RemoteTmpFolder ' -low   ',DataInput(Node).MatlabOctavePath,' Tracing.m']);
0428             else
0429                 [NonServeS NenServeD]=system(['start /B psexec \\',DataInput(Node).ComputerName,' -e -u ',DataInput(Node).UserName,' -p ',DataInput(Node).Password,' -W ',DataInput(Node).RemoteDrive,':\',DataInput(Node).RemoteDirectory,'\',RemoteTmpFolder ' -low   ',DataInput(Node).MatlabOctavePath,' -nosplash -nodesktop -minimize -r Tracing']);
0430             end
0431         end
0432         
0433         % Timer da fissare, nei valori di attesa!
0434         
0435         t1=fix(clock);
0436         
0437         if t1(5)+1>60;
0438             t2=2;
0439         else t2=t1(5)+1;
0440         end
0441         
0442         Flag=0;
0443         
0444         while (1);
0445             if Flag==0
0446                 disp('Try to run matlab/octave on remote machine ... ');
0447                 disp(' ');
0448                 disp('please wait ... ');
0449                 disp(' ');
0450                 Flag=1;
0451             end
0452             nt=fix(clock);
0453             nt(5)-t2;
0454             
0455             if (~isempty (dynareParallelDir('MatlabOctaveIsOk.txt',RemoteTmpFolder,DataInput(Node)))) || ((nt(5)-t2)>0)
0456                 if ((nt(5)-t2)>0)
0457                     ErrorCode=7;
0458                 end
0459                 break
0460             end
0461             
0462         end
0463         
0464         if  (ErrorCode==7)
0465             
0466             disp ('It is not possible execute a matlab session on remote machine!');
0467             disp(' ');
0468             disp('ErrorCode 7.');
0469             disp(' ');
0470             disp(' ');
0471             ErrorCode=7;
0472             dynareParallelRmDir(RemoteTmpFolder,DataInput(Node));
0473             return
0474             
0475         else
0476             disp('Check on MatlabOctave Path and MatlabOctave Program Execution on remote machine ..... Ok!');
0477             disp(' ');
0478             disp(' ');
0479             
0480             % Now we verify if the DynarePath is correct ...
0481             disp('Check the Dynare path on remote machine ... ');
0482             disp(' ');
0483             disp('please wait ... ');
0484             disp(' ');
0485             pause(2)
0486             
0487             if isempty(dynareParallelDir('DynareIsOk.txt',RemoteTmpFolder,DataInput(Node)))
0488                 ErrorCode=8;
0489             end
0490             
0491             if  (ErrorCode==8)
0492                 
0493                 disp ('The DynarePath is incorrect!');
0494                 disp(' ');
0495                 disp('ErrorCode 8.');
0496                 disp(' ');
0497                 disp(' ');
0498                 ErrorCode=8;
0499                 dynareParallelRmDir(RemoteTmpFolder,DataInput(Node));
0500                 return
0501                 
0502             else
0503                 disp('Check on Dynare Path remote machine ..... Ok!');
0504                 disp(' ');
0505                 disp(' ');
0506             end
0507         end
0508         
0509         
0510         % Now we verify if it is possible delete remote computational traces!
0511         
0512         dynareParallelRmDir(RemoteTmpFolder,DataInput(Node));
0513         
0514         si3=[];
0515         
0516         si3=dynareParallelDir('Tracing.m', RemoteTmpFolder,DataInput(Node));
0517         
0518         if (isempty(si3))
0519             disp ('Check on Delete Remote Computational Traces ..... Ok!');
0520             disp(' ');
0521             disp(' ');
0522         else
0523             disp ('It is impossible to delete temporary files on remote machine!');
0524             disp(' ');
0525             disp('ErrorCode 9.');
0526             disp(' ');
0527             disp(' ');
0528             ErrorCode=9;
0529             return
0530         end
0531         
0532         
0533     end
0534     % Now we check the variable 'CPUnbr'.
0535     
0536     % This check can be removed ... according to the dynare parser
0537     % strategy.
0538     
0539     yn=isempty(DataInput(Node).CPUnbr);
0540     
0541     if yn==1
0542         % The field is empty!
0543         disp('The field "CPUnbr" is empty!');
0544         disp(' ');
0545         disp('ErrorCode 2.');
0546         disp(' ');
0547         disp(' ');
0548         ErrorCode=2;
0549         return
0550     end
0551     
0552     % This check can be removed ... according to the dynare parser
0553     % strategy.
0554     
0555     
0556     
0557     % We look for the information on local computer hardware.
0558     
0559     si0=[];
0560     de0=[];
0561     
0562     disp('Checking Hardware please wait ...');
0563     if (DataInput(Node).Local == 1)
0564         if Environment,
0565             [si0 de0]=system('grep processor /proc/cpuinfo');
0566         else
0567             [si0 de0]=system(['psinfo \\']);
0568         end
0569     else
0570         if Environment,
0571             if OStargetUnix,
0572                 [si0 de0]=system(['ssh ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' grep processor /proc/cpuinfo']);
0573             else
0574                 [si0 de0]=system(['ssh ',DataInput(Node).UserName,'@',DataInput(Node).ComputerName,' psinfo']);
0575             end
0576         else
0577             [si0 de0]=system(['psinfo \\',DataInput(Node).ComputerName,' -u ',DataInput(Node).UserName,' -p ',DataInput(Node).Password]);
0578         end
0579     end
0580     
0581     
0582     RealCPUnbr='';
0583 %    keyboard;
0584     RealCPUnbr=GiveCPUnumber(de0,OStargetUnix);
0585     
0586     % Questo controllo penso che si possa MIGLIORARE!!!!!
0587     if  isempty (RealCPUnbr) && Environment==0,
0588         [si0 de0]=system(['psinfo \\',DataInput(Node).ComputerName]);
0589     end        
0590     RealCPUnbr=GiveCPUnumber(de0,OStargetUnix);
0591 
0592     if  isempty (RealCPUnbr)
0593         % An error occurred when we try to know the Cpu/Cores
0594         % numbers.
0595         disp('It is impossible determine the number of Cpu/Processor avaiable on this machine!');
0596         disp(' ');
0597         disp('ErrorCode 2.');
0598         disp(' ');
0599         if Environment
0600             disp('Check the command "$less /proc/cpuinfo" ... !');
0601         else
0602             disp('Check if the pstools are installed and are in machine path! And check the command "psinfo \\"');
0603         end
0604         disp(' ');
0605         ErrorCode=2;
0606         return
0607     end
0608     
0609     
0610     % Trasforming the input data provided in a form [n1:n2] in a single numerical
0611     % value.
0612     
0613     
0614     CPUnbrUser=length(DataInput(Node).CPUnbr);
0615     maxCPUnbrUser=max(DataInput(Node).CPUnbr)+1;
0616     
0617     disp(['Hardware has ', num2str(RealCPUnbr),' Cpu/Cores!']);
0618     disp(['User requires ',num2str(CPUnbrUser),' Cpu/Cores!']);
0619     if  CPUnbrUser==RealCPUnbr,
0620         % It is Ok!
0621         disp('Check on CPUnbr Variable ..... Ok!');
0622         disp(' ');
0623         disp(' ');
0624         disp(' ');
0625         
0626     end
0627     
0628     if CPUnbrUser > RealCPUnbr
0629         disp('Warning! The user asks to use more CPU''s than those available.');
0630         disp(' ');
0631         disp(' ');
0632         ErrorCode=2.1;
0633         % return
0634         
0635     end
0636     if CPUnbrUser < RealCPUnbr
0637         disp('Warning! There are unused CPU''s!');
0638         disp(' ');
0639         disp(' ');
0640         ErrorCode=2.2;
0641         % return
0642     end
0643     
0644     disp(['Test for Cluster computation, computer ',DataInput(Node).ComputerName, ' ..... Passed!']);
0645     disp(' ');
0646     disp(' ');
0647     
0648     
0649 end
0650 
0651 return

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005