nvidia-smi(最常用)在终端中运行:
nvidia-smi或实时刷新(每 1 秒):
watch -n 1 nvidia-smi你会看到类似:
| GPU Name | Memory-Usage | GPU-Util |
|==================+==============+==========|
| 0 NVIDIA A100 | 18GiB / 40GiB| 85% |如果你在运行 GeneFace Plus Plus 的 Python 脚本,可以直接打印显存:
import torch
print(torch.cuda.memory_allocated() / 1024**3, "GB allocated")
print(torch.cuda.memory_reserved() / 1024**3, "GB reserved")memory_allocated:实际使用的显存memory_reserved:PyTorch 向 GPU 申请的总显存gpustat(更直观)安装:
pip install gpustat查看:
gpustat -i示例输出:
[0] NVIDIA A100 | 18°C | 18GB / 40GB | 85%| 阶段 | 显存需求(参考) |
|---|---|
| 数据预处理 | 4–8 GB |
| 训练 NeRF / 3D 模型 | 16–32 GB |
| 推理(Inference) | 6–12 GB |
| 使用 FP16 / AMP | 可减少 30% 左右 |
⚠️ 实际显存与 模型分辨率、batch size、是否开启 AMP、显卡架构 强相关。
batch_size: 1with torch.cuda.amp.autocast():
...num_samples / num_importancetorch.cuda.empty_cache()如果你愿意,可以把:
发给我,我可以帮你 精确估算显存并给出最优配置。