Changeset 269
- Timestamp:
- Nov 10, 2011, 5:15:48 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r268 r269 1544 1544 case 'sge' 1545 1545 % choice of batch priority: 1546 ind_answer=2;1547 1546 [s,w]=unix('qstat -q civ.q|grep job_| wc -l'); %check the waiting list (command unix) 1548 1547 if isequal(s,0) … … 1561 1560 'SelectionMode','single',... 1562 1561 'ListString',str,'ListSize',[200 100],'Name','job priority','InitialValue',3); 1563 pvalue=num2str((1-ind_answer)*500); % 1564 1562 pvalue=num2str((1-ind_answer)*500); % 1565 1563 if isequal(v,0) % to handle Cancel button and figure close, 1566 1564 errormsg='job cancelled'; … … 1569 1567 else 1570 1568 msgbox_uvmat('ERROR','sge batch system not available') 1569 return 1570 end 1571 case 'oar' 1572 [s,w]=unix('oarstat'); %check the waiting list (command unix) 1573 if ~isequal(s,0) 1574 msgbox_uvmat('ERROR','oar batch system not available') 1571 1575 return 1572 1576 end … … 1742 1746 1743 1747 super_cmd=[]; 1748 batch_file_list=[]; 1744 1749 1745 1750 for ifile=1:nbfield … … 1763 1768 end 1764 1769 [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extension) 1765 flname=fullfile(Rootbat,Filebat); 1766 if batch 1767 filename_bat=fullfile(Rootbat,['job_' Filebat]); 1768 else 1769 filename_bat=flname; 1770 end 1771 filename_bat=[filename_bat '.bat']; 1770 1771 filename_bat=[fullfile(Rootbat,Filebat) '.bat']; 1772 1772 1773 1773 %CIV1 … … 2124 2124 fprintf(fid,cmd); 2125 2125 fclose(fid); 2126 if batch 2127 switch batch_mode 2128 case 'sge' 2129 display(['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]); 2130 eval( ['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]); 2131 case 'oar' 2132 % eval( ['!chmod +x ' filename_bat]); 2133 % %eval( ['!oarsub -n CIVX -l /core=1,walltime=00:10:00 ' filename_bat]); 2134 % eval( ['!oarsub -n CIVX -l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:10:00" ' filename_bat]); 2135 2136 cmd_str=['. ' filename_bat]; 2137 super_cmd{length(super_cmd)+1}=cmd_str; 2138 2139 end 2140 else 2141 %% to lauch the jobs locally : 2142 if(isunix) 2143 cmd_str=['. ' filename_bat]; 2144 else %case of Windows 2145 cmd_str=['@call "' regexprep(filename_bat,'\\','\\\\') '"']; 2146 end 2147 super_cmd=[super_cmd cmd_str '\n']; 2148 disp(cmd_str); 2149 end 2126 2127 batch_file_list{length(batch_file_list)+1}=filename_bat; 2128 2129 % if batch 2130 % switch batch_mode 2131 % case 'sge' 2132 % display(['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]); 2133 % eval( ['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]); 2134 % case 'oar' 2135 % % eval( ['!chmod +x ' filename_bat]); 2136 % % %eval( ['!oarsub -n CIVX -l /core=1,walltime=00:10:00 ' filename_bat]); 2137 % % eval( ['!oarsub -n CIVX -l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:10:00" ' filename_bat]); 2138 % 2139 % cmd_str=['sh ' filename_bat]; 2140 % super_cmd{length(super_cmd)+1}=cmd_str; 2141 % 2142 % end 2143 % else 2144 % %% to lauch the jobs locally : 2145 % if(isunix) 2146 % cmd_str=['. ' filename_bat]; 2147 % else %case of Windows 2148 % cmd_str=['@call "' regexprep(filename_bat,'\\','\\\\') '"']; 2149 % end 2150 % super_cmd=[super_cmd cmd_str '\n']; 2151 % disp(cmd_str); 2152 % end 2150 2153 case 'Matlab' 2151 2154 drawnow … … 2232 2235 2233 2236 if batch 2234 switch batch_mode 2237 switch batch_mode 2238 case 'sge' 2239 for p=1:length(batch_file_list) 2240 cmd=['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' batch_file_list{p}]; 2241 display(cmd);eval(cmd); 2242 end 2235 2243 case 'oar' 2236 l=length(super_cmd); 2237 for p=0:floor(l/6); 2238 2239 filename_superbat=fullfile(Rootbat,['job_list_' num2str(p) '.bat']); 2244 for p=0:floor(length(batch_file_list)/6); 2245 filename_batch_group=fullfile(Rootbat,['job_list_' num2str(p) '.bat']); 2246 fid=fopen(filename_batch_group,'w'); 2247 if fid==-1 2248 msgbox_uvmat('ERROR',['cannot create the command file ' filename_superbat]) 2249 return 2250 end 2251 if p==floor(length(batch_file_list)/6) 2252 kmax=mod(length(batch_file_list),6); 2253 else 2254 kmax=6; 2255 end 2256 for k=1:kmax 2257 fprintf(fid,['sh ' batch_file_list{p*6+k} '\n']); 2258 end 2259 fclose(fid); 2260 system(['chmod +x ' filename_batch_group]); 2261 eval( ['!oarsub -n CIVX -q nicejob -l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:60:00" ' filename_batch_group]); 2262 end 2263 case 'oar_new' % to be develloped with Patrick Begou 2264 filename_joblist=fullfile(Rootbat,'job_list.txt'); 2240 2265 fid=fopen(filename_superbat,'w'); 2241 2266 if fid==-1 … … 2243 2268 return 2244 2269 end 2245 if p==floor(l/6) 2246 kmax=mod(l,6); 2247 else 2248 kmax=6; 2249 end 2250 for k=1:kmax 2251 fprintf(fid,[super_cmd{p*6+k} '\n']); 2270 for p=1:length(batch_file_list) 2271 fprintf(fid,[batch_file_list{p} '\n']); 2252 2272 end 2253 2273 fclose(fid); 2254 if(isunix) 2255 system(['chmod +x ' filename_superbat]); 2256 end 2257 2258 eval( ['!oarsub -n CIVX -q nicejob -l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:60:00" ' filename_superbat]); 2259 end 2260 end 2261 end 2262 2263 2264 if ~batch && ~isequal(CivMode,'Matlab') 2265 [Rootbat,Filebat,extbat]=fileparts(filename_bat); 2266 filename_superbat=fullfile(Rootbat,'job_list.bat'); 2267 fid=fopen(filename_superbat,'w'); 2268 if fid==-1 2269 msgbox_uvmat('ERROR',['cannot create the command file ' filename_superbat]) 2270 return 2271 end 2272 fprintf(fid,super_cmd'); 2273 fclose(fid); 2274 if(isunix) 2275 system(['chmod +x ' filename_superbat]) 2276 end 2277 system([filename_superbat ' &'])% execute main commmand 2278 end 2274 walltime=datestr(length(super_cmd)*10/24/60,13); 2275 eval( ['!oarsub -n CIVX -q nicejob -l "/core=1+{type = ''smalljob''}/licence=1,walltime=' walltime '" ' filename_superbat]); 2276 end 2277 else 2278 if ~isequal(CivMode,'Matlab') 2279 filename_superbat=fullfile(Rootbat,'job_list.bat'); 2280 fid=fopen(filename_superbat,'w'); 2281 if fid==-1 2282 msgbox_uvmat('ERROR',['cannot create the command file ' filename_superbat]) 2283 return 2284 end 2285 for p=1:length(batch_file_list) 2286 if isunix 2287 fprintf(fid,['sh ' batch_file_list{p} '\n']); 2288 else 2289 fprintf(fid,['@call "' regexprep(filename_bat,'\\','\\\\') '"' '\n']); 2290 end 2291 end 2292 fclose(fid); 2293 if(isunix) 2294 system(['chmod +x ' filename_superbat]); 2295 end 2296 system([filename_superbat ' &']);% execute main commmand 2297 end 2298 2299 end 2300 2279 2301 2280 2302 %% save interface state … … 4225 4247 % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx 4226 4248 else %Windows system 4227 flname=regexprep(flname,'\\','\\\\');4249 % flname=regexprep(flname,'\\','\\\\'); 4228 4250 % cmd=[cmd 'copy /Y "' flname '.civ1.cmx" "' flname '.cmx"\n']; 4229 filename=regexprep(filename,'\\','\\\\');4251 % filename=regexprep(filename,'\\','\\\\'); 4230 4252 cmd_CIV1=['copy /Y "' filename '.civ1.cmx" "' filename '.cmx"\n'];% copy the .civ1.cmx parameter file to .cmx 4231 4253 cmd_CIV1=['"' sparam.Civ1Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
Note: See TracChangeset
for help on using the changeset viewer.