0001 function rundke_remote(remlist,link_mode,remtimout)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 if nargin < 3,
0023 remtimout = 10;
0024 end
0025
0026 if nargin < 2 || (~isempty(link_mode) && (~isnumeric(link_mode) || ~isscalar(link_mode) || ~any(link_mode == [0:2]))),
0027 link_mode = NaN;
0028 end
0029
0030 if nargin < 1 || (~isempty(remlist) && ~isnumeric(remlist)),
0031 remlist = [];
0032 end
0033
0034 permission = test_permissions_yp;
0035
0036 if ~permission
0037 disp('Please move the script to a local folder where you have write permission before to run it')
0038 return;
0039 end
0040
0041 rempause = 1/60;
0042
0043 debugmode = 0;
0044 cleanmode = 2;
0045 luke_memory = 2000;
0046 luke_walltime = '01:00';
0047 enforce = 0;
0048
0049 opt.save = 1;
0050
0051 mdce_opt = 0;
0052
0053 localdatadir = 'LUKE_RESULTS_files_remote/';
0054
0055
0056
0057 id_simul = 'LH_karney_remote';
0058 path_simul = '';
0059
0060 psin_S = [];
0061 rho_S = [0.5];
0062
0063 id_path = '';
0064 path_path = '';
0065
0066 id_equil = 'TScyl';
0067 path_equil = '';
0068
0069 id_dkeparam = 'UNIFORM10010020';
0070 path_dkeparam = '';
0071
0072 id_display = 'NO_DISPLAY';
0073 path_display = '';
0074
0075
0076
0077
0078
0079 [dkepath,equil,dkeparam,dkedisplay] = load_structures_yp('dkepath',id_path,path_path,'equil',id_equil,path_equil,'dkeparam',id_dkeparam,path_dkeparam,'dkedisplay',id_display,path_display);
0080
0081
0082
0083 wavestruct.omega_lh = [4]*2*pi*1e9;
0084
0085
0086
0087 wavestruct.opt_lh = 2;
0088
0089
0090
0091
0092 wavestruct.norm_ref = 1;
0093
0094 wavestruct.yNparmin_lh = [NaN];
0095 wavestruct.yNparmax_lh = [NaN];
0096 wavestruct.yNpar_lh = [NaN];
0097 wavestruct.ydNpar_lh = [NaN];
0098
0099
0100 wavestruct.yD0_in_c_lh = [1];
0101
0102 wavestruct.yD0_in_lh_prof = [0];
0103 wavestruct.ypeak_lh = [NaN];
0104 wavestruct.ywidth_lh = [NaN];
0105
0106 wavestruct.ythetab_lh = [0]*pi/180;
0107
0108
0109
0110
0111 if exist('dmumpsmex');dkeparam.invproc = -2;end
0112
0113 dkeparam.boundary_mode_f = 0;
0114 dkeparam.norm_mode_f = 1;
0115 dkeparam.tn = [50000,100000];
0116 dkeparam.rt_mode = 1;
0117
0118 dkeparam.rho_S = rho_S;
0119 dkeparam.psin_S = psin_S;
0120
0121 dkeparam.clustermode.coll_dke_jd.scheduler.mode = mdce_opt;
0122 dkeparam.clustermode.eecoll_dke_yp.scheduler.mode = mdce_opt;
0123
0124
0125
0126 dkeparam.pnmax_S = 30;
0127
0128 wavestruct.yvparmin_lh = [4];
0129 wavestruct.yvparmax_lh = [7];
0130
0131 waves{1} = make_idealLHwave_jd(equil,wavestruct);
0132
0133 opt.fields = {'Znorm','Zcurr','ZP0'};
0134
0135
0136
0137 lukestruct.equil = equil;
0138 lukestruct.dkeparam = dkeparam;
0139 lukestruct.dkedisplay = dkedisplay;
0140 lukestruct.waves = waves;
0141 lukestruct.opt = opt;
0142
0143
0144
0145 disp('--> Local calculation')
0146
0147 lukestruct_0 = run_lukert(lukestruct,dkepath);
0148
0149 Znorm_0 = lukestruct_0.output.Znorm;
0150 Zcurr_0 = lukestruct_0.output.Zcurr;
0151 ZP0_0 = lukestruct_0.output.ZP0;
0152
0153
0154
0155 filename = [path_simul,'LUKE_RESULTS_',id_equil,'_',id_simul,'.mat'];
0156
0157
0158
0159 if nargin == 0 && exist(filename,'file'),
0160
0161 load(filename,'lukestructs','remlist','link_mode','remtimout');
0162
0163 dkepath = setpath_luke_jd('',link_mode);
0164
0165 nrem = length(lukestructs);
0166
0167 else
0168
0169
0170
0171 if ~exist('dkepath','var'),
0172 dkepath = setpath_luke_jd('',link_mode,0);
0173 else
0174 dkepath = setpath_luke_jd(dkepath,link_mode,0);
0175 end
0176
0177 if isfield(dkepath,'remote'),
0178 nrem = length(dkepath.remote);
0179 if isempty(remlist),
0180 remlist = input_dke_yp('Please identify profiles to be tested.',1:nrem,[1;nrem]);
0181 elseif isnan(remlist),
0182 remlist = 1:nrem;
0183 else
0184 remlist(remlist > nrem) = [];
0185 end
0186 else
0187 remlist = [];
0188 end
0189
0190 nrem = length(remlist);
0191
0192 dkepath.clustermode.run_lukert.scheduler.mode = 0;
0193 dkepath.clustermode.run_lukert.scheduler.remtimout = remtimout;
0194 dkepath.clustermode.run_lukert.scheduler.rempause = rempause;
0195 dkepath.clustermode.run_lukert.scheduler.memory = luke_memory;
0196 dkepath.clustermode.run_lukert.scheduler.walltime = luke_walltime;
0197 dkepath.clustermode.run_lukert.scheduler.debugmode = debugmode;
0198 dkepath.clustermode.run_lukert.scheduler.cleanmode = cleanmode;
0199 dkepath.clustermode.run_lukert.scheduler.enforce = enforce;
0200 if opt.save,
0201 dkepath.clustermode.run_lukert.scheduler.localdatadir = localdatadir;
0202 if exist(localdatadir,'dir') && length(dir(localdatadir)) > 2,
0203 delete([localdatadir,'*']);
0204 end
0205 end
0206
0207 lukestructs = repmat({lukestruct},[1,nrem]);
0208 end
0209
0210 for remnum = 1:nrem,
0211
0212 if ~isnan(remlist),
0213
0214 dkepath.clustermode.run_lukert.scheduler.remnum = remlist(remnum);
0215
0216 lukestructs{remnum}.simul.locid = [id_simul,'_',num2str(remlist(remnum))];
0217
0218 disp(['--> Calculation with remote number ',num2str(remlist(remnum)),', host: ',dkepath.remote(remlist(remnum)).host])
0219 end
0220
0221 lukestructs{remnum} = run_lukert(lukestructs{remnum},dkepath);
0222
0223 end
0224
0225 Znorm = cell(1,nrem);
0226 Zcurr = cell(1,nrem);
0227 ZP0 = cell(1,nrem);
0228
0229 flag_running = false(1,nrem);
0230 luke_warning = cell(1,nrem);
0231
0232 for remnum = 1:nrem,
0233 if isfield(lukestructs{remnum},'output'),
0234 if isfield(lukestructs{remnum},'warning')
0235 luke_warning{remnum} = [' **** WARNING : ',lukestructs{remnum}.warning];
0236 end
0237 Znorm{remnum} = lukestructs{remnum}.output.Znorm;
0238 Zcurr{remnum} = lukestructs{remnum}.output.Zcurr;
0239 ZP0{remnum} = lukestructs{remnum}.output.ZP0;
0240 elseif isfield(lukestructs{remnum},'job'),
0241 flag_running(remnum) = true;
0242 end
0243 end
0244
0245 j_r_k = '0.003732';
0246 p_r_k = '0.0001256';
0247 eta_r_k = '29.72';
0248
0249
0250
0251 format
0252
0253 if ~isempty(link_mode) && ~isnan(link_mode),
0254 link_modestr = ['_link_mode_',num2str(link_mode)];
0255 else
0256 link_modestr = '';
0257 end
0258
0259 diaryname = ['res_karney_remote_',datestr(now,29),link_modestr,'.log'];
0260
0261 if input_dke_yp(['Do you want to save the results in the log file ',diaryname,' ? (y/n)'],'y',{'y','n'}) == 'y',
0262
0263 if exist(diaryname,'file'),
0264 delete(diaryname);
0265 end
0266
0267 diary(diaryname);
0268
0269 else
0270 diaryname = '';
0271 end
0272
0273 disp(' ')
0274 disp(' Remote profiles tested : ')
0275 disp(' ')
0276
0277 for remnum = 1:nrem,
0278 info_dke_yp(4,['#',num2str(remnum),' : ',dkepath.profilestr{remlist(remnum)}]);
0279 end
0280 disp(' ')
0281
0282 disp(['----------------------'])
0283 disp(['Comparison LUKE/Karney - Relativistic case (4,7,1) - with tn = ',int2str(dkeparam.tn),', dtn = ',int2str(dkeparam.dtn),' and nit_f = ',int2str(dkeparam.nit_f)])
0284 disp(['----------------------'])
0285
0286 disp(['Local calculation : j = ',num2str(Zcurr_0.x_0),'/',j_r_k,' ; P = ',num2str(ZP0_0.x_rf_fsav),'/',p_r_k,' ; j/P = ',num2str(Zcurr_0.x_0./ZP0_0.x_rf_fsav),'/',eta_r_k])
0287
0288 for remnum = 1:nrem,
0289 if ~isempty(Zcurr{remnum}),
0290 disp(['Remote calc. # ',num2str(remnum),' : j = ',num2str(Zcurr{remnum}.x_0),'/',j_r_k,' ; P = ',num2str(ZP0{remnum}.x_rf_fsav),'/',p_r_k,' ; j/P = ',num2str(Zcurr{remnum}.x_0./ZP0{remnum}.x_rf_fsav),'/',eta_r_k,luke_warning{remnum}])
0291 elseif flag_running(remnum),
0292 disp(['Remote calc. # ',num2str(remnum),' : running'])
0293 else
0294 disp(['Remote calc. # ',num2str(remnum),' : failed'])
0295 end
0296 end
0297
0298 if ~isempty(diaryname),
0299 diary off
0300 end
0301
0302
0303
0304 if remtimout == 0,
0305 if ~any(flag_running),
0306 delete(filename);
0307 else
0308 save(filename);
0309 info_dke_yp(2,['Data saved in ',filename]);
0310 end
0311 end
0312