Tidy memory info printing for OpenCL

这个提交包含在:
Craig Warren
2024-01-29 15:22:38 +00:00
父节点 489b66f397
当前提交 2f856d7d44
共有 2 个文件被更改,包括 9 次插入10 次删除

查看文件

@@ -346,12 +346,12 @@ class ModelBuildRun:
self.write_output_data() self.write_output_data()
# Print information about memory usage and solving time for a model # Print information about memory usage and solving time for a model
# Add a string on GPU memory usage if applicable # Add a string on device (GPU) memory usage if applicable
mem_str = ( mem_str = ""
f" host + ~{humanize.naturalsize(solver.memused)} GPU" if config.sim_config.general["solver"] == "cuda":
if config.sim_config.general["solver"] == "cuda" mem_str = f" host + ~{humanize.naturalsize(solver.memused)} device"
else "" elif config.sim_config.general["solver"] == "opencl":
) mem_str = f" host + unknown for device"
logger.info(f"\nMemory used (estimated): " + f"~{humanize.naturalsize(self.p.memory_full_info().uss)}{mem_str}") logger.info(f"\nMemory used (estimated): " + f"~{humanize.naturalsize(self.p.memory_full_info().uss)}{mem_str}")
logger.info( logger.info(

查看文件

@@ -1308,7 +1308,7 @@ class OpenCLUpdates:
self.event_marker1.wait() self.event_marker1.wait()
def calculate_memory_used(self, iteration): def calculate_memory_used(self, iteration):
"""Calculates memory used on last iteration. """Calculates memory used on last iteration.
Args: Args:
iteration: int for iteration number. iteration: int for iteration number.
@@ -1316,9 +1316,8 @@ class OpenCLUpdates:
Returns: Returns:
Memory (RAM) used on compute device. Memory (RAM) used on compute device.
""" """
# if iteration == self.grid.iterations - 1: # No clear way to determine memory used from PyOpenCL unlike PyCUDA.
# return self.drv.mem_get_info()[1] - self.drv.mem_get_info()[0] pass
logger.debug("Look at memory estimate for pyopencl")
def calculate_solve_time(self): def calculate_solve_time(self):
"""Calculates solving time for model.""" """Calculates solving time for model."""