Skip to content

Commit

Permalink
Upgrade TF to 2.15 and update sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophSchranz committed Dec 14, 2023
1 parent bb4ea56 commit 59c7f01
Show file tree
Hide file tree
Showing 8 changed files with 8,139 additions and 2,728 deletions.
2 changes: 1 addition & 1 deletion .build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ LABEL maintainer="Christoph Schranz <[email protected]>, Mat
# installation via conda leads to errors in version 4.8.2
USER ${NB_UID}
RUN pip install --upgrade pip && \
pip install --no-cache-dir tensorflow==2.14.0 keras==2.14.0 && \
pip install --no-cache-dir tensorflow==2.15.0 keras==2.15.0 && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

Expand Down
129 changes: 74 additions & 55 deletions extra/Getting_Started/GPU-processing.ipynb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Mon Apr 26 13:59:53 2021 \n",
"Thu Dec 14 17:16:30 2023 \n",
"+-----------------------------------------------------------------------------+\n",
"| NVIDIA-SMI 465.19.01 Driver Version: 465.19.01 CUDA Version: 11.3 |\n",
"| NVIDIA-SMI 520.61.05 Driver Version: 520.61.05 CUDA Version: 11.8 |\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",
"| | | MIG M. |\n",
"|===============================+======================+======================|\n",
"| 0 NVIDIA GeForce ... On | 00000000:01:00.0 On | N/A |\n",
"| 0% 48C P8 8W / 215W | 283MiB / 7974MiB | 11% Default |\n",
"| 0 NVIDIA RTX A6000 On | 00000000:41:00.0 Off | Off |\n",
"| 30% 49C P8 27W / 300W | 5MiB / 49140MiB | 0% Default |\n",
"| | | N/A |\n",
"+-------------------------------+----------------------+----------------------+\n",
"| 1 NVIDIA RTX A6000 On | 00000000:61:00.0 Off | Off |\n",
"| 35% 63C P2 90W / 300W | 9635MiB / 49140MiB | 0% Default |\n",
"| | | N/A |\n",
"+-------------------------------+----------------------+----------------------+\n",
" \n",
Expand Down Expand Up @@ -86,11 +90,39 @@
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2023-12-14 17:16:32.448916: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.\n",
"2023-12-14 17:16:32.472734: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n",
"2023-12-14 17:16:32.472758: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n",
"2023-12-14 17:16:32.473445: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n",
"2023-12-14 17:16:32.477355: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.\n",
"2023-12-14 17:16:32.477730: I tensorflow/core/platform/cpu_feature_guard.cc:182] 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",
"2023-12-14 17:16:33.173733: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"[PhysicalDevice(name='/physical_device:XLA_GPU:0', device_type='XLA_GPU')]\n"
"[]\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2023-12-14 17:16:33.915841: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355\n",
"2023-12-14 17:16:33.916057: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355\n",
"2023-12-14 17:16:33.916926: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2256] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\n",
"Skipping registering GPU devices...\n",
"2023-12-14 17:16:34.083985: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355\n",
"2023-12-14 17:16:34.084152: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355\n",
"2023-12-14 17:16:34.084263: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2256] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\n",
"Skipping registering GPU devices...\n"
]
},
{
Expand All @@ -101,21 +133,8 @@
" memory_limit: 268435456\n",
" locality {\n",
" }\n",
" incarnation: 6507124110760788315,\n",
" name: \"/device:XLA_CPU:0\"\n",
" device_type: \"XLA_CPU\"\n",
" memory_limit: 17179869184\n",
" locality {\n",
" }\n",
" incarnation: 4922654194336399393\n",
" physical_device_desc: \"device: XLA_CPU device\",\n",
" name: \"/device:XLA_GPU:0\"\n",
" device_type: \"XLA_GPU\"\n",
" memory_limit: 17179869184\n",
" locality {\n",
" }\n",
" incarnation: 1179884248341804191\n",
" physical_device_desc: \"device: XLA_GPU device\"]"
" incarnation: 14747982026689315297\n",
" xla_global_id: -1]"
]
},
"execution_count": 3,
Expand All @@ -138,11 +157,11 @@
{
"data": {
"text/plain": [
"tensor([[0.6378, 0.9107, 0.5509],\n",
" [0.4454, 0.1930, 0.4130],\n",
" [0.0074, 0.9115, 0.1397],\n",
" [0.4758, 0.0569, 0.8469],\n",
" [0.1666, 0.7414, 0.5519]])"
"tensor([[0.3446, 0.0452, 0.2264],\n",
" [0.7986, 0.7481, 0.9437],\n",
" [0.0514, 0.0179, 0.9945],\n",
" [0.6514, 0.9786, 0.4902],\n",
" [0.9525, 0.8661, 0.2606]])"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -192,7 +211,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"358 ms ± 72.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
"260 ms ± 61.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
]
}
],
Expand Down Expand Up @@ -226,7 +245,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"187 ms ± 40.1 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
"76.7 ms ± 1.28 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
Expand All @@ -252,16 +271,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"tensor([[0.5021, 0.1432, 0.7876, 0.4729, 0.8067],\n",
" [0.7827, 0.3770, 0.8910, 0.3543, 0.3826],\n",
" [0.1806, 0.2917, 0.3224, 0.2717, 0.3795],\n",
" [0.5002, 0.2753, 0.5238, 0.0830, 0.9391],\n",
" [0.0774, 0.3479, 0.8384, 0.6825, 0.4502]], device='cuda:0')\n",
"tensor([[0.5021, 0.1432, 0.7876, 0.4729, 0.8067],\n",
" [0.7827, 0.3770, 0.8910, 0.3543, 0.3826],\n",
" [0.1806, 0.2917, 0.3224, 0.2717, 0.3795],\n",
" [0.5002, 0.2753, 0.5238, 0.0830, 0.9391],\n",
" [0.0774, 0.3479, 0.8384, 0.6825, 0.4502]], dtype=torch.float64)\n"
"tensor([[0.3524, 0.4564, 0.5821, 0.0973, 0.7754],\n",
" [0.7047, 0.2262, 0.4790, 0.1555, 0.5360],\n",
" [0.0142, 0.1699, 0.9471, 0.2035, 0.9215],\n",
" [0.5230, 0.0497, 0.8534, 0.3936, 0.3059],\n",
" [0.8031, 0.8541, 0.3866, 0.6828, 0.7291]], device='cuda:0')\n",
"tensor([[0.3524, 0.4564, 0.5821, 0.0973, 0.7754],\n",
" [0.7047, 0.2262, 0.4790, 0.1555, 0.5360],\n",
" [0.0142, 0.1699, 0.9471, 0.2035, 0.9215],\n",
" [0.5230, 0.0497, 0.8534, 0.3936, 0.3059],\n",
" [0.8031, 0.8541, 0.3866, 0.6828, 0.7291]], dtype=torch.float64)\n"
]
}
],
Expand All @@ -285,7 +304,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"8.42 ms ± 223 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
"3.37 ms ± 23.6 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
]
}
],
Expand Down Expand Up @@ -332,11 +351,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"tensor([[0.6581, 0.1584, 0.1951, 0.7333, 0.2423],\n",
" [0.7057, 0.4649, 0.6851, 0.4686, 0.4990],\n",
" [0.0904, 0.3937, 0.1658, 0.3733, 0.8904],\n",
" [0.2138, 0.0609, 0.5688, 0.1917, 0.8857],\n",
" [0.2110, 0.6726, 0.2961, 0.3625, 0.0745]], device='cuda:0')\n"
"tensor([[0.4466, 0.0260, 0.0687, 0.6375, 0.9676],\n",
" [0.2974, 0.0200, 0.0621, 0.4341, 0.0167],\n",
" [0.1146, 0.3012, 0.9246, 0.1484, 0.8045],\n",
" [0.4448, 0.5577, 0.4649, 0.2364, 0.7051],\n",
" [0.0479, 0.7472, 0.2121, 0.9418, 0.7699]], device='cuda:0')\n"
]
}
],
Expand Down Expand Up @@ -367,11 +386,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"tensor([[ 7.5589e-04, 9.0142e-05, 1.7263e-04, 7.5191e-05, 1.2231e-04],\n",
" [ 9.0142e-05, 5.8283e-04, -2.2237e-04, 3.5647e-04, -2.3438e-05],\n",
" [ 1.7263e-04, -2.2237e-04, 8.8304e-04, 3.3944e-04, -4.9345e-05],\n",
" [ 7.5191e-05, 3.5647e-04, 3.3944e-04, 9.6286e-04, -1.4842e-05],\n",
" [ 1.2231e-04, -2.3438e-05, -4.9345e-05, -1.4842e-05, 1.0476e-03]],\n",
"tensor([[ 1.2995e-03, 1.6008e-04, 3.7637e-04, 1.3155e-04, 4.5707e-05],\n",
" [ 1.6008e-04, 8.3649e-04, 4.2130e-05, 9.5201e-05, 1.6981e-04],\n",
" [ 3.7637e-04, 4.2130e-05, 1.1736e-03, 3.9943e-04, -2.7599e-04],\n",
" [ 1.3155e-04, 9.5201e-05, 3.9942e-04, 4.7651e-04, 1.6600e-04],\n",
" [ 4.5707e-05, 1.6981e-04, -2.7599e-04, 1.6600e-04, 1.3608e-03]],\n",
" device='cuda:0')\n"
]
}
Expand All @@ -390,11 +409,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"tensor([[ 7.5589e-04, 9.0142e-05, 1.7263e-04, 7.5191e-05, 1.2231e-04],\n",
" [ 9.0142e-05, 5.8283e-04, -2.2237e-04, 3.5647e-04, -2.3438e-05],\n",
" [ 1.7263e-04, -2.2237e-04, 8.8304e-04, 3.3944e-04, -4.9345e-05],\n",
" [ 7.5191e-05, 3.5647e-04, 3.3944e-04, 9.6286e-04, -1.4842e-05],\n",
" [ 1.2231e-04, -2.3438e-05, -4.9345e-05, -1.4842e-05, 1.0476e-03]],\n",
"tensor([[ 1.2995e-03, 1.6008e-04, 3.7637e-04, 1.3155e-04, 4.5707e-05],\n",
" [ 1.6008e-04, 8.3649e-04, 4.2130e-05, 9.5201e-05, 1.6981e-04],\n",
" [ 3.7637e-04, 4.2130e-05, 1.1736e-03, 3.9943e-04, -2.7599e-04],\n",
" [ 1.3155e-04, 9.5201e-05, 3.9942e-04, 4.7651e-04, 1.6600e-04],\n",
" [ 4.5707e-05, 1.6981e-04, -2.7599e-04, 1.6600e-04, 1.3608e-03]],\n",
" dtype=torch.float64)\n"
]
}
Expand All @@ -416,7 +435,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -430,7 +449,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 59c7f01

Please sign in to comment.