From 12d90787f5a67083ec6d31013405bb479cc7a619 Mon Sep 17 00:00:00 2001 From: Guillermo Marcus Date: Mon, 2 Dec 2024 15:52:22 +0100 Subject: [PATCH] update examples for Google Colab. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: The Sionna Team Merged-by: Guillermo Marcus <4169784+gmarcusm@users.noreply.github.com> Co-authored-by: Jakob Hoydis <5190129+jhoydis@users.noreply.github.com> Co-authored-by: Fayçal Ait-Aoudia <43564757+faycalaa@users.noreply.github.com> Co-authored-by: Sebastian Cammerer <18167671+SebastianCa@users.noreply.github.com> Co-authored-by: Lorenzo Maggi <34341780+lollodealma@users.noreply.github.com> Co-authored-by: Guillermo Marcus <4169784+gmarcusm@users.noreply.github.com> Co-authored-by: Merlin Nimier-David --- .../5G_Channel_Coding_Polar_vs_LDPC_Codes.ipynb | 12 ------------ examples/5G_NR_PUSCH.ipynb | 12 ------------ examples/Evolution_of_FEC.ipynb | 13 ------------- ...uction_to_Iterative_Detection_and_Decoding.ipynb | 11 ----------- examples/MIMO_OFDM_Transmissions_over_CDL.ipynb | 9 +++++++++ examples/Sionna_tutorial_part1.ipynb | 13 ------------- examples/Sionna_tutorial_part2.ipynb | 13 ------------- examples/Sionna_tutorial_part3.ipynb | 13 ------------- examples/Sionna_tutorial_part4.ipynb | 13 ------------- 9 files changed, 9 insertions(+), 100 deletions(-) diff --git a/examples/5G_Channel_Coding_Polar_vs_LDPC_Codes.ipynb b/examples/5G_Channel_Coding_Polar_vs_LDPC_Codes.ipynb index c3c85ed..ef78c13 100644 --- a/examples/5G_Channel_Coding_Polar_vs_LDPC_Codes.ipynb +++ b/examples/5G_Channel_Coding_Polar_vs_LDPC_Codes.ipynb @@ -74,18 +74,6 @@ " os.environ[\"CUDA_VISIBLE_DEVICES\"] = f\"{gpu_num}\"\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", - "import tensorflow as tf\n", - "# Configure the notebook to use only a single GPU and allocate only as much memory as needed\n", - "# For more details, see https://www.tensorflow.org/guide/gpu\n", - "gpus = tf.config.list_physical_devices('GPU')\n", - "if gpus:\n", - " try:\n", - " tf.config.experimental.set_memory_growth(gpus[0], True)\n", - " except RuntimeError as e:\n", - " print(e)\n", - "# Avoid warnings from TensorFlow\n", - "tf.get_logger().setLevel('ERROR')\n", - "\n", "# Import Sionna\n", "try:\n", " import sionna\n", diff --git a/examples/5G_NR_PUSCH.ipynb b/examples/5G_NR_PUSCH.ipynb index d78f5ce..c6f4132 100644 --- a/examples/5G_NR_PUSCH.ipynb +++ b/examples/5G_NR_PUSCH.ipynb @@ -60,18 +60,6 @@ " os.environ[\"CUDA_VISIBLE_DEVICES\"] = f\"{gpu_num}\"\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", - "import tensorflow as tf\n", - "# Configure the notebook to use only a single GPU and allocate only as much memory as needed\n", - "# For more details, see https://www.tensorflow.org/guide/gpu\n", - "gpus = tf.config.list_physical_devices('GPU')\n", - "if gpus:\n", - " try:\n", - " tf.config.experimental.set_memory_growth(gpus[0], True)\n", - " except RuntimeError as e:\n", - " print(e)\n", - "# Avoid warnings from TensorFlow\n", - "tf.get_logger().setLevel('ERROR')\n", - "\n", "# Import Sionna\n", "try:\n", " import sionna\n", diff --git a/examples/Evolution_of_FEC.ipynb b/examples/Evolution_of_FEC.ipynb index 83855a9..cbb6a8f 100644 --- a/examples/Evolution_of_FEC.ipynb +++ b/examples/Evolution_of_FEC.ipynb @@ -50,19 +50,6 @@ " os.environ[\"CUDA_VISIBLE_DEVICES\"] = f\"{gpu_num}\"\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", - "# Configure the notebook to use only a single GPU and allocate only as much memory as needed\n", - "# For more details, see https://www.tensorflow.org/guide/gpu\n", - "import tensorflow as tf\n", - "gpus = tf.config.list_physical_devices('GPU')\n", - "if gpus:\n", - " try:\n", - " tf.config.experimental.set_memory_growth(gpus[0], True)\n", - " except RuntimeError as e:\n", - " print(e)\n", - "\n", - "# Avoid warnings from TensorFlow\n", - "tf.get_logger().setLevel('ERROR')\n", - "\n", "# Import Sionna\n", "try:\n", " import sionna\n", diff --git a/examples/Introduction_to_Iterative_Detection_and_Decoding.ipynb b/examples/Introduction_to_Iterative_Detection_and_Decoding.ipynb index 9a237de..fa08ec5 100644 --- a/examples/Introduction_to_Iterative_Detection_and_Decoding.ipynb +++ b/examples/Introduction_to_Iterative_Detection_and_Decoding.ipynb @@ -96,17 +96,6 @@ " os.environ[\"CUDA_VISIBLE_DEVICES\"] = f\"{gpu_num}\"\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", - "import tensorflow as tf\n", - "from tensorflow.keras import Model\n", - "gpus = tf.config.list_physical_devices('GPU')\n", - "if gpus:\n", - " try:\n", - " tf.config.experimental.set_memory_growth(gpus[0], True)\n", - " except RuntimeError as e:\n", - " print(e)\n", - "# Avoid warnings from TensorFlow\n", - "tf.get_logger().setLevel('ERROR')\n", - "\n", "# Import Sionna\n", "try:\n", " import sionna\n", diff --git a/examples/MIMO_OFDM_Transmissions_over_CDL.ipynb b/examples/MIMO_OFDM_Transmissions_over_CDL.ipynb index 41b427a..97f9d04 100644 --- a/examples/MIMO_OFDM_Transmissions_over_CDL.ipynb +++ b/examples/MIMO_OFDM_Transmissions_over_CDL.ipynb @@ -105,6 +105,15 @@ " os.environ[\"CUDA_VISIBLE_DEVICES\"] = f\"{gpu_num}\"\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", + "# Import Sionna\n", + "try:\n", + " import sionna\n", + "except ImportError as e:\n", + " # Install Sionna if package is not already installed\n", + " import os\n", + " os.system(\"pip install sionna\")\n", + " import sionna\n", + "\n", "# Configure the notebook to use only a single GPU and allocate only as much memory as needed\n", "# For more details, see https://www.tensorflow.org/guide/gpu\n", "import tensorflow as tf\n", diff --git a/examples/Sionna_tutorial_part1.ipynb b/examples/Sionna_tutorial_part1.ipynb index bad147d..4f3be37 100644 --- a/examples/Sionna_tutorial_part1.ipynb +++ b/examples/Sionna_tutorial_part1.ipynb @@ -72,19 +72,6 @@ "\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", - "# Configure the notebook to use only a single GPU and allocate only as much memory as needed\n", - "# For more details, see https://www.tensorflow.org/guide/gpu\n", - "import tensorflow as tf\n", - "gpus = tf.config.list_physical_devices('GPU')\n", - "if gpus:\n", - " try:\n", - " tf.config.experimental.set_memory_growth(gpus[0], True)\n", - " except RuntimeError as e:\n", - " print(e) \n", - "\n", - "# Avoid warnings from TensorFlow\n", - "tf.get_logger().setLevel('ERROR')\n", - "\n", "# Import Sionna\n", "try:\n", " import sionna as sn\n", diff --git a/examples/Sionna_tutorial_part2.ipynb b/examples/Sionna_tutorial_part2.ipynb index 73c69c0..d1d016d 100644 --- a/examples/Sionna_tutorial_part2.ipynb +++ b/examples/Sionna_tutorial_part2.ipynb @@ -68,19 +68,6 @@ "\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", - "# Configure the notebook to use only a single GPU and allocate only as much memory as needed\n", - "# For more details, see https://www.tensorflow.org/guide/gpu\n", - "import tensorflow as tf\n", - "gpus = tf.config.list_physical_devices('GPU')\n", - "if gpus:\n", - " try:\n", - " tf.config.experimental.set_memory_growth(gpus[0], True)\n", - " except RuntimeError as e:\n", - " print(e) \n", - "\n", - "# Avoid warnings from TensorFlow\n", - "tf.get_logger().setLevel('ERROR')\n", - "\n", "# Import Sionna\n", "try:\n", " import sionna as sn\n", diff --git a/examples/Sionna_tutorial_part3.ipynb b/examples/Sionna_tutorial_part3.ipynb index dda99f7..2f2c4ee 100644 --- a/examples/Sionna_tutorial_part3.ipynb +++ b/examples/Sionna_tutorial_part3.ipynb @@ -69,19 +69,6 @@ "\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", - "# Configure the notebook to use only a single GPU and allocate only as much memory as needed\n", - "# For more details, see https://www.tensorflow.org/guide/gpu\n", - "import tensorflow as tf\n", - "gpus = tf.config.list_physical_devices('GPU')\n", - "if gpus:\n", - " try:\n", - " tf.config.experimental.set_memory_growth(gpus[0], True)\n", - " except RuntimeError as e:\n", - " print(e) \n", - "\n", - "# Avoid warnings from TensorFlow\n", - "tf.get_logger().setLevel('ERROR')\n", - "\n", "# Import Sionna\n", "try:\n", " import sionna as sn\n", diff --git a/examples/Sionna_tutorial_part4.ipynb b/examples/Sionna_tutorial_part4.ipynb index 3945d16..64ae148 100644 --- a/examples/Sionna_tutorial_part4.ipynb +++ b/examples/Sionna_tutorial_part4.ipynb @@ -77,19 +77,6 @@ "\n", "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", "\n", - "# Configure the notebook to use only a single GPU and allocate only as much memory as needed\n", - "# For more details, see https://www.tensorflow.org/guide/gpu\n", - "import tensorflow as tf\n", - "gpus = tf.config.list_physical_devices('GPU')\n", - "if gpus:\n", - " try:\n", - " tf.config.experimental.set_memory_growth(gpus[0], True)\n", - " except RuntimeError as e:\n", - " print(e) \n", - "\n", - "# Avoid warnings from TensorFlow\n", - "tf.get_logger().setLevel('ERROR')\n", - "\n", "# Import Sionna\n", "try:\n", " import sionna as sn\n",