|
|
|
@ -78,6 +78,7 @@ class Log:
@@ -78,6 +78,7 @@ class Log:
|
|
|
|
|
"""A very simple logger that formats the messages with the number of seconds since |
|
|
|
|
program start. |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
|
self.start = time.perf_counter() |
|
|
|
|
self.logfile = None |
|
|
|
@ -85,6 +86,13 @@ class Log:
@@ -85,6 +86,13 @@ class Log:
|
|
|
|
|
After each write, ``flush()`` is called as well. |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
def __getstate__(self): |
|
|
|
|
return {'elapsed': time.perf_counter() - self.start} |
|
|
|
|
|
|
|
|
|
def __setstate__(self, state): |
|
|
|
|
self.logfile = None |
|
|
|
|
self.start = time.perf_counter() - state['elapsed'] |
|
|
|
|
|
|
|
|
|
def log(self, level, message): |
|
|
|
|
t = time.perf_counter() - self.start |
|
|
|
|
if self.logfile is None: |
|
|
|
@ -120,7 +128,8 @@ class Log:
@@ -120,7 +128,8 @@ class Log:
|
|
|
|
|
elapsed_time = current_time - start_time |
|
|
|
|
total_time = elapsed_time / done |
|
|
|
|
rem_time = total_time - elapsed_time |
|
|
|
|
self.log(':', f'{done*100:.0f}% done {hr_time(elapsed_time)} elapsed {hr_time(rem_time)} remaining') |
|
|
|
|
self.log( |
|
|
|
|
':', f'{done*100:.0f}% done {hr_time(elapsed_time)} elapsed {hr_time(rem_time)} remaining') |
|
|
|
|
log_interval = min(600, int(log_interval*1.5)) |
|
|
|
|
lastlog_time = current_time |
|
|
|
|
|
|
|
|
@ -167,8 +176,10 @@ class MockCuda:
@@ -167,8 +176,10 @@ class MockCuda:
|
|
|
|
|
for grid_y in range(grid_dim[1]): |
|
|
|
|
for block_x in range(block_dim[0]): |
|
|
|
|
for block_y in range(block_dim[1]): |
|
|
|
|
outer.x = grid_x * block_dim[0] + block_x |
|
|
|
|
outer.y = grid_y * block_dim[1] + block_y |
|
|
|
|
outer.x = grid_x * \ |
|
|
|
|
block_dim[0] + block_x |
|
|
|
|
outer.y = grid_y * \ |
|
|
|
|
block_dim[1] + block_y |
|
|
|
|
self.func(*args, **kwargs) |
|
|
|
|
return inner |
|
|
|
|
return Launcher(func) |
|
|
|
|