Changeset 2226


Ignore:
Timestamp:
09/14/09 08:00:29 (16 years ago)
Author:
Mathieu Morlighem
Message:

Added time limit specified in md.waitonlock [minutes]

Location:
issm/trunk/src/m/classes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/@model/setdefaultparameters.m

    r2211 r2226  
    213213md.cluster='none';
    214214
    215 %this option can be activated (1) to load automatically the results
     215%this option can be activated to load automatically the results
    216216%onto the model after a parallel run by waiting for the lock file
    217 %that is generated once the solution has converged
    218 md.waitonlock=1;
     217%N minutes that is generated once the solution has converged
     218%0 to desactivate
     219md.waitonlock=Inf;
    219220
    220221%number of processors to be used (if parallel)
  • issm/trunk/src/m/classes/public/display/displayparallel.m

    r1277 r2226  
    1717fielddisplay(md,'time','amount of time requested on cluster');
    1818fielddisplay(md,'alloc_cleanup','allocation cleanup before starting a job, default 1');
    19 fielddisplay(md,'waitonlock','wait for batch results 1, or return 0. default is to return');
     19fielddisplay(md,'waitonlock','maximum number of minutes to wait for batch results, or return 0');
    2020fielddisplay(md,'queue','special queue name on cluster? default is '''' ');
    2121
  • issm/trunk/src/m/classes/public/solveparallel.m

    r1676 r2226  
    2626
    2727%Do we return, or just wait for results?
    28 if md.waitonlock,
     28if md.waitonlock~=0,
    2929        %we wait for the done file
    30         waitonlock([executionpath '/' md.name '.lock']);
    31         %load results
    32         displaystring(md.debug,'loading results from cluster');
    33         md=loadresultsfromcluster(md);
     30        islock=waitonlock([executionpath '/' md.name '.lock'],md.waitonlock);
     31        if islock==0,
     32                %no results to be loaded
     33                disp('The results must be loaded manually with loadmodelfromcluster.');
     34                error(['solveparallel info message: time limit exceeded'])
     35        else
     36                %load results
     37                displaystring(md.debug,'loading results from cluster');
     38                md=loadresultsfromcluster(md);
     39        end
    3440end
  • issm/trunk/src/m/classes/public/waitonlock.m

    r1 r2226  
    1 function waitonlock(filename)
     1function flag=waitonlock(filename,timelimit)
    22%WAITONLOCK - wait for a file
    33%
    44%   This routine will return when a file named 'filename' is written to disk.
     5%   If the time limit given in input is exceeded, return 0
    56%
    67%   Usage:
    7 %      waitonlock(filename)
     8%      flag=waitonlock(filename,timelimit)
    89
    9 test=0;
     10%initialize time and file presence test flag
     11time=0;
     12ispresent=0;
    1013disp(['waiting for ' filename ' hold on... (Ctrl+C to exit)'])
    11 while test==0
    12         test=exist(filename,'file');
    13         pause(1)
     14
     15%loop till file .lock exist or time is up
     16while (ispresent==0 & time<timelimit)
     17        ispresent=exist(filename,'file');
     18        pause(1);
     19        time=time+1/60;
    1420end
     21
     22%build output
     23if (time>timelimit),
     24        flag=0;
     25else
     26        flag=1;
     27end
Note: See TracChangeset for help on using the changeset viewer.