More comments and traps
parent
c76c0744ff
commit
3cecfb0f22
|
@ -1,5 +1,12 @@
|
||||||
function [ErrorCode] = AnalyseComputationalEnviroment(DataInput)
|
function [ErrorCode] = AnalyseComputationalEnviroment(DataInput)
|
||||||
% Input/Output description:
|
|
||||||
|
% DESCRIPTION
|
||||||
|
|
||||||
|
% This function is used to check the user computational request.
|
||||||
|
% If no error happen the function return 0.
|
||||||
|
|
||||||
|
|
||||||
|
% INPUT/OUTPUT description:
|
||||||
%
|
%
|
||||||
% DataInput is the strcture option_.parallel, with the follow fields:
|
% DataInput is the strcture option_.parallel, with the follow fields:
|
||||||
%
|
%
|
||||||
|
@ -37,10 +44,17 @@ function [ErrorCode] = AnalyseComputationalEnviroment(DataInput)
|
||||||
%
|
%
|
||||||
% Value 3: The remote computer is unreachable!!!
|
% Value 3: The remote computer is unreachable!!!
|
||||||
%
|
%
|
||||||
% Value 4: The user name and/or password is/are incorrect on the
|
% Value 4: The fields user name and/or password are/is empty!
|
||||||
% remote computer!
|
%
|
||||||
|
% Value 5: Remote Drive and/or Remote Folder not exist!
|
||||||
|
%
|
||||||
|
% Value 6: It is impossible write/read file on remote computer.
|
||||||
|
%
|
||||||
|
% Value 7: The valu user and/or passwd are incorret or the user have
|
||||||
|
% no permission to execute a Matlab section.
|
||||||
|
%
|
||||||
|
%
|
||||||
%
|
%
|
||||||
% Value 5: It is impossible write/read file on remote computer.
|
|
||||||
%
|
%
|
||||||
% Then at the point call of this function it is possible react in a best way, in accord
|
% Then at the point call of this function it is possible react in a best way, in accord
|
||||||
% with the ErrorCode.
|
% with the ErrorCode.
|
||||||
|
@ -95,13 +109,13 @@ if (DataInput.Local == 1)
|
||||||
|
|
||||||
% We look for the information on local computer hardware.
|
% We look for the information on local computer hardware.
|
||||||
|
|
||||||
si=[];
|
si0=[];
|
||||||
de=[];
|
de0=[];
|
||||||
|
|
||||||
[si de]=system(['psinfo \\']);
|
[si0 de0]=system(['psinfo \\']);
|
||||||
|
|
||||||
RealNumCPU=-1;
|
RealNumCPU=-1;
|
||||||
RealNumCPU=GiveCPUnumber(de);
|
RealNumCPU=GiveCPUnumber(de0);
|
||||||
|
|
||||||
% Trasforming the input data provided in a form [n1:n2] in a single numerical
|
% Trasforming the input data provided in a form [n1:n2] in a single numerical
|
||||||
% value.
|
% value.
|
||||||
|
@ -128,12 +142,12 @@ end
|
||||||
|
|
||||||
if (DataInput.Local == 0)
|
if (DataInput.Local == 0)
|
||||||
|
|
||||||
si=[];
|
si1=[];
|
||||||
de=[];
|
de1=[];
|
||||||
|
|
||||||
[si de]=system(['ping ', DataInput.PcName]);
|
[si1 de1]=system(['ping ', DataInput.PcName]);
|
||||||
|
|
||||||
if si==1
|
if si1==1
|
||||||
% It is impossiblie to be connected to the
|
% It is impossiblie to be connected to the
|
||||||
% remote computer.
|
% remote computer.
|
||||||
|
|
||||||
|
@ -141,56 +155,93 @@ if (DataInput.Local == 0)
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
% -> IL CODICE SEGUENTE E' DA CONTROLLARE E VERIFICARE!
|
|
||||||
|
|
||||||
% The Local Machine can be connetted with Remote Computer.
|
% The Local Machine can be connetted with Remote Computer.
|
||||||
|
|
||||||
% Now we verify if user name and password are correct and if remote
|
% Now we verify if user name and password are correct and if remote
|
||||||
% drive and remote folder exist on the remote computer and it is
|
% drive and remote folder exist on the remote computer and it is
|
||||||
% possible to exchange data with them.
|
% possible to exchange data with them.
|
||||||
|
|
||||||
si=[];
|
|
||||||
de=[];
|
|
||||||
|
|
||||||
[si de]=system(['psinfo \\', DataInput.PcName, ' -u ',DataInput.user, ' -p ',DataInput.passwd ]);
|
if (isempty(DataInput.user)) || (isempty(DataInput.passwd))
|
||||||
|
|
||||||
if si<0
|
% The fields user name and/or password are/is empty!
|
||||||
% It is possible to be connected to the remote computer but it is not usable because the user
|
|
||||||
% name and/or password is/are incorrect.
|
ErrorCode=4;
|
||||||
|
return
|
||||||
|
|
||||||
ErrorCodeComputer=4;
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
% Username and Password are correct!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% Now we verify if it possible to exchange data with the remote
|
|
||||||
% computer:
|
% Now we very if RemoteDrive and/or RemoteFolder exist on remote
|
||||||
|
% computer
|
||||||
|
|
||||||
|
StartPwd=pwd;
|
||||||
|
|
||||||
|
try
|
||||||
|
cd(['\\',DataInput.PcName,'\',DataInput.RemoteDrive,'$\',DataInput.RemoteFolder]);
|
||||||
|
catch
|
||||||
|
|
||||||
|
cd ([StartPwd]);
|
||||||
|
disp 'Remote Drive and/or Remote Folder not exist!';
|
||||||
|
|
||||||
|
ErrorCode=5;
|
||||||
|
return
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
cd ([StartPwd]);
|
||||||
|
|
||||||
|
|
||||||
fid = fopen('Tracing.txt','w+');
|
% Now we verify if it possible to exchange data with the remote
|
||||||
fclose (fid);
|
% computer:
|
||||||
|
|
||||||
% ATTENZIONE: verificare perche sembra funzionare anche se il RemoteFolder non
|
|
||||||
% esiste.
|
|
||||||
|
|
||||||
Status=movefile('Tracing.txt', ['\\',DataInput.PcName,'\',DataInput.RemoteDrive,'$\',DataInput.RemoteFolder]);
|
Status=copyfile('Tracing.m', ['\\',DataInput.PcName,'\',DataInput.RemoteDrive,'$\',DataInput.RemoteFolder]);
|
||||||
|
|
||||||
if Status==1
|
if Status==1
|
||||||
% Remote Drive/Folder exist on Remote computer and
|
% Remote Drive/Folder exist on Remote computer and
|
||||||
% it is possible to exchange data with him.
|
% it is possible to exchange data with him.
|
||||||
else
|
else
|
||||||
|
|
||||||
% Move file error!
|
ErrorCode=6;
|
||||||
ErrorCodeComputer=5;
|
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
% Now we verify if it is possible execute a matlab section on remote
|
||||||
|
% machine when the user is .user with password .passwd
|
||||||
|
|
||||||
|
si2=[];
|
||||||
|
de2=[];
|
||||||
|
|
||||||
|
[si2 de2]=system(['start /B /WAIT psexec \\',DataInput.PcName,' -e -u ',DataInput.user,' -p ',DataInput.passwd,' -W ',DataInput.RemoteDrive,':\',DataInput.RemoteFolder, ' -low matlab -nosplash -nodesktop -minimize -r Tracing']);
|
||||||
|
|
||||||
|
NoError='error code 0';
|
||||||
|
|
||||||
|
StrError= findstr(NoError,de2);
|
||||||
|
|
||||||
|
|
||||||
|
if isempty (StrError)
|
||||||
|
|
||||||
|
% Bad user and/or passwd!
|
||||||
|
ErrorCode=7;
|
||||||
|
return;
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
% No error it is possible execute a matlab section on remote
|
||||||
|
% machine when the user is .user with password .passwd
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
% At this point we can to analyze the remote computer hardware.
|
% At this point we can to analyze the remote computer hardware.
|
||||||
|
|
||||||
|
|
||||||
RealNumCPU=-1;
|
RealNumCPU=-1;
|
||||||
RealNumCPU=GiveCPUnumber(de);
|
|
||||||
|
|
||||||
|
[si0 de0]=system(['psinfo \\']);
|
||||||
|
RealNumCPU=GiveCPUnumber(de0);
|
||||||
|
|
||||||
|
|
||||||
% Trasforming the input data provided in a form [n1:n2] in a single numerical
|
% Trasforming the input data provided in a form [n1:n2] in a single numerical
|
||||||
% value.
|
% value.
|
||||||
|
|
Loading…
Reference in New Issue