{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "53fb9dcb-843b-4633-b031-22236bfeb815",
   "metadata": {},
   "source": [
    "### Check CUDA device"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "6b269e64-be58-43b5-ad60-0fbd1d37861a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CUDA is available. Number of GPUs: 1\n",
      "GPU Name: NVIDIA GeForce RTX 3060\n"
     ]
    }
   ],
   "source": [
    "import torch\n",
    "\n",
    "# Check if CUDA is available\n",
    "if torch.cuda.is_available():\n",
    "    print(f\"CUDA is available. Number of GPUs: {torch.cuda.device_count()}\")\n",
    "    print(f\"GPU Name: {torch.cuda.get_device_name(0)}\")\n",
    "else:\n",
    "    print(\"CUDA is not available. No GPU detected.\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e6b4bc89-4cbd-4d4a-99a8-2d5bfb5d095d",
   "metadata": {},
   "source": [
    "### Environment"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "7313a620-a0eb-4207-a12a-90aeee3cd980",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0]',\n",
       " environ{'PATH': '/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',\n",
       "         'HOSTNAME': '6c24ffc52409',\n",
       "         'JUPYTER_ENABLE_LAB': 'yes',\n",
       "         'PYTHONPATH': '/cvtt/prod',\n",
       "         'NVIDIA_VISIBLE_DEVICES': 'all',\n",
       "         'NVIDIA_DRIVER_CAPABILITIES': 'compute,utility',\n",
       "         'LD_LIBRARY_PATH': '/usr/local/nvidia/lib:/usr/local/nvidia/lib64',\n",
       "         'PYTORCH_VERSION': '2.2.1',\n",
       "         'HOME': '/root',\n",
       "         'LC_CTYPE': 'C.UTF-8',\n",
       "         'JPY_SESSION_NAME': '/workspace/Testing GPU.ipynb',\n",
       "         'JPY_PARENT_PID': '1',\n",
       "         'PYDEVD_USE_FRAME_EVAL': 'NO',\n",
       "         'TERM': 'xterm-color',\n",
       "         'CLICOLOR': '1',\n",
       "         'FORCE_COLOR': '1',\n",
       "         'CLICOLOR_FORCE': '1',\n",
       "         'PAGER': 'cat',\n",
       "         'GIT_PAGER': 'cat',\n",
       "         'MPLBACKEND': 'module://matplotlib_inline.backend_inline',\n",
       "         'CUDA_MODULE_LOADING': 'LAZY'})"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sys\n",
    "sys.version,os.environ"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "943ac637-42c7-4a69-a6c4-94c382e22653",
   "metadata": {},
   "source": [
    "### Test packages availability"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "95d9a2e6-3464-4dbe-9a97-0c2d5eb34193",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "import matplotlib\n",
    "import plotly\n",
    "\n",
    "import cvttpy.tools.timeutils as tu\n",
    "\n",
    "import autogluon\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "566016ad-3f13-4a61-b460-39738ae3bf4c",
   "metadata": {},
   "source": [
    "### Jupyter widgets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "eb38de31-fc19-4515-b08d-9cd7607ea958",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "2b2a98cdd61d477b811279a6753630a2",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "interactive(children=(IntSlider(value=5, description='x', max=10), Output()), _dom_classes=('widget-interact',…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "1717721060059418080"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import ipywidgets\n",
    "from ipywidgets import interact, IntSlider\n",
    "import cvttpy.tools.timeutils as tu\n",
    "\n",
    "def f(x):\n",
    "    return x\n",
    "\n",
    "interact(f, x=IntSlider(min=0, max=10, step=1, value=5))\n",
    "print(\"Done\")\n",
    "tu.current_nanoseconds()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f46e46a7-9b57-44aa-9bc9-dcbcf643bc88",
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip freeze | grep jupyter"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "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.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
