-
-
Save braingineer/45ab989060e036cefda5894c2bf426cc to your computer and use it in GitHub Desktop.
trying to remove models from GPU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"import torch" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Mon Nov 6 13:10:49 2017 \r\n", | |
"+-----------------------------------------------------------------------------+\r\n", | |
"| NVIDIA-SMI 384.90 Driver Version: 384.90 |\r\n", | |
"|-------------------------------+----------------------+----------------------+\r\n", | |
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\r\n", | |
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\r\n", | |
"|===============================+======================+======================|\r\n", | |
"| 0 GeForce GTX TIT... Off | 00000000:4B:00.0 Off | N/A |\r\n", | |
"| 27% 63C P8 20W / 250W | 603MiB / 12207MiB | 0% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 1 GeForce GTX TIT... Off | 00000000:4C:00.0 Off | N/A |\r\n", | |
"| 45% 81C P2 131W / 250W | 4879MiB / 12207MiB | 57% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 2 GeForce GTX TIT... Off | 00000000:4D:00.0 Off | N/A |\r\n", | |
"| 39% 80C P2 100W / 250W | 4686MiB / 12207MiB | 31% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 3 GeForce GTX TIT... Off | 00000000:4E:00.0 Off | N/A |\r\n", | |
"| 54% 83C P2 142W / 250W | 4598MiB / 12205MiB | 83% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
" \r\n", | |
"+-----------------------------------------------------------------------------+\r\n", | |
"| Processes: GPU Memory |\r\n", | |
"| GPU PID Type Process name Usage |\r\n", | |
"|=============================================================================|\r\n", | |
"| 0 6999 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\r\n", | |
"| 0 25616 C python 311MiB |\r\n", | |
"| 1 6999 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\r\n", | |
"| 1 25649 C ...rian/anaconda3/envs/py3torch/bin/python 4587MiB |\r\n", | |
"| 2 25650 C ...rian/anaconda3/envs/py3torch/bin/python 4675MiB |\r\n", | |
"| 3 25651 C ...rian/anaconda3/envs/py3torch/bin/python 4587MiB |\r\n", | |
"+-----------------------------------------------------------------------------+\r\n" | |
] | |
} | |
], | |
"source": [ | |
"!nvidia-smi" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"model = torch.nn.Sequential(*[torch.nn.Conv2d(1,1,1) for _ in range(100)])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"200" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"sum([p.numel() for p in model.parameters()])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Mon Nov 6 13:11:45 2017 \n", | |
"+-----------------------------------------------------------------------------+\n", | |
"| NVIDIA-SMI 384.90 Driver Version: 384.90 |\n", | |
"|-------------------------------+----------------------+----------------------+\n", | |
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n", | |
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n", | |
"|===============================+======================+======================|\n", | |
"| 0 GeForce GTX TIT... Off | 00000000:4B:00.0 Off | N/A |\n", | |
"| 26% 63C P8 20W / 250W | 603MiB / 12207MiB | 0% Default |\n", | |
"+-------------------------------+----------------------+----------------------+\n", | |
"| 1 GeForce GTX TIT... Off | 00000000:4C:00.0 Off | N/A |\n", | |
"| 45% 83C P2 206W / 250W | 4879MiB / 12207MiB | 91% Default |\n", | |
"+-------------------------------+----------------------+----------------------+\n", | |
"| 2 GeForce GTX TIT... Off | 00000000:4D:00.0 Off | N/A |\n", | |
"| 39% 76C P8 21W / 250W | 11MiB / 12207MiB | 0% Default |\n", | |
"+-------------------------------+----------------------+----------------------+\n", | |
"| 3 GeForce GTX TIT... Off | 00000000:4E:00.0 Off | N/A |\n", | |
"| 54% 82C P2 91W / 250W | 4598MiB / 12205MiB | 66% Default |\n", | |
"+-------------------------------+----------------------+----------------------+\n", | |
" \n", | |
"+-----------------------------------------------------------------------------+\n", | |
"| Processes: GPU Memory |\n", | |
"| GPU PID Type Process name Usage |\n", | |
"|=============================================================================|\n", | |
"| 0 6999 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\n", | |
"| 0 25616 C python 311MiB |\n", | |
"| 1 6999 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\n", | |
"| 1 25649 C ...rian/anaconda3/envs/py3torch/bin/python 4587MiB |\n", | |
"| 3 25651 C ...rian/anaconda3/envs/py3torch/bin/python 4587MiB |\n", | |
"+-----------------------------------------------------------------------------+\n" | |
] | |
} | |
], | |
"source": [ | |
"!nvidia-smi" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"with torch.cuda.device(0):\n", | |
" model = model.cuda()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Mon Nov 6 13:12:05 2017 \r\n", | |
"+-----------------------------------------------------------------------------+\r\n", | |
"| NVIDIA-SMI 384.90 Driver Version: 384.90 |\r\n", | |
"|-------------------------------+----------------------+----------------------+\r\n", | |
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\r\n", | |
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\r\n", | |
"|===============================+======================+======================|\r\n", | |
"| 0 GeForce GTX TIT... Off | 00000000:4B:00.0 Off | N/A |\r\n", | |
"| 26% 66C P2 74W / 250W | 886MiB / 12207MiB | 0% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 1 GeForce GTX TIT... Off | 00000000:4C:00.0 Off | N/A |\r\n", | |
"| 46% 81C P2 120W / 250W | 4879MiB / 12207MiB | 46% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 2 GeForce GTX TIT... Off | 00000000:4D:00.0 Off | N/A |\r\n", | |
"| 38% 72C P8 20W / 250W | 11MiB / 12207MiB | 0% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 3 GeForce GTX TIT... Off | 00000000:4E:00.0 Off | N/A |\r\n", | |
"| 54% 82C P2 93W / 250W | 4598MiB / 12205MiB | 42% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
" \r\n", | |
"+-----------------------------------------------------------------------------+\r\n", | |
"| Processes: GPU Memory |\r\n", | |
"| GPU PID Type Process name Usage |\r\n", | |
"|=============================================================================|\r\n", | |
"| 0 6999 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\r\n", | |
"| 0 25616 C python 311MiB |\r\n", | |
"| 0 29424 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\r\n", | |
"| 1 6999 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\r\n", | |
"| 1 25649 C ...rian/anaconda3/envs/py3torch/bin/python 4587MiB |\r\n", | |
"| 3 25651 C ...rian/anaconda3/envs/py3torch/bin/python 4587MiB |\r\n", | |
"+-----------------------------------------------------------------------------+\r\n" | |
] | |
} | |
], | |
"source": [ | |
"!nvidia-smi" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"del model" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Mon Nov 6 13:12:27 2017 \r\n", | |
"+-----------------------------------------------------------------------------+\r\n", | |
"| NVIDIA-SMI 384.90 Driver Version: 384.90 |\r\n", | |
"|-------------------------------+----------------------+----------------------+\r\n", | |
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\r\n", | |
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\r\n", | |
"|===============================+======================+======================|\r\n", | |
"| 0 GeForce GTX TIT... Off | 00000000:4B:00.0 Off | N/A |\r\n", | |
"| 27% 67C P8 20W / 250W | 886MiB / 12207MiB | 0% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 1 GeForce GTX TIT... Off | 00000000:4C:00.0 Off | N/A |\r\n", | |
"| 46% 81C P2 125W / 250W | 4879MiB / 12207MiB | 99% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 2 GeForce GTX TIT... Off | 00000000:4D:00.0 Off | N/A |\r\n", | |
"| 36% 69C P8 20W / 250W | 11MiB / 12207MiB | 0% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
"| 3 GeForce GTX TIT... Off | 00000000:4E:00.0 Off | N/A |\r\n", | |
"| 54% 84C P2 161W / 250W | 4598MiB / 12205MiB | 70% Default |\r\n", | |
"+-------------------------------+----------------------+----------------------+\r\n", | |
" \r\n", | |
"+-----------------------------------------------------------------------------+\r\n", | |
"| Processes: GPU Memory |\r\n", | |
"| GPU PID Type Process name Usage |\r\n", | |
"|=============================================================================|\r\n", | |
"| 0 6999 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\r\n", | |
"| 0 25616 C python 311MiB |\r\n", | |
"| 0 29424 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\r\n", | |
"| 1 6999 C ...rian/anaconda3/envs/py3torch/bin/python 280MiB |\r\n", | |
"| 1 25649 C ...rian/anaconda3/envs/py3torch/bin/python 4587MiB |\r\n", | |
"| 3 25651 C ...rian/anaconda3/envs/py3torch/bin/python 4587MiB |\r\n", | |
"+-----------------------------------------------------------------------------+\r\n" | |
] | |
} | |
], | |
"source": [ | |
"!nvidia-smi" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "py3torch", | |
"language": "python", | |
"name": "py3torch" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.1" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment