Exemplo n.º 1
0
    def run_model(self, campaign, runi, check_interval):
        """Execute a model from the campaign, return True if it has passed targettime"""

        tm = campaign.get_model(runi)
        targettime = campaign.get_targettime(runi)
        print('Rank {} will try to run model at index {} of campaign hash {}'.format(self.rank, runi, tm.hash), flush=True)
        now = time.time()
        driver = chaincalc.WallClockLimitedDriver(now)
        # run a chunk, but don't run past the total lifetime allowed for this process
        now_limit = min(self.wall_start +self.wall_limit_total, now +self.wall_limit_chunk) - now
        driver.runModel(tm, targettime, now_limit, check_interval)

        tm2 = campaign.get_model(runi)
        tm2.get_status()
        if tm2.status['sim.t'] >= targettime:
            print('Run is evolved past targettime', flush=True)
            self.targettime_hook(tm2)
            return True
        elif tm2.status['status'] == 'stop collision':
            print('Run stopped on collision', flush=True)
            return True
        elif tm2.status['lock']:
            return True
        else:
            return False
Exemplo n.º 2
0
import time
import rebound
import chaincalc

wall_start = time.time()

wall_limit = 25

from testcampaign import *

#Now have name col from testcampaign

runi = int(sys.argv[1])
print('Will try to run model at index {} of testcampaign'.format(runi))

tm = col.get_model(runi)

print('hash is ',tm.hash)

driver = chaincalc.WallClockLimitedDriver(wall_start, verbose=True)

driver.runModel(tm, targettime, wall_limit, 100*keplertime)

tm2 = col.get_model(runi)
tm2.get_status()
print('Status from disc is ',tm2.status['status'])
if tm2.status['sim.t'] >= targettime:
  print('Run is evolved past targettime')


Exemplo n.º 3
0
# three days minus a bit on apocrita
wall_limit = 72 * 60 * 60 - 15 * 60

from campaign001 import *

#Now have name col from campaign001
col = Campaign001()
print('Campaign has {} models'.format(col.get_size()))

# Job array indexes start at 1 not 0
runi = int(sys.argv[1]) - 1
print('Will try to run model at index {} of campaign001'.format(runi))

print(
    'Wallclock checkpoint interval is {} seconds'.format(wall_check_interval))

tm = col.get_model(runi)

print('hash is ', tm.hash)

driver = chaincalc.WallClockLimitedDriver(wall_start)

driver.runModel(tm, targettime, wall_limit, 100 * keplertime)

tm2 = col.get_model(runi)
tm2.get_status()
print('On exit, status from disc is ', tm2.status['status'])
if tm2.status['sim.t'] >= targettime:
    print('Run is evolved past targettime')