diff --git a/.build/Dockerfile b/.build/Dockerfile index bd89ef3..dd07a47 100755 --- a/.build/Dockerfile +++ b/.build/Dockerfile @@ -496,12 +496,12 @@ RUN set -ex \ jupyterlab-git==0.50.0 \ # install plotly extension plotly==5.20.0 \ - # install drawio and graphical extensions - ipydrawio==1.3.0 \ + # install drawio and graphical extensions, not compatible with Jupyterlab 4.X yet + # ipydrawio==1.3.0 \ ipyleaflet==0.18.2 \ ipywidgets==8.1.2 \ # install spell checker - jupyterlab-spellchecker==0.7.3 \ + jupyterlab-spellchecker==0.8.4 \ ' \ && pip install --no-cache-dir $buildDeps \ && fix-permissions "${CONDA_DIR}" \ diff --git a/custom/usefulpackages.Dockerfile b/custom/usefulpackages.Dockerfile index e2262fe..d7d2727 100644 --- a/custom/usefulpackages.Dockerfile +++ b/custom/usefulpackages.Dockerfile @@ -36,12 +36,12 @@ RUN set -ex \ jupyterlab-git==0.50.0 \ # install plotly extension plotly==5.20.0 \ - # install drawio and graphical extensions - ipydrawio==1.3.0 \ + # install drawio and graphical extensions, not compatible with Jupyterlab 4.X yet + # ipydrawio==1.3.0 \ ipyleaflet==0.18.2 \ ipywidgets==8.1.2 \ # install spell checker - jupyterlab-spellchecker==0.7.3 \ + jupyterlab-spellchecker==0.8.4 \ ' \ && pip install --no-cache-dir $buildDeps \ && fix-permissions "${CONDA_DIR}" \ diff --git a/extra/Getting_Started/GPU-processing.ipynb b/extra/Getting_Started/GPU-processing.ipynb index 0d293ef..2a43bda 100755 --- a/extra/Getting_Started/GPU-processing.ipynb +++ b/extra/Getting_Started/GPU-processing.ipynb @@ -9,6 +9,36 @@ "This Jupyterlab Instance is connected to the GPU via CUDA drivers. In this notebook, we test the installation and perform some basic operations on the GPU." ] }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selected Jupyter core packages...\n", + "IPython : 8.22.2\n", + "ipykernel : 6.29.3\n", + "ipywidgets : 8.1.2\n", + "jupyter_client : 8.6.1\n", + "jupyter_core : 5.7.2\n", + "jupyter_server : 2.13.0\n", + "jupyterlab : 4.1.5\n", + "nbclient : 0.10.0\n", + "nbconvert : 7.16.3\n", + "nbformat : 5.10.4\n", + "notebook : 7.1.2\n", + "qtconsole : not installed\n", + "traitlets : 5.14.2\n" + ] + } + ], + "source": [ + "!jupyter --version" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -20,14 +50,14 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Mon Apr 8 16:12:04 2024 \n", + "Tue Apr 9 08:07:24 2024 \n", "+---------------------------------------------------------------------------------------+\n", "| NVIDIA-SMI 545.23.05 Driver Version: 545.84 CUDA Version: 12.3 |\n", "|-----------------------------------------+----------------------+----------------------+\n", @@ -36,7 +66,7 @@ "| | | MIG M. |\n", "|=========================================+======================+======================|\n", "| 0 NVIDIA GeForce RTX 3060 ... On | 00000000:01:00.0 Off | N/A |\n", - "| N/A 39C P8 10W / 60W | 105MiB / 6144MiB | 0% Default |\n", + "| N/A 38C P8 10W / 60W | 0MiB / 6144MiB | 0% Default |\n", "| | | N/A |\n", "+-----------------------------------------+----------------------+----------------------+\n", " \n", @@ -63,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -76,14 +106,14 @@ { "data": { "text/plain": [ - "tensor([[0.3820, 0.9186, 0.0873],\n", - " [0.0677, 0.3465, 0.2376],\n", - " [0.3284, 0.1974, 0.0858],\n", - " [0.6180, 0.1698, 0.6550],\n", - " [0.8948, 0.0876, 0.5775]])" + "tensor([[0.3254, 0.9917, 0.7786],\n", + " [0.5244, 0.4340, 0.8261],\n", + " [0.7216, 0.0024, 0.3113],\n", + " [0.8638, 0.6087, 0.6495],\n", + " [0.2394, 0.2831, 0.6866]])" ] }, - "execution_count": 2, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -108,16 +138,16 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "2024-04-08 16:12:05.608277: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n", + "2024-04-09 08:07:27.416927: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n", "To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n", - "2024-04-08 16:12:06.372910: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n" + "2024-04-09 08:07:28.663739: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n" ] }, { @@ -130,7 +160,7 @@ "memory_limit: 268435456\n", "locality {\n", "}\n", - "incarnation: 5065807306722951698\n", + "incarnation: 7894643083535347790\n", "xla_global_id: -1\n", ", name: \"/device:GPU:0\"\n", "device_type: \"GPU\"\n", @@ -140,7 +170,7 @@ " links {\n", " }\n", "}\n", - "incarnation: 18240998582538193189\n", + "incarnation: 9669600989926253149\n", "physical_device_desc: \"device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6\"\n", "xla_global_id: 416903419\n", "]\n" @@ -150,26 +180,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "2024-04-08 16:12:07.257260: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.258537: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.258578: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.261418: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.261470: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.261499: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.390214: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.390277: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.390289: I tensorflow/core/common_runtime/gpu/gpu_device.cc:2019] Could not identify NUMA node of platform GPU id 0, defaulting to 0. Your kernel may not have been built with NUMA support.\n", - "2024-04-08 16:12:07.390324: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.390350: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1928] Created device /device:GPU:0 with 3600 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6\n" + "2024-04-09 08:07:30.376208: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1928] Created device /device:GPU:0 with 3600 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6\n" ] } ], @@ -184,7 +195,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": { "tags": [] }, @@ -193,27 +204,16 @@ "name": "stderr", "output_type": "stream", "text": [ - "2024-04-08 16:12:07.398413: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.398507: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.398537: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.398712: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.398727: I tensorflow/core/common_runtime/gpu/gpu_device.cc:2019] Could not identify NUMA node of platform GPU id 0, defaulting to 0. Your kernel may not have been built with NUMA support.\n", - "2024-04-08 16:12:07.398755: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node\n", - "Your kernel may have been built without NUMA support.\n", - "2024-04-08 16:12:07.398769: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1928] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3600 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6\n" + "2024-04-09 08:07:30.385786: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1928] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3600 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3060 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6\n" ] }, { "data": { "text/plain": [ - "24.57181" + "25.202852" ] }, - "execution_count": 4, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -255,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -264,14 +264,14 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "666 ms ± 75.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" + "973 ms ± 151 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" ] } ], @@ -289,7 +289,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -298,14 +298,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "275 ms ± 12.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" + "290 ms ± 44.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" ] } ], @@ -324,23 +324,23 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "tensor([[0.3950, 0.1953, 0.3265, 0.5156, 0.5355],\n", - " [0.2038, 0.3776, 0.9295, 0.4246, 0.4888],\n", - " [0.4108, 0.8438, 0.9092, 0.9224, 0.2784],\n", - " [0.6929, 0.9316, 0.6724, 0.0748, 0.4366],\n", - " [0.4430, 0.9733, 0.1734, 0.9995, 0.0928]], device='cuda:0')\n", - "tensor([[0.3950, 0.1953, 0.3265, 0.5156, 0.5355],\n", - " [0.2038, 0.3776, 0.9295, 0.4246, 0.4888],\n", - " [0.4108, 0.8438, 0.9092, 0.9224, 0.2784],\n", - " [0.6929, 0.9316, 0.6724, 0.0748, 0.4366],\n", - " [0.4430, 0.9733, 0.1734, 0.9995, 0.0928]], dtype=torch.float64)\n" + "tensor([[0.3845, 0.0880, 0.5156, 0.4110, 0.5014],\n", + " [0.7350, 0.1050, 0.2858, 0.1222, 0.2921],\n", + " [0.3644, 0.0735, 0.8485, 0.8745, 0.8900],\n", + " [0.8959, 0.6109, 0.7280, 0.2928, 0.9440],\n", + " [0.0158, 0.1069, 0.9924, 0.0682, 0.6148]], device='cuda:0')\n", + "tensor([[0.3845, 0.0880, 0.5156, 0.4110, 0.5014],\n", + " [0.7350, 0.1050, 0.2858, 0.1222, 0.2921],\n", + " [0.3644, 0.0735, 0.8485, 0.8745, 0.8900],\n", + " [0.8959, 0.6109, 0.7280, 0.2928, 0.9440],\n", + " [0.0158, 0.1069, 0.9924, 0.0682, 0.6148]], dtype=torch.float64)\n" ] } ], @@ -357,14 +357,14 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "55.3 ms ± 161 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" + "51.4 ms ± 121 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" ] } ], @@ -374,117 +374,6 @@ "H = x.mm( (x.t().mm(x)).inverse() ).mm(x.t())" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exhaustive Testing on GPU" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [], - "source": [ - "# let us run this cell only if CUDA is available\n", - "# We will use ``torch.device`` objects to move tensors in and out of GPU\n", - "import torch\n", - "if torch.cuda.is_available():\n", - " device = torch.device(\"cuda\") # a CUDA device object\n", - " x = torch.rand(10000, 10, device=device) # directly create a tensor on GPU" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "tensor([[0.4825, 0.5817, 0.0127, 0.7462, 0.1225],\n", - " [0.5351, 0.1582, 0.7482, 0.5826, 0.0507],\n", - " [0.1559, 0.9457, 0.6242, 0.7610, 0.2080],\n", - " [0.6010, 0.4131, 0.8429, 0.5539, 0.0943],\n", - " [0.3711, 0.0609, 0.5242, 0.5414, 0.9859]], device='cuda:0')\n" - ] - } - ], - "source": [ - "if torch.cuda.is_available():\n", - " y = x.to(device) # or just use strings ``.to(\"cuda\")``\n", - " print(x[0:5, 0:5])" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [], - "source": [ - "if torch.cuda.is_available():\n", - " # Here is the memory of the GPU a border.\n", - " # A matrix with 100000 lines requires 37 GB, but only 8 GB are available.\n", - " H = x.mm( (x.t().mm(x)).inverse() ).mm(x.t())" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "tensor([[ 1.2062e-03, -3.5245e-04, 6.0149e-04, 5.5662e-04, -5.2612e-04],\n", - " [-3.5245e-04, 1.0502e-03, -1.2980e-04, 7.1976e-05, 2.5712e-04],\n", - " [ 6.0149e-04, -1.2980e-04, 1.2645e-03, 4.9298e-04, -2.6166e-04],\n", - " [ 5.5662e-04, 7.1976e-05, 4.9298e-04, 9.1148e-04, -2.7401e-04],\n", - " [-5.2612e-04, 2.5712e-04, -2.6166e-04, -2.7401e-04, 1.0023e-03]],\n", - " device='cuda:0')\n" - ] - } - ], - "source": [ - "if torch.cuda.is_available():\n", - " print(H[0:5, 0:5])" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "tensor([[ 1.2062e-03, -3.5245e-04, 6.0149e-04, 5.5662e-04, -5.2612e-04],\n", - " [-3.5245e-04, 1.0502e-03, -1.2980e-04, 7.1976e-05, 2.5712e-04],\n", - " [ 6.0149e-04, -1.2980e-04, 1.2645e-03, 4.9298e-04, -2.6166e-04],\n", - " [ 5.5662e-04, 7.1976e-05, 4.9298e-04, 9.1148e-04, -2.7401e-04],\n", - " [-5.2612e-04, 2.5712e-04, -2.6166e-04, -2.7401e-04, 1.0023e-03]],\n", - " dtype=torch.float64)\n" - ] - } - ], - "source": [ - "if torch.cuda.is_available():\n", - " # This operation is difficult, as an symmetric matrix is transferred\n", - " # back to the CPU. Is possible up to 30000 rows.\n", - " print(H.to(\"cpu\", torch.double)[0:5, 0:5])" - ] - }, { "cell_type": "code", "execution_count": null,