lukeschedulerparam

PURPOSE ^

SYNOPSIS ^

function dkepath = lukeschedulerparam(dkepath,mdce_mode,remnum,returnmode,transpmode,opt_gui,style)

DESCRIPTION ^

 this function creates a standar scheduler structure in dkepath.clustermode.run_lukert 
 for LUKE remote and/or distributed computing

 INPUTS : 
       - mdce_mode : calculation distribution mode 
           o [] (default) : prompt for choice
           o -length(remote),...,-2,-1 : remcomputing on the remote cluster dkepath.remote(-mdce_mode)
           o 0 : sequential calculation
           o 1 : use of jobcomputing
           o 2 : use of parcomputing (parfor)
           o 3 : remcomputing on the local cluster

       - remnum : remote calculation mode
           o [] (default) : prompt for choice
           o 0 : local calculation
           o 1 : calculation transfered to remote cluster dkepath.remote(remnum)

       - returnmode
           o [] (default) : prompt for choice
           o 0 : wait for result
           o 1 : return hand after starting calculation (valid only if remnum > 0 or mode < 0)

       - transpmode : (struct) fast electron transport structure, (true) fast electron transport included or (false) not included
           o struct : fast electron transport structure tested to see if transport is truly included
           o false (default) : fast electron transport not included 
               => 7 GB memory default calculation
           o true : fast electron transport included 
               => 14 GB memory default calculation

       - opt_gui : option for selection prompt
           o false (default) : command line selection
           o true : new GUI selection
           o handle : existing GUI selection

       - style : style structure for GUI selection (see iselect_jd)
           o struct (default) : default specification

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dkepath = lukeschedulerparam(dkepath,mdce_mode,remnum,returnmode,transpmode,opt_gui,style)
0002 %
0003 % this function creates a standar scheduler structure in dkepath.clustermode.run_lukert
0004 % for LUKE remote and/or distributed computing
0005 %
0006 % INPUTS :
0007 %       - mdce_mode : calculation distribution mode
0008 %           o [] (default) : prompt for choice
0009 %           o -length(remote),...,-2,-1 : remcomputing on the remote cluster dkepath.remote(-mdce_mode)
0010 %           o 0 : sequential calculation
0011 %           o 1 : use of jobcomputing
0012 %           o 2 : use of parcomputing (parfor)
0013 %           o 3 : remcomputing on the local cluster
0014 %
0015 %       - remnum : remote calculation mode
0016 %           o [] (default) : prompt for choice
0017 %           o 0 : local calculation
0018 %           o 1 : calculation transfered to remote cluster dkepath.remote(remnum)
0019 %
0020 %       - returnmode
0021 %           o [] (default) : prompt for choice
0022 %           o 0 : wait for result
0023 %           o 1 : return hand after starting calculation (valid only if remnum > 0 or mode < 0)
0024 %
0025 %       - transpmode : (struct) fast electron transport structure, (true) fast electron transport included or (false) not included
0026 %           o struct : fast electron transport structure tested to see if transport is truly included
0027 %           o false (default) : fast electron transport not included
0028 %               => 7 GB memory default calculation
0029 %           o true : fast electron transport included
0030 %               => 14 GB memory default calculation
0031 %
0032 %       - opt_gui : option for selection prompt
0033 %           o false (default) : command line selection
0034 %           o true : new GUI selection
0035 %           o handle : existing GUI selection
0036 %
0037 %       - style : style structure for GUI selection (see iselect_jd)
0038 %           o struct (default) : default specification
0039 %
0040 if nargin < 7,
0041     style = struct;% no fast electron transport
0042 end
0043 if nargin < 6,
0044     opt_gui = false;% no fast electron transport
0045 end
0046 if nargin < 5,
0047     transpmode = false;% no fast electron transport
0048 end
0049 if nargin < 4,
0050     returnmode = [];% prompt for choice
0051 end
0052 if nargin < 3,
0053     remnum = [];% prompt for choice
0054 end
0055 if nargin < 2,
0056     mdce_mode = [];% prompt for choice
0057 end
0058 if nargin < 1 || isempty(dkepath) || any(~isfield(dkepath,{'remote','distprofiles','remprofiles'})),
0059     dkepath = load_structures_yp('dkepath','','');
0060 end
0061 %
0062 nrem = length(dkepath.remote);
0063 %
0064 % initial selection
0065 %
0066 if isfield(dkepath,'clustermode') && isfield(dkepath.clustermode,'run_lukert') && isfield(dkepath.clustermode.run_lukert,'scheduler'),
0067     scheduler = dkepath.clustermode.run_lukert.scheduler;
0068 else
0069     scheduler = struct;
0070 end
0071 %
0072 if isempty(mdce_mode),
0073     if isfield(scheduler,'mode') && isscalar(scheduler.mode) && isnumeric(scheduler.mode) && any(scheduler.mode == -nrem:2),
0074         mdce_mode = scheduler.mode;
0075         if mdce_mode < 0,
0076             mdce_mode = 2 - mdce_mode;
0077         end
0078     else
0079         mdce_mode = 0;
0080     end
0081     mdce_mode = iselect_jd(dkepath.distprofiles,'Distribution of calc. : ',opt_gui,style,1 + mdce_mode,'popupmenu') - 1;
0082     if mdce_mode > 2,
0083         mdce_mode = 2 - mdce_mode;%use of remcomputing with negative mdce_mode
0084     end
0085 elseif ~isscalar(mdce_mode) || ~isnumeric(mdce_mode) || ~any(mdce_mode == -nrem:3),
0086     disp('WARNING : invalid choice entered for mdce_mode. Sequential mode enforced.');
0087     mdce_mode = 0;
0088 end
0089 %
0090 if isempty(remnum),
0091     if isfield(scheduler,'remnum') && isscalar(scheduler.remnum) && isnumeric(scheduler.remnum) && any(scheduler.remnum == 0:nrem),
0092         remnum = scheduler.remnum;
0093     else
0094         remnum = 0;
0095     end
0096     remnum = iselect_jd(dkepath.remprofiles,'Where do you want to run LUKE ?',opt_gui,style,1 + remnum,'popupmenu') - 1;
0097 elseif ~isscalar(remnum) || ~isnumeric(remnum) || ~any(remnum == 0:nrem),
0098     disp('WARNING : invalid choice entered for remnum. Local calculation enforced.');
0099     remnum = 0;
0100 end
0101 %
0102 if isempty(returnmode) && (mdce_mode < 0 || remnum > 0),
0103     if isfield(scheduler,'remtimout') && scheduler.remtimout == 0,
0104         waitstr = 'n';
0105     else
0106         waitstr = 'y';
0107     end
0108     returnmode = input_dke_yp('Do you want to wait for results (y/n)',waitstr,{'y','n'}) == 'n';
0109 elseif isempty(returnmode) || (remnum == 0 && mdce_mode >= 0),
0110     returnmode = false;
0111 end
0112 if ~isscalar(returnmode) || (~islogical(returnmode) && (~isnumeric(returnmode) || ~any(returnmode == 0:1))),
0113     disp('WARNING : invalid choice entered for returnmode. Waiting for results.');
0114     returnmode = false;
0115 elseif returnmode && mdce_mode > 0 && remnum == 0,
0116     disp('WARNING : returnmode enforced to ''off'' for local distributed calculation with mdce_mode == 1,2.');
0117     returnmode = false;
0118 end
0119 %
0120 if isstruct(transpmode),% transpmode is transpfaste
0121     if (isfield(transpmode,'Dr0') &&  transpmode.Dr0 > 0) || (isfield(transpmode,'Vr0') &&  transpmode.Vr0 ~= 0),
0122         transpmode = true;
0123     else
0124         transpmode = false;
0125     end
0126 elseif isempty(transpmode),
0127     transpmode = false;
0128 elseif ~isscalar(transpmode) || (~islogical(transpmode) && (~isnumeric(transpmode) || ~any(transpmode == 0:1))),
0129     disp('WARNING : invalid choice entered for transpmode. transpmode == false enforced.');
0130     transpmode = false;
0131 end
0132 %
0133 dkepath.clustermode.run_lukert.scheduler.mode = mdce_mode;
0134 dkepath.clustermode.run_lukert.scheduler.remnum = remnum;
0135 if returnmode,
0136     dkepath.clustermode.run_lukert.scheduler.remtimout = 0;
0137 else
0138     dkepath.clustermode.run_lukert.scheduler.remtimout = 60*24;% (minutes) 24 hours default limit
0139 end    
0140 if(isfield(dkepath,'luke_memory') && ~isempty(dkepath.luke_memory))
0141     dkepath.clustermode.run_lukert.scheduler.memory = dkepath.luke_memory;
0142 else
0143     if transpmode,
0144         dkepath.clustermode.run_lukert.scheduler.memory = 14000;% (mb) 14 GB default memory with fast electron transport
0145     else
0146         dkepath.clustermode.run_lukert.scheduler.memory = 7000;% (mb) 7 GB default memory without fast electron transport
0147     end
0148 end
0149 %
0150 dkepath.clustermode.run_lukert.scheduler.walltime = 24;% (hours) 24 hours default limit, corresponds to remtimout for direct modes
0151 dkepath.clustermode.run_lukert.scheduler.enforce = 0+2i;% three MDCE attempts, no seq switch
0152 %
0153 if dkepath.clustermode.run_lukert.scheduler.remnum > 0,
0154     if strcmp(dkepath.remote(dkepath.clustermode.run_lukert.scheduler.remnum).scheduler,'torque') | strcmp(dkepath.remote(dkepath.clustermode.run_lukert.scheduler.remnum).scheduler,'pbs'),
0155         queuemode = input_dke_yp('Do you want to see queuing parameters for ''torque'' or ''pbs'' schedulers (y/n)','n',{'y','n'}) == 'y';
0156         if queuemode,
0157             %
0158             disp('----------------------------- default queue parameters ----------------------------')
0159             disp(' ')
0160             disp(dkepath.remote(dkepath.clustermode.run_lukert.scheduler.remnum).queue);
0161             disp('-----------------------------------------------------------------------------------');
0162             disp('WARNING: the queue parameters may be changed in remote profiles (MatRemote toolbox)');
0163             disp('-----------------------------------------------------------------------------------');
0164         end
0165     end  
0166 end
0167 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.