Skip to content

Instantly share code, notes, and snippets.

@sparticlesteve
Created September 4, 2020 23:49
Show Gist options
  • Save sparticlesteve/762bea0edbf8050e9ba78952789fea1e to your computer and use it in GitHub Desktop.
Save sparticlesteve/762bea0edbf8050e9ba78952789fea1e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Basic test of a PyTorch Jupyter kernel"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Currently Loaded Modulefiles:\n",
" 1) modules/3.2.11.4\n",
" 2) altd/2.0\n",
" 3) darshan/3.1.7\n",
" 4) intel/19.0.3.199\n",
" 5) craype-network-aries\n",
" 6) craype/2.6.2\n",
" 7) udreg/2.3.2-7.0.1.1_3.33__g8175d3d.ari\n",
" 8) ugni/6.0.14.0-7.0.1.1_7.35__ge78e5b0.ari\n",
" 9) pmi/5.0.14\n",
" 10) dmapp/7.1.1-7.0.1.1_4.49__g38cf134.ari\n",
" 11) gni-headers/5.0.12.0-7.0.1.1_6.29__g3b1768f.ari\n",
" 12) xpmem/2.2.20-7.0.1.1_4.11__g0475745.ari\n",
" 13) job/2.2.4-7.0.1.1_3.37__g36b56f4.ari\n",
" 14) dvs/2.12_2.2.157-7.0.1.1_9.2__g083131db\n",
" 15) alps/6.6.58-7.0.1.1_6.5__g437d88db.ari\n",
" 16) rca/2.2.20-7.0.1.1_4.48__g8e3fb5b.ari\n",
" 17) PrgEnv-intel/6.0.5\n",
" 18) craype-haswell\n",
" 19) cray-mpich/7.7.10\n",
" 20) pytorch/v1.4.0\n"
]
}
],
"source": [
"! module list"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/global/homes/s/sfarrell/.local/cori/pytorchv1.4.0\n"
]
}
],
"source": [
"! echo $PYTHONUSERBASE"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Package Version \n",
"--------------------------- -------------------\n",
"absl-py 0.9.0 \n",
"aiohttp 3.6.2 \n",
"async-timeout 3.0.1 \n",
"attrs 19.3.0 \n",
"backcall 0.1.0 \n",
"beautifulsoup4 4.9.0 \n",
"bleach 3.1.0 \n",
"cachetools 4.0.0 \n",
"certifi 2019.11.28 \n",
"cffi 1.13.2 \n",
"chardet 3.0.4 \n",
"click 7.1.1 \n",
"colorama 0.4.3 \n",
"configparser 5.0.0 \n",
"cycler 0.10.0 \n",
"decorator 4.4.1 \n",
"defusedxml 0.6.0 \n",
"dl-comm 19.6.1 \n",
"docker-pycreds 0.4.0 \n",
"entrypoints 0.3 \n",
"filelock 3.0.12 \n",
"gitdb 4.0.5 \n",
"GitPython 3.1.3 \n",
"google 2.0.3 \n",
"google-auth 1.11.0 \n",
"google-auth-oauthlib 0.4.1 \n",
"googledrivedownloader 0.4 \n",
"gql 0.2.0 \n",
"graphql-core 1.1 \n",
"grpcio 1.26.0 \n",
"h5py 2.10.0 \n",
"idna 2.8 \n",
"importlib-metadata 1.5.0 \n",
"inflect 4.0.0 \n",
"ipykernel 5.1.4 \n",
"ipympl 0.4.1 \n",
"ipython 7.11.1 \n",
"ipython-genutils 0.2.0 \n",
"ipywidgets 7.5.1 \n",
"isodate 0.6.0 \n",
"jaraco.itertools 5.0.0 \n",
"jedi 0.16.0 \n",
"Jinja2 2.11.1 \n",
"joblib 0.14.1 \n",
"jsonschema 3.2.0 \n",
"jupyter-client 5.3.4 \n",
"jupyter-core 4.6.1 \n",
"kiwisolver 1.1.0 \n",
"Markdown 3.1.1 \n",
"MarkupSafe 1.1.1 \n",
"matplotlib 3.1.2 \n",
"mistune 0.8.4 \n",
"mkl-fft 1.0.15 \n",
"mkl-random 1.1.0 \n",
"mkl-service 2.3.0 \n",
"more-itertools 8.2.0 \n",
"multidict 4.7.5 \n",
"nbconvert 5.6.1 \n",
"nbformat 5.0.4 \n",
"networkx 2.4 \n",
"notebook 6.0.3 \n",
"numpy 1.18.1 \n",
"nvidia-ml-py3 7.352.0 \n",
"oauthlib 3.1.0 \n",
"olefile 0.46 \n",
"pandas 1.0.0 \n",
"pandocfilters 1.4.2 \n",
"parso 0.6.0 \n",
"pathtools 0.1.2 \n",
"pexpect 4.8.0 \n",
"pickleshare 0.7.5 \n",
"Pillow 7.0.0 \n",
"pip 20.0.2 \n",
"plyfile 0.7.1 \n",
"prometheus-client 0.7.1 \n",
"promise 2.3 \n",
"prompt-toolkit 3.0.3 \n",
"protobuf 3.11.3 \n",
"psutil 5.7.0 \n",
"ptyprocess 0.6.0 \n",
"py-spy 0.3.3 \n",
"pyasn1 0.4.8 \n",
"pyasn1-modules 0.2.8 \n",
"pycparser 2.19 \n",
"Pygments 2.5.2 \n",
"pyparsing 2.4.6 \n",
"pyrsistent 0.15.7 \n",
"python-dateutil 2.8.1 \n",
"python3-nersc-customs 0.2.0 \n",
"python3-nersc-modster 0.2.0 \n",
"python3-nersc-sitecustomize 0.2.0 \n",
"python3-nerscjson 0.9 \n",
"pytz 2019.3 \n",
"PyYAML 5.2 \n",
"pyzmq 18.1.0 \n",
"ray 0.8.4 \n",
"rdflib 4.2.2 \n",
"redis 3.4.1 \n",
"requests 2.22.0 \n",
"requests-oauthlib 1.3.0 \n",
"rsa 4.0 \n",
"scikit-learn 0.22.1 \n",
"scipy 1.3.2 \n",
"Send2Trash 1.5.0 \n",
"sentry-sdk 0.16.0 \n",
"setuptools 45.1.0.post20200127\n",
"shortuuid 1.0.1 \n",
"six 1.14.0 \n",
"smmap 3.0.4 \n",
"soupsieve 2.0 \n",
"subprocess32 3.5.4 \n",
"tensorboard 2.1.0 \n",
"terminado 0.8.3 \n",
"testpath 0.4.4 \n",
"torch 1.4.0 \n",
"torch-cluster 1.4.5 \n",
"torch-geometric 1.3.2 \n",
"torch-scatter 1.4.0 \n",
"torch-sparse 0.4.3 \n",
"torchvision 0.5.0a0+85b8fbf \n",
"tornado 6.0.3 \n",
"trackml 3 \n",
"traitlets 4.3.3 \n",
"typing 3.6.4 \n",
"urllib3 1.25.8 \n",
"wandb 0.9.2 \n",
"watchdog 0.10.3 \n",
"wcwidth 0.1.7 \n",
"webencodings 0.5.1 \n",
"Werkzeug 0.16.1 \n",
"wheel 0.34.1 \n",
"widgetsnbextension 3.5.1 \n",
"yarl 1.4.2 \n",
"zipp 2.1.0 \n"
]
}
],
"source": [
"! pip list"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['/global/u2/s/sfarrell',\n",
" '',\n",
" '/opt/mods/lib/python3.6/site-packages',\n",
" '/opt/ovis/lib/python2.7/site-packages',\n",
" '/usr/common/software/pytorch/v1.4.0/lib/python37.zip',\n",
" '/usr/common/software/pytorch/v1.4.0/lib/python3.7',\n",
" '/usr/common/software/pytorch/v1.4.0/lib/python3.7/lib-dynload',\n",
" '/global/homes/s/sfarrell/.local/cori/pytorchv1.4.0/lib/python3.7/site-packages',\n",
" '/usr/common/software/pytorch/v1.4.0/lib/python3.7/site-packages',\n",
" '/usr/common/software/pytorch/v1.4.0/lib/python3.7/site-packages/torchvision-0.5.0a0+85b8fbf-py3.7-linux-x86_64.egg',\n",
" '/usr/common/software/pytorch/v1.4.0/lib/python3.7/site-packages/IPython/extensions',\n",
" '/global/u2/s/sfarrell/.ipython']"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import sys\n",
"sys.path"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<module 'torch' from '/usr/common/software/pytorch/v1.4.0/lib/python3.7/site-packages/torch/__init__.py'>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"torch"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'1.4.0'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"torch.__version__"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## GPU tests\n",
"\n",
"Relevant for GPU kernels"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"torch.has_cuda"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"torch.cuda.is_available()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"torch.cuda.device_count()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/usr/bin/sh: nvidia-smi: command not found\n"
]
}
],
"source": [
"!nvidia-smi"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "pytorch-v1.4.0",
"language": "python",
"name": "pytorch-v1.4.0"
},
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment