From 0fb688136e453c1eb5b6a2125fbb0cc46b5fedfd Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Fri, 5 Apr 2013 17:28:43 +0200 Subject: [PATCH] 1) used Environment input argument to GiveCPUnumber to fix bug with hybrid unix/windows clusters; 2) removed return after failure of ping; some machines like hal can be connected but do not allow ping; --- matlab/parallel/AnalyseComputationalEnvironment.m | 8 ++++---- matlab/parallel/GiveCPUnumber.m | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/matlab/parallel/AnalyseComputationalEnvironment.m b/matlab/parallel/AnalyseComputationalEnvironment.m index ab8465a38..f3bf88c36 100644 --- a/matlab/parallel/AnalyseComputationalEnvironment.m +++ b/matlab/parallel/AnalyseComputationalEnvironment.m @@ -189,13 +189,13 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for' end if (si1) - disp(['It is impossibile to be connected to the computer with name "',DataInput(Node).ComputerName,'" using the network!']); + disp(['It is impossibile to ping to the computer with name "',DataInput(Node).ComputerName,'" using the network!']); disp(' '); disp('ErrorCode 3.'); ErrorCode=3; disp(' '); disp(' '); - return; +% return; else disp('Check on ComputerName Variable ..... Ok!'); disp(' '); @@ -609,13 +609,13 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for' RealCPUnbr=''; % keyboard; - RealCPUnbr=GiveCPUnumber(de0); + RealCPUnbr=GiveCPUnumber(de0,Environment); % Questo controllo penso che si possa MIGLIORARE!!!!! if isempty (RealCPUnbr) && Environment==0, [si0 de0]=system(['psinfo \\',DataInput(Node).ComputerName]); end - RealCPUnbr=GiveCPUnumber(de0); + RealCPUnbr=GiveCPUnumber(de0,Environment); if isempty (RealCPUnbr) % An error occurred when we try to know the Cpu/Cores diff --git a/matlab/parallel/GiveCPUnumber.m b/matlab/parallel/GiveCPUnumber.m index 355d48506..c858d258f 100644 --- a/matlab/parallel/GiveCPUnumber.m +++ b/matlab/parallel/GiveCPUnumber.m @@ -1,4 +1,4 @@ -function [nCPU]= GiveCPUnumber (ComputerInformations) +function [nCPU]= GiveCPUnumber (ComputerInformations, Environment) % PARALLEL CONTEXT % In a parallel context this function return the CPUs or cores numer avaiable % on the computer used for run parallel code. @@ -33,13 +33,13 @@ function [nCPU]= GiveCPUnumber (ComputerInformations) nCPU=''; -Enviroment=-1; - +if nargin < 2, % Determine a specific operating system or software version when necessary % for different command (sintax, name, ...). -Enviroment=~ispc; %isunix || (~matlab_ver_less_than('7.4') && ismac); +Environment=~ispc; %isunix || (~matlab_ver_less_than('7.4') && ismac); +end -switch Enviroment +switch Environment case 0 %WINDOWS OPERATING SYSTEM OffSet=27;