Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:FMInference FlexLLMGen ExecutionEnv Close Copy Threads

From Leeroopedia


Metadata

Field Value
Repo FlexLLMGen

Domains

  • System_Management
  • Resource_Lifecycle

Overview

Concrete tool for shutting down background disk I/O threads provided by the FlexLLMGen library.

Description

ExecutionEnv.close_copy_threads() delegates to self.disk.close_copy_threads() which terminates the background thread pool used for async tensor copies to/from NVMe disk.

Usage

Call as the final step in any FlexLLMGen workflow after generation is complete.

Code Reference

Field Value
Source flexllmgen/utils.py Lines: 51-52; flexllmgen/pytorch_backend.py Lines: 682-688
Import from flexllmgen.utils import ExecutionEnv

Signature:

# In ExecutionEnv (flexllmgen/utils.py)
def close_copy_threads(self):
    self.disk.close_copy_threads()

# In TorchDisk (flexllmgen/pytorch_backend.py)
def close_copy_threads(self):
    if hasattr(self, 'copy_thread_pool'):
        self.copy_thread_pool.shutdown()

I/O Contract

Inputs:

None (called on ExecutionEnv instance)

Outputs:

None (side effect: background threads terminated, resources released)

Usage Examples

# After generation is complete
env.close_copy_threads()

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment