Metadata-Version: 2.4
Name: occgpu
Version: 0.1.0
Summary: A tool to occupy free GPU memory and prevent others from using it
Home-page: https://github.com/howccc/occgpu
Author: Three Liu
Author-email: liushurui66666@example.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Unix
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: numpy
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# occgpu: Occupy Free GPU Memory

**Prevent others from using idle GPUs by automatically occupying their free memory.**  
Perfect for researchers or engineers who want to reserve GPU resources in shared environments (e.g., lab servers, cloud clusters).


---

## 🚀 Features

- ✅ **Auto-detect free GPUs** – Uses `nvidia-smi` to find GPUs with high free memory.
- ✅ **Configurable threshold** – Only target GPUs where `free_memory / total_memory > proportion`.
- ✅ **Multi-GPU support** – Can occupy multiple GPUs simultaneously.
- ✅ **Framework fallback** – Supports both **PyTorch** and **TensorFlow** (falls back if one is missing).
- ✅ **Command-line & environment variables** – Flexible configuration via CLI or `$OCCGPU_PROPORTION`, `$OCCGPU_GPU_NUMS`.
- ✅ **Safe cleanup** – Gracefully terminates processes on exit (`Ctrl+C` supported).
- ✅ **Lightweight & standalone** – No database or external services required.

---

## 📦 Installation & Usage

```bash
# Clone the repo
git clone https://github.com/howccc/occgpu.git
cd occgpu

# Install in development mode
pip install -e .

# Environment Variable Configuration
export OCCGPU_N = <NUMBERS>
export OCCGPU_P = <Proportion>

occgpu

# or configure through the CLI(priorest)

occgpu -p <PROPORTION> -n <NUMBERS>
