gpu
#
GPU memory management utilities.
Functions:
-
cleanup_simulation–Clean up OpenMM simulation and free GPU memory.
cleanup_simulation
#
Clean up OpenMM simulation and free GPU memory.
This function properly releases GPU resources by deleting the simulation and integrator objects, synchronizing CUDA operations, and emptying the GPU cache. The synchronization step is critical - without it, the cache may be cleared while GPU operations are still in flight.
Parameters:
-
simulation(Simulation) –The OpenMM simulation object to clean up.
-
integrator(Integrator | None, default:None) –The integrator object to clean up. If None, only the simulation is deleted.
Examples:
>>> integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 2*femtoseconds)
>>> simulation = Simulation(topology, system, integrator)
>>> # ... use simulation ...
>>> cleanup_simulation(simulation, integrator)