Coder Social home page Coder Social logo

nvlabs / sionna Goto Github PK

View Code? Open in Web Editor NEW
615.0 37.0 180.0 112.49 MB

Sionna: An Open-Source Library for Next-Generation Physical Layer Research

Home Page: https://nvlabs.github.io/sionna

License: Other

Makefile 0.01% Python 49.27% Jupyter Notebook 50.73%
communications 5g 6g machine-learning deep-learning link-level-simulation reproducible-research open-source gpu-acceleration

sionna's Introduction

Sionna: An Open-Source Library for Next-Generation Physical Layer Research

Sionna™ is an open-source Python library for link-level simulations of digital communication systems built on top of the open-source software library TensorFlow for machine learning.

The official documentation can be found here.

Installation

Sionna requires Python and Tensorflow. In order to run the tutorial notebooks on your machine, you also need JupyterLab. You can alternatively test them on Google Colab. Although not necessary, we recommend running Sionna in a Docker container.

Sionna requires TensorFlow 2.10-2.15 and Python 3.8-3.11. We recommend Ubuntu 22.04. Earlier versions of TensorFlow may still work but are not recommended because of known, unpatched CVEs.

To run the ray tracer on CPU, LLVM is required by DrJit. Please check the installation instructions for the LLVM backend.

We refer to the TensorFlow GPU support tutorial for GPU support and the required driver setup.

Installation using pip

We recommend to do this within a virtual environment, e.g., using conda. On macOS, you need to install tensorflow-macos first.

1.) Install the package

    pip install sionna

2.) Test the installation in Python

    python
    >>> import sionna
    >>> print(sionna.__version__)
    0.16.2

3.) Once Sionna is installed, you can run the Sionna "Hello, World!" example, have a look at the quick start guide, or at the tutorials.

The example notebooks can be opened and executed with Jupyter.

For a local installation, the JupyterLab Desktop application can be used which also includes the Python installation.

Docker-based installation

1.) Make sure that you have Docker installed on your system. On Ubuntu 22.04, you can run for example

    sudo apt install docker.io

Ensure that your user belongs to the docker group (see Docker post-installation)

    sudo usermod -aG docker $USER

Log out and re-login to load updated group memberships.

For GPU support on Linux, you need to install the NVIDIA Container Toolkit.

2.) Build the Sionna Docker image. From within the Sionna directory, run

    make docker

3.) Run the Docker image with GPU support

    make run-docker gpus=all

or without GPU:

    make run-docker

This will immediately launch a Docker image with Sionna installed, running JupyterLab on port 8888.

4.) Browse through the example notebooks by connecting to http://127.0.0.1:8888 in your browser.

Installation from source

We recommend to do this within a virtual environment, e.g., using conda.

1.) Clone this repository and execute from within its root folder

    make install

2.) Test the installation in Python

    >>> import sionna
    >>> print(sionna.__version__)
    0.16.2

License and Citation

Sionna is Apache-2.0 licensed, as found in the LICENSE file.

If you use this software, please cite it as:

@article{sionna,
    title = {Sionna: An Open-Source Library for Next-Generation Physical Layer Research},
    author = {Hoydis, Jakob and Cammerer, Sebastian and {Ait Aoudia}, Fayçal and Vem, Avinash and Binder, Nikolaus and Marcus, Guillermo and Keller, Alexander},
    year = {2022},
    month = {Mar.},
    journal = {arXiv preprint},
    online = {https://arxiv.org/abs/2203.11854}
}

sionna's People

Contributors

catkira avatar echacko avatar fklement avatar gmarcusm avatar japm48 avatar jeertmans avatar jhoydis avatar kassankar avatar latenighticecream avatar nbecker avatar noc0lour avatar pablosreyero avatar rsubbaraman avatar rwiesmayr avatar sebastianca avatar taha-yassine avatar tuhlema avatar umut-demirhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sionna's Issues

Creating Custom Scenes

Hello,

I am a newbie to Sionna.

I have gone through tutorials for Ray tracing. However, it is not clear how to load custom scenes in the software. Particularly, I want to simulate wifi measurements in an indoor setting. I have a CAD model for an indoor environment. I am not sure how should I setup XML files to use this indoor scene in sionna.

Regards,
Ishaan

Problem with polarization direction

Hi Sionna team,

If my understanding is correct, there is a bug with polarization direction calculation in current version.

In line 452 of antenna.py,
slant_angle = 0 if polarization == "VH" else -PI/4
which should be,
slant_angle = 0 if polarization_type == "VH" else -PI/4

Thanks

sn.utils.flatten_last_dims doesn't support dynamic shape

Describe the bug
The function flatten_last_dims doesn't support dynamic tensor shape. If I try I obtain the following error:

ValueError: Cannot convert a partially known TensorShape to a Tensor: (None, ...)

I report it as a bug as I think it is not the expected behavior.

To Reproduce
Minimal code to reproduce:

import tensorflow as tf
import sionna as sn

# copy of Sionna's function
def flatten_last_dims(tensor, num_dims=2):
    if num_dims==len(tensor.shape):
        new_shape = [-1]
    else:
        shape = tf.shape(tensor)
        last_dim = tf.reduce_prod(tensor.shape[-num_dims:])
        new_shape = tf.concat([shape[:-num_dims], [last_dim]], 0)

    return tf.reshape(tensor, new_shape)

class Dummy(tf.keras.Model):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def call(self, inputs):
        x = inputs

        x = flatten_last_dims(x, num_dims=2)

        return x

model = Dummy()

x = tf.keras.Input(shape=(4,4,4))
print(model(x)) # => OK

x = tf.keras.Input(shape=(4,None,4))
print(model(x)) # => Error

x = tf.zeros(shape=[3,3,3,3])
tf.shape(model(x))

Expected behavior
The function should handle the dynamic shape.

Proposed solution
Replace the tensor.shape[-num_dims:] with a tf.shape(tensor)[-num_dims:] to make the shape dynamic.

Solution for the minimal code example:

import tensorflow as tf
import sionna as sn

def flatten_last_dims(tensor, num_dims=2):
    if num_dims==len(tensor.shape):
        new_shape = [-1]
    else:
        shape = tf.shape(tensor)
        last_dim = tf.reduce_prod(tf.shape(tensor)[-num_dims:])  # <= modification here
        new_shape = tf.concat([shape[:-num_dims], [last_dim]], 0)

    return tf.reshape(tensor, new_shape)

class Dummy(tf.keras.Model):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def call(self, inputs):
        x = inputs

        x = flatten_last_dims(x, num_dims=2)

        return x

model = Dummy()

x = tf.keras.Input(shape=(4,4,4))
print(model(x)) # ouput shape = (None, 4, None)

x = tf.keras.Input(shape=(4,None,4)) 
print(model(x)) # ouput shape = (None, 4, None)

x = tf.zeros(shape=[3,3,3,3])
tf.shape(model(x)) # ouput shape = (3, 3, 9)

Part 4: Toward Learned Receivers Bug TensorShape to a Tensor: (None, None)

When trying the Part 4: Toward Learned Receivers example at the step Training the Neural Receiver
I get an error about TensorShape to a Tensor: (None, None) while i did not alter the example in any way. why is this?
The full error is bellow:

Traceback (most recent call last):
File "/cm/local/apps/slurm/var/spool/job6555120/slurm_script", line 308, in
loss = model(BATCH_SIZE, ebno_db)
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py", line 885, in call
result = self._call(*args, **kwds)
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py", line 933, in _call
self._initialize(args, kwds, add_initializers_to=initializers)
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py", line 760, in _initialize
*args, **kwds))
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 3066, in _get_concrete_function_internal_garbage_collected
graph_function, _ = self._maybe_define_function(args, kwargs)
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 3463, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 3308, in _create_graph_function
capture_by_value=self._capture_by_value),
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/framework/func_graph.py", line 1007, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py", line 668, in wrapped_fn
out = weak_wrapped_fn().wrapped(*args, **kwds)
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 3990, in bound_method_wrapper
return wrapped_fn(*args, **kwargs)
File "/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/framework/func_graph.py", line 994, in wrapper
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:

/cm/local/apps/slurm/var/spool/job6555120/slurm_script:280 __call__  *
    llr = self.rg_demapper(llr) # Extract data-carrying resource elements. The other LLrs are discarded
/home/tue/20184223/.local/lib/python3.6/site-packages/sionna/ofdm/resource_grid.py:470 call  *
    y = flatten_dims(y, 2, 2)
/home/tue/20184223/.local/lib/python3.6/site-packages/sionna/utils/tensors.py:76 flatten_dims  *
    flat_dim = tf.reduce_prod(tensor.shape[axis:axis+num_dims])
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py:206 wrapper  **
    return target(*args, **kwargs)
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:2744 reduce_prod
    input_tensor, _ReductionDims(input_tensor, axis), keepdims,
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:2094 _ReductionDims
    return range(0, array_ops.rank(x))
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py:206 wrapper
    return target(*args, **kwargs)
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py:839 rank
    return rank_internal(input, name, optimize=True)
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py:859 rank_internal
    input = ops.convert_to_tensor(input)
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/profiler/trace.py:163 wrapped
    return func(*args, **kwargs)
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py:1566 convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
/home/tue/20184223/.local/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py:363 _tensor_shape_tensor_conversion_function
    "Cannot convert a partially known TensorShape to a Tensor: %s" % s)

ValueError: Cannot convert a partially known TensorShape to a Tensor: (None, None)

Process finished with exit code 138 (interrupted by signal 10: SIGBUS)

When I try to use sionna.ofdm.resource_grid.ResourceGrid to make an OFDM signal I get the following in my output consol

2022-11-23 17:23:07.020289: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2022-11-23 17:23:07.020936: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: )

Process finished with exit code 138 (interrupted by signal 10: SIGBUS)

I'm using macOS on an m1 using tensorflow-metal and had no issues with the "hello world" example.

Coverage map bug when using custom center

Hi everyone, thank you for this very nice tool !

I'm encountering some issues when using the scene.coverage_map function with custom center.

I am using the following code:

#%%
import sionna
from sionna.rt import load_scene, Transmitter, Receiver, PlanarArray, Camera, Paths2CIR

#Load scene
scene = load_scene(sionna.rt.scene.munich)
scene.preview()

#%%

# Configure antenna array for all transmitters
scene.tx_array = PlanarArray(num_rows=1,
                             num_cols=1,
                             vertical_spacing=0.5,
                             horizontal_spacing=0.5,
                             pattern="tr38901",
                             polarization="V")

# Configure antenna array for all receivers
scene.rx_array = PlanarArray(num_rows=1,
                             num_cols=1,
                             vertical_spacing=0.5,
                             horizontal_spacing=0.5,
                             pattern="dipole",
                             polarization="cross")

# Create transmitter
tx = Transmitter(name="tx",
                 position=[8.5,21,27])

# Add transmitter instance to scene
scene.add(tx)

# Create a receiver
rx = Receiver(name="rx",
              position=[45,90,1.5],
              orientation=[0,0,0])

# Add receiver instance to scene
scene.add(rx)

tx.look_at(rx) # Transmitter points towards receiver

scene.preview()

#%%
#Compute coverage map
cm = scene.coverage_map(max_depth=5,
                        cm_cell_size=[3, 3], # Grid size of coverage map cells in m
                        combining_vec=None,
                        precoding_vec=None,
                        num_samples=int(1e6))

scene.preview(coverage_map=cm)

This works fine, I am able to preview the coverage map. However, when I decide to center the coverage map on the UE and define the coverage map size and orientation with the following code I get an error from the self._solver_cm function in the scene.py file. This error can be found after the code.

#%%
#Test custom coverage map (around the UE)
cm = scene.coverage_map(max_depth=5,
                        cm_center=[45,90,1.5],
                        cm_orientation=[0,0,0],
                        cm_size=[10,10],
                        cm_cell_size=[3, 3], # Grid size of coverage map cells in m
                        combining_vec=None,
                        precoding_vec=None,
                        num_samples=int(1e6))

scene.preview(coverage_map=cm)

The error message I get:

---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
h:\PhD\phd_code\sionna_generation\github_bug.py in line 3
      56 #%%
      57 #Test custom coverage map (around the UE)
----> 58 cm = scene.coverage_map(max_depth=5,
      59                         cm_center=[45,90,1.5],
      60                         cm_orientation=[0,0,0],
      61                         cm_size=[10,10],
      62                         cm_cell_size=[3, 3], # Grid size of coverage map cells in m
      63                         combining_vec=None,
      64                         precoding_vec=None,
     65                         num_samples=int(1e6))
     67 scene.preview(coverage_map=cm)

File c:\Users\bchateli\Anaconda3\envs\sionna-cpu\lib\site-packages\sionna\rt\scene.py:908, in Scene.coverage_map(self, rx_orientation, max_depth, cm_center, cm_orientation, cm_size, cm_cell_size, combining_vec, precoding_vec, num_samples, seed)
    903     seed = tf.random.uniform(shape=(), maxval=0x7FFFFFFF,
    904                              dtype=tf.int32)
    906 # Compute the coverage map using the solver
    907 # [num_sources, num_cells_x, num_cells_y]
--> 908 output = self._solver_cm(max_depth=max_depth,
    909                          rx_orientation=rx_orientation,
    910                          cm_center=cm_center,
    911                          cm_orientation=cm_orientation,
    912                          cm_size=cm_size,
...
   7213 def raise_from_not_ok_status(e, name):
   7214   e.message += (" name: " + name if name is not None else "")
-> 7215   raise core._status_to_exception(e) from None

InvalidArgumentError: {{function_node __wrapped__TensorScatterAdd_device_/job:localhost/replica:0/task:0/device:CPU:0}} indices[0,0] = [0, -28, -13] does not index into shape [1,5,5] [Op:TensorScatterAdd]

I am using the latest Sionna release on Windows 10.

Any idea on what causes this? Thanks in advance!

Memory spillage to local memory

This is not an error per se it's a warning that I am getting when I run end-to-end PUSCH using Keras model wrapper. But I feel due to this the simulations are preforming slower. Do let me know if I am right and if there is some way to fix this.

Below is the warning I am getting:
2023-04-28 19:37:29.120441: I tensorflow/compiler/xla/stream_executor/gpu/asm_compiler.cc:328] ptxas warning : Registers are spilled to local memory in function 'fusion_136', 456 bytes spill stores, 344 bytes spill loads

Tensorflow dependency in setup.cfg

Describe the bug
Since tensorflow is distributed with different flavours (tensorflow-cpu, tensorflow-gpu, tensorflow-macos, etc) installation of sionna fails if tensorflow is not provided by the default tensorflow package.

A discussion with a possible solution of removing the tensorflow dependency from the default require stanza and moving it to extra_requires for e.g. gpu, cpu, macos was done here: tensorflow/tensorflow#7166

Otherwise installing with --no-deps also works if all dependencies are known to be satisfied. Maybe this would be enough to put into the documentation.

Passing Constellation to MaximumLikelihoodDetector doesn't work

Describe the bug
Passing a Constellation object as the constellation parameter to MaximumLikelihoodDetector gives a TypeError

To Reproduce

See this example

import sionna
from sionna.mapping import Constellation
from sionna.mimo import MaximumLikelihoodDetector

print(sionna.__version__)

mld1 = MaximumLikelihoodDetector('bit', 'app', 6, constellation_type='qam', num_bits_per_symbol=2)
mld2 = MaximumLikelihoodDetector('bit', 'app', 6, constellation=Constellation(constellation_type='qam', num_bits_per_symbol=2))

which produces this output:

0.10.0
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [6], in <cell line: 8>()
      5 print(sionna.__version__)
      7 mld1 = MaximumLikelihoodDetector('bit', 'app', 6, constellation_type='qam', num_bits_per_symbol=2)
----> 8 mld2 = MaximumLikelihoodDetector('bit', 'app', 6, constellation=Constellation(constellation_type='qam', num_bits_per_symbol=2))

File ~/anaconda3/envs/noma/lib/python3.10/site-packages/sionna/mimo/detection.py:237, in MaximumLikelihoodDetector.__init__(self, output, demapping_method, k, constellation_type, num_bits_per_symbol, constellation, hard_out, dtype, **kwargs)
    234 self._c = tf.cast(c, tf.int32)
    236 if output == 'bit':
--> 237     self._logits2llr = SymbolLogits2LLRs(
    238                             method=demapping_method,
    239                             num_bits_per_symbol=num_bits_per_symbol,
    240                             hard_out=hard_out,
    241                             dtype=dtype.real_dtype,
    242                             **kwargs)

File ~/anaconda3/envs/noma/lib/python3.10/site-packages/sionna/mapping.py:641, in SymbolLogits2LLRsWithPrior.__init__(self, method, num_bits_per_symbol, hard_out, dtype, **kwargs)
    639 self._hard_out = hard_out
    640 self._num_bits_per_symbol = num_bits_per_symbol
--> 641 num_points = int(2**num_bits_per_symbol)
    643 # Array composed of binary representations of all symbols indices
    644 a = np.zeros([num_points, num_bits_per_symbol])

TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'NoneType'

Expected behavior
No TypeError

To Fix:
Replace line 239 of detection.py with

num_bits_per_symbol=self._constellation.num_bits_per_symbol,

SIONNA installation issue

Hi team,

First of all, I would like to thank you for developing this product. It's really intriguing to read the documentation posted on the official website. And I would also like to install and learn more about it.

I have a few queries regarding the installation process since I am new to the Conda environment.

  1. Should we run these commands after I activate my "Conda Environment".
  2. If the above is not true, I have installed the SIONNA package in a Conda environment and received the following error.

(CondaRahul) rahul@rahul-VirtualBox:~/Documents/NVlabs-sionna$ python
Python 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import sionna
2022-05-05 05:29:21.261805: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2022-05-05 05:29:21.261840: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

print(sionna.version)
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'sionna' has no attribute 'version'. Did you mean: 'version'?

It would be a great help if anyone can suggest me a solution to my queries. Looking forward to hearing back from you.

Thank you,
Rahul Singh Gulia

Problem running the Example Notebook - 'Discover Sionna'

I am in the process of setting up the environment on Mac OS and explore Sionna using the examples provided.
The Discover Sionna notebook throws-up error half-way into the execution. I am attaching the complete pdf version of the executed notebook.
Further, I have added code in the notebook to print the version of OS, python, TensorFlow etc installed in my environment to help debugging.

Please help me setup the environment correctly.
Discover_Sionna-3.pdf

Problem with LLVM when importing Sionna

Hi everyone,

First of all, thank you very much for this great tool.

I am having somme issues when importing Sionna 0.14.0 in both Windows 10 and Ubuntu 22.04. This throws an error regarding LLVM:

(Windows)
AttributeError: jit_init_thread_state(): the LLVM backend is inactive because the LLVM shared library ("LLVM-C.dll") could not be found! Set the DRJIT_LIBLLVM_PATH environment variable to specify its path.

(Ubuntu)
jit_init_thread_state(): the LLVM backend is inactive because the LLVM shared library ("libLLVM.so") could not be found! Set the DRJIT_LIBLLVM_PATH environment variable to specify its path..

On Ubuntu, adding LLVM with sudo apt-get install llvm-13 solved the issue when executing Sionna RT in scripts, but I still get the same error when running the Jupyter Sionna RT tutorial notebook.

Do you have any idea how to solve it ?

Thanks in advance !

Error "Could not initialize OptiX" when loading Munich scene

When I am learning to use ray tracing simulation functions in Sionna 0.14.0, an error occurred

Error while loading "/usr/local/lib/python3.8/dist-packages/sionna/rt/scenes/munich/munich.xml" (near line 1, col 1): could not instantiate scene plugin of type "scene": Could not initialize OptiX!

It seems that the NVIDIA driver version mismatch the OptiX required driver version. The following is my hardware configuration:

root@575a54dc6a75:~/SimSys/RayTracing# nvidia-smi
Fri Apr 28 06:54:57 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                  Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 3090         Off| 00000000:01:00.0 Off |                  N/A |
|  0%   36C    P8               35W / 350W|     17MiB / 24576MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
+---------------------------------------------------------------------------------------+

Then I change another GPU:

root@autodl-container-9dda1182fa-28b40549:~# nvidia-smi
Fri Apr 28 14:57:31 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.105.17   Driver Version: 525.105.17   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            On   | 00000000:00:06.0 Off |                  Off |
| N/A   28C    P8     9W /  70W |      3MiB / 16384MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

It can work well. So, can you fix this problem and make it more robust? thx~

Support for PyTorch

This project is awesome and opens the doors to many opportunities.
I was wondering if support for PyTorch was something you thought about. PyTorch is well-established in the academic world and most code accompanying deep learning papers uses it instead of TF. On the other hand, TF is greatly used in production environments.
I don't know how much complexity would supporting PyTorch add to the project, but could we imagine that some day it could happen? And are you accepting contributions in this regard?

Channel based key generation

Hello Sionna Team,

thank you very much for the great tool. It is overwhelmingly good and also great documented.
I am a computer science student with little or only some basic knowledge in wireless communications.

I have already played around a bit with the simulator and was able to understand most of the tutorial.

Since I am very interested in physical layer security, I would like to simulate and try Secret Key Extraction between Alice and Bob in the simulator.
For this I would like to use the channel estimation to perform a quantization, so that in the end Alice and Bob have the same key based on the exchanged pilot signals and the subsequent channel estimation.

Unfortunately, I'm just a bit lost and am overwhelmed by the large number of functions in Sionna.
I would like to have the Channel Estimates in each case once from the perspective of Alice and once from the perspective of Bob. What is the best way to do this? Is this even currently feasible in Sionna?

Many thanks in advance.

Problem with PanelArray() class show() function

Problem:
In the beginner tutorial part 3: advanced link level simulations, when executing the command "UT_ARRAY.show()" the following error occurs: "Type Error: float() argument must be a string or a number, not 'MarkStyle'".

Possible solution:
The error happens because in the show() function of the PanelArray() class, marker_vert and marker_horz are objects and the argument 'marker' must be a string. The possible solution is to use the get_marker() function which returns a string. This way:
marker = marker_vert.get_marker()
marker = marker_horz.get_marker()

Best regards,
Pedro

SNR desciptor function in plotBER class returns wrong attribute

@property
  def ber(self):
      """List containing all stored BER curves."""
       return self._bers

  @property
  def snr(self):
      """List containing all stored SNR curves."""
       return self._bers

This is the current code for the sionna.utils.plotting.PlotBER class, I very much believe that the snr function should return "_snrs" not "_ber".
Correction

def snr(self):
      """List containing all stored SNR curves."""
       return self._snrs

`PanelArray.show()` displays same antenna orientation for different polarization types.

Describe the bug
While plotting the panel array geometry using the PanelArray.show() function, the same antenna array is shown for both polarization type 'VH' and 'cross'. Ideally, the antenna orientation for cross polarization should be rotated by 45 degree w.r.t. polarization type 'VH.

To Reproduce

from sionna.channel.tr38901 import PanelArray

array = PanelArray(num_rows_per_panel = 4,
                   num_cols_per_panel = 4,
                   polarization = 'dual',
                   polarization_type = 'cross',
                   antenna_pattern = '38.901',
                   carrier_frequency = 3.5e9)

array.show()

Expected behavior
The plot when polarization type is set to 'cross' should be as below:
image

Proposed solution
The markers for antenna, when plotting figure with polarization type 'cross', should be rotated by 45 degrees.
Please find the modified PanelArray.show() function:

def show(self):
    """Show the panel array geometry"""
    marker_vert = MarkerStyle("|")
    marker_horz = MarkerStyle("_")
    if self._polarization == 'dual' and self._polarization_type == 'cross':
        marker_vert = MarkerStyle("|")
        marker_vert._transform.rotate_deg(-45)
        marker_horz = MarkerStyle("_")
        marker_horz._transform.rotate_deg(-45)

    fig = plt.figure()
    pos_pol1 = self._ant_pos_pol1
    plt.plot(pos_pol1[:,1], pos_pol1[:,2], marker = marker_vert,
        markeredgecolor='red', markersize="20", linestyle="None",
        markeredgewidth="2")
    for i, p in enumerate(pos_pol1):
        fig.axes[0].annotate(self._ant_ind_pol1[i].numpy()+1, (p[1], p[2]))
    if self._polarization == 'dual':
        pos_pol2 = self._ant_pos_pol2
        plt.plot(pos_pol2[:,1], pos_pol2[:,2], marker = marker_horz,
            markeredgecolor='black', markersize="20", linestyle="None",
            markeredgewidth="1")
    plt.xlabel("y (m)")
    plt.ylabel("z (m)")
    plt.title("Panel Array")
    plt.legend(["Polarization 1", "Polarization 2"], loc="upper right")

PolarSCLDecoder has last bit wrong

I have a test case where I compare it with results from matlab:

A = 32
P = 24
K = A+P
N = 512 # calculated according to Section 5.3.1 of 3GPP TS 38.212
decIn = np.array([98.0994,   100.2936,  -100.1615,  -111.2452,  -101.7249,  -101.5950,    78.5901,   -77.7265,   -76.4686,   -81.3223,  -115.8069,    89.6047,    85.9367,   104.1048,   -98.2053,  -106.7203,    83.1207,    88.2861,    83.8204,  -109.2175,  -124.4919,    94.6728,    91.5959,   -89.5352,  -101.8143,  -123.6915,  -103.1579,  -108.0879,   100.9417,   -95.5231,   122.5312,    99.6845,   -78.9441,   115.9421,    65.5815,    90.9532,   -88.9573,   -85.7132,   -83.5216,   -78.7969,   -54.1358,    75.8672,    84.9239,   -89.5731,   -92.8101,   -76.0732,    72.9594,   -74.3997,    93.8353,   -80.0016,    83.2706,  -104.8245,    75.5381,   -89.3799,    86.4390,    84.6055,    43.8157,  -100.4702,   -79.0332,   -89.0215,   109.9606,   -99.6110,   111.9779,  -101.8772,   -68.2989,    93.4047,    95.1260,    79.8283,    80.2065,   -89.3344,    68.9841,   -77.7767,    95.8681,   -79.4709,    62.2583,   -63.4266,   -91.1614,    81.0331,   -83.1753,   -95.7477,    79.3811,   -78.2227,   109.3239,   -70.7376,   -90.1096,   -93.8385,   -83.5296,    79.8664,  -107.2777,    86.7808,   -83.8104,   -89.5405,    83.9844,    88.8928,  -114.4005,   -81.6010,    68.2572,   100.1189,   -94.9682,  -106.6306,    94.3960,   -75.7935,   -80.0656,   -80.4422,    80.0088,    78.5461,  -101.9442,   101.2641,    79.4489,   -82.3328,    85.9272,   -93.2934,    96.1777,    88.5216,    84.3977,   -82.6021,    84.0117,    95.0405,   -86.1691,   -74.1916,   108.7456,    86.4657,   -75.5564,   -99.4773,    74.5251,    98.5329,   -83.2432,    70.5688,   -68.4671,   -79.3403,   -62.6724,   -60.8476,    67.8379,    91.1800,    87.8499,  -101.2957,   -69.6481,   -74.5603,    70.1766,   -99.2101,   101.3056,    57.1986,    87.5917,    84.1423,   -66.9824,   -62.7680,    60.1339,   -78.9674,    65.3749,   -64.6940,    50.0190,   -89.6008,   -59.3167,   -63.1129,    61.5982,    48.8499,    65.2957,   -44.2573,   -67.7464,   -87.8192,    73.3080,   -55.5333,    61.1872,    83.1372,    72.6622,    56.7458,   -90.9942,   -99.5641,   -62.1492,    75.1305,   -67.2248,    82.1078,   -71.9184,   -96.0142,   -82.4769,    63.0060,   -78.2155,    88.4656,    78.1025,   -62.1181,   -66.5374,    74.3818,    84.9285,    65.4854,    60.3368,   -59.9013,    62.8409,    45.3090,    58.8132,   -90.1745,   -80.5019,    76.9129,    53.0226,   -60.5902,    68.6878,    71.6496,   -79.5789,    68.2251,    69.2261,   -57.2262,    67.4926,   -56.8821,   -78.9174,    54.9742,   -77.1147,    72.3281,    45.8284,    74.1518,   -96.2469,    74.1641,    71.7959,   -84.9770,    75.2968,    43.3046,   -75.7478,    79.3113,   -67.3357,    83.5540,    88.1043,    92.9397,    60.5756,    96.0108,    68.6091,    56.8510,   -81.4292,   -84.7288,   -61.2944,   -77.7179,   -74.2870,    73.8435,   -68.7351,   -50.0336,    55.0304,    84.1329,    68.3470,   -42.6786,    51.2943,   -66.9083,   -66.1926,    79.1121,   -59.2044,   -69.6405,    89.3530,   -68.6773,   -78.4004,   -57.7046,   -56.9396,   -56.8815,    84.8120,    85.3458,    72.9297,    90.6085,   110.8704,    81.9232,    78.7975,   -75.6312,   -76.4349,   -65.0490,    66.5703,    77.3265,    70.3819,    58.6750,   -61.8244,    94.9379,    68.1455,    80.8718,    71.4065,   -89.3790,   -42.6856,   -64.9363,    76.2369,    69.3416,   -64.3863,   -64.0232,   -58.3138,    79.5344,    67.9879,   -79.1206,   -79.1714,    60.2715,    72.0637,    87.6743,    87.1759,    81.4093,   -74.1212,   100.5560,   -82.5535,   -56.7645,    90.7906,  -100.7988,   -64.6227,   -98.9736,    89.3586,    78.5604,    99.6034,    55.0377,    83.2926,   -72.7276,   -98.3970,    71.7933,    61.7939,    67.9014,   -69.5731,    73.2906,   -70.8013,    63.1397,   -52.9220,    80.8111,   -76.1652,    76.7023,   -66.0006,   -52.8898,   -67.6308,    85.2930,    78.6230,    75.2349,   -75.5770,    61.5977,   -82.0592,    56.5244,    73.6083,   -91.9549,   -48.5210,   -68.8685,   -87.2434,    55.9644,   -90.2183,    76.1801,   -85.3346,    66.5699,   -93.3345,    46.6941,    74.9255,   -85.1393,    65.0381,    59.5640,   -65.9826,    84.1422,   -68.0985,    74.0803,    66.0246,    83.8283,    78.7515,   -80.7086,    52.4481,   -66.9362,    56.3773,    65.2047,   -60.8237,   -76.4423,    79.9544,    76.8582,   -76.3870,   -74.6423,    50.1182,    43.6267,   -69.2405,    65.5949,    78.9524,    64.1765,   -55.5729,   -64.7979,    61.4107,   -74.2137,   -74.3217,    62.0394,   -74.1537,    69.4664,   -96.5727,   -98.9427,   -77.9188,    81.6283,   -92.4196,   -81.5016,   116.7946,   111.1792,  -104.2775,  -102.8753,   105.5464,    73.3699,  -121.8863,   -83.9218,    99.9105,   -76.7338,    71.2199,    84.3709,   123.7199,    78.3144,  -110.0666,  -102.4246,   -94.3307,    82.9367,    96.7602,    97.7912,   -85.7501,    88.8595,   -71.4018,   -73.5545,   -58.8523,  -103.0843,    97.3005,    78.5062,  -109.6570,    85.2691,   -91.4737,    87.4685,   -87.5806,   106.0338,    76.4113,   112.0384,   -78.9545,   -67.7884,   -70.9985,    84.6570,    98.7297,    91.5841,   -83.0778,   108.2129,   -94.8490,   -87.3756,  -111.9341,   -86.7001,    95.5885,   115.4110,    72.8125,  -106.4446,    80.6854,   -90.9581,    87.6573,    68.6028,   103.3637,   -92.1900,    73.5025,   -53.7392,   -64.1919,   106.1772,    79.7842,   -69.1110,   -79.4048,   -98.8703,   -57.1228,    62.4514,   -93.6077,   -45.7700,   -68.4287,    71.8675,    66.7427,   -63.6768,   -74.7351,    68.3605,   -64.5109,   -86.4599,    92.2079,   -62.3135,   -47.5140,    74.8112,   -55.6607,    72.2295,    98.2756,   -54.4462,   104.4787,   -76.8929,   -84.0509,   -87.5470,    88.1545,   -38.5373,   -73.9172,    86.9245,   -65.0378,   -62.6790,    76.2379,   -54.8815,    70.4215,   -64.9437,   -64.9268,   -78.1091,   -52.9684,   -53.5112,   -67.4531,   -47.4951,    54.0182,    62.7692,    47.2771,    64.6934,    62.8590,   -63.9107,    52.5923,    69.3743,   -64.8862,   -76.7852,   -60.9050,    51.3035,   -61.0244,    75.3462,    66.0729,   -50.1459,    61.4202,    80.4490,   -65.3638,    65.9481,    66.2290,    68.6534,    48.4402,    76.8827,   -88.6572,  -102.7420,   -94.8729,  -128.7776,  -122.5039,  -111.4672,  -105.0354,   107.5132])
from sionna.fec.polar import PolarEncoder, Polar5GEncoder, PolarSCLDecoder, Polar5GDecoder, PolarSCDecoder
from sionna.fec.polar.utils import generate_5g_ranking

# decode
frozen_pos, info_pos = generate_5g_ranking(K, N)
decoder = PolarSCLDecoder(frozen_pos, N, list_size=8, crc_degree='CRC24C', cpu_only=True, use_fast_scl=False)
decoded = np.array(decoder(np.expand_dims(decIn, 0))[0], 'int')

def interleave(c):
# 38.212 Table 5.3.1.1-1
    p_IL_max_table = [0, 2, 4, 7, 9, 14, 19, 20, 24, 25, 26, 28, 31, 34, 42, 45, 49, 50, 51, 53, 54, 56, 58, 59, 61, 62, 65, 66, 67, 69, 70, 71, 72, 76, 77, 81, 82, 83, 87, 88, 89, 91, 93, 95, 98, 101, 104, 106, 108, 110, 111, 113, 115, 118, 119, 120, 122, 123, 126, 127, 129, 132, 134, 138, 139, 140, 1, 3, 5, 8, 10, 15, 21, 27, 29, 32, 35, 43, 46, 52, 55, 57, 60, 63, 68, 73, 78, 84, 90, 92, 94, 96, 99, 102, 105, 107, 109, 112, 114, 116, 121, 124, 128, 130, 133, 135, 141, 6, 11, 16, 22, 30, 33, 36, 44, 47, 64, 74, 79, 85, 97, 100, 103, 117, 125, 131, 136, 142, 12, 17, 23, 37, 48, 75, 80, 86, 137, 143, 13, 18, 38, 144, 39, 145, 40, 146, 41, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163]
    k = 0
    K_IL_max = 164
    p = np.empty(c.shape[0], 'int')
    for p_IL_max in p_IL_max_table:
        if p_IL_max >= (K_IL_max - K):
            p[k] = p_IL_max - (K_IL_max - K)
            k += 1
    return p

# deinterleave
p_IL = interleave(decoded)
decoded2 = np.empty(decoded.shape, 'int')
np.put(decoded2, p_IL, decoded)

the result in python is
[0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]

the result in matlab when using nrPolarDecode() is
[0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0]

which is the same as in python, except the last bit. When I put the matlab result into nrCRCDecode() it says checksum ok, with the python result it says checksum wrong.

input = [0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]';
[data, cs] = nrCRCDecode(input,'24C')

gives cs = 1, which means error

input = [0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0]';
[data, cs] = nrCRCDecode(input,'24C')

gives cs = 0, which means ok

OFDMDemodulator() issue for a cyclic_prefix equal to zero

Describe the bug
Using OFDMDemodulator() with a cyclic_prefix =0 return a resource grid with num_ofdm_symbols dimension equal to zero.

To Reproduce
Please find a jupyter notebook as PDF ("OFDMDemod_bug") to reproduce the error.
OFDMDemod_bug.PDF

Expected behavior
Based on the OFDMDemodulator() description, even with a cyclic_prefix = 0, the function should return an output dimension "out: [batch_size, num_tx, num_streams_per_tx, num_ofdm_symbols, fft_size]". However, the function return an output with num_ofdm_symbols = 0.

Screenshots
OFDMDemod_bug

Additional context
The bug is directly linked to the rest variable in OFDMDemodulator() class, since using "tf.math.floormod(inputs.shape[-1], self.fft_size + self.cyclic_prefix_length)" with cyclic_prefix_length = 0 will return a zero.
As a result, inputs = inputs[...,:-rest] will return an output with last dimension equal to zero since inputs[...,:0] --> out: (64,1,1,0) (in my example), however the out should be equal to --> out: (64,1,1,1008).

Proposal: provides an if self.cyclic_prefix_length !=0: statement before the rest =...., and the inputs = inputs[...,:-rest] code lines.

Deprication warning in sionna metrics

Describe the bug
BitwiseMutualInformation and BitErrorRate implement the deprecated reset_states() method. The method should be renamed to reset_state().

To Reproduce
Execute the following code:

from sionna.utils import BitwiseMutualInformation, BitErrorRate

bmi = BitwiseMutualInformation()
bmi.reset_state()

ber = BitErrorRate()
ber.reset_state()

The following warnings will appear:

UserWarning: Metric BitwiseMutualInformation implements a `reset_states()` method; rename it to `reset_state()` (without the final "s"). The name `reset_states()` has been deprecated to improve API consistency.
  bmi.reset_state()
UserWarning: Metric BitErrorRate implements a `reset_states()` method; rename it to `reset_state()` (without the final "s"). The name `reset_states()` has been deprecated to improve API consistency.
  ber.reset_state()

Expected behavior
No warning should appear

System:

  • Python version: 3.10.4
  • TensorFlow version: 2.8.0

sionna-0.9.1 incompatible with tf-2.9.1?

Just updated to latest sionna-0.9.1 and then updated to tf-2.9.1. Tried running notebook
examples/Realistic_MIMO...

I get an enormous error traceback, starting with:

2022-05-31 13:30:39.208680: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at if_op.cc:267 : INVALID_ARGUMENT: Detected unsupported operations when trying to compile graph ldpc5g_decoder_2_while_cond_true_126375_const_0[] on XLA_GPU_JIT: RaggedRange (No registered 'RaggedRange' OpKernel for XLA_GPU_JIT devices compatible with node {{node ldpc5g_decoder_2/while/cond/RaggedRange}}){{node ldpc5g_decoder_2/while/cond/RaggedRange}}

Is this because sionna-0.9.1 is not compatible with tf-2.9.1? Or something else?

chore(deps): using a .lock file for better dependency management

Hello,

Firstly, thank you for your great work!

I'm still facing issues regarding #106, and I was wondering if that could be solved by using a more modern dependency config file / tool, with poetry or pipenv?

This would avoid having multiple requirements-*.txt files, and also avoid problems many problems if .lock file is provided.

TDL channel normalization

Hello,

The following question / remark concerns only the TDL channel models as they are the ones I have been using. Yet this may also apply to others channel models, but I don't know.

To my understanding, the current channel normalization process is done in either cir_to_time_channel() or cir_to_ofdm_channel(). The normalization is a per sample normalization as each channel sample per batch is normalized (also per couple tx/rx). Also from the documentation: normalize (bool) – If set to True, the channel is normalized over the block size to ensure unit average energy per time step. and normalize (bool) – If set to True, the channel is normalized over the resource grid to ensure unit average energy per resource element.

Instead of a per sample normalization, you could compute the normalization one time in the class init with an arbitrary sufficient number of samples. This way you wouldn't need to compute the normalization factor at each step and apply the scaling only if needed?

TensorFlow 2.6.0 tf.shape() indexing bug affect Sionna layers.

Describe the bug
For TensorFlow version 2.6.0, there is a bug in the indexing of the tf.shape() function.
Please find the reference of the bug: tensorflow/tensorflow#52571.

Some of the Sionna layer are affected by this bug, e.g. OFDMModulator.

To Reproduce
Please, find below a code to reproduce the error. (Please, make sure that the version of the tf used is 2.6.0)

import tensorflow as tf
from tensorflow.keras import Model
from sionna.ofdm import OFDMModulator,OFDMDemodulator
from sionna.utils import QAMSource

class E2ESystem(Model):
    def __init__(self):
        super().__init__()
        self.cp_length = 0
        self.fft_size = 72
        self.num_ofdm_symbols = 14
        self.qam = QAMSource(4)
        self.mod = OFDMModulator(self.cp_length)

    
    @tf.function
    def call(self, batch_size):
        x_rg = self.qam([batch_size, 1, 1, self.num_ofdm_symbols, self.fft_size])
        x_time  = self.mod(x_rg)
        return x_time


e2e = E2ESystem()
e2e(128)

Expected behavior
self.mod(x_rg) should return the modulated signal in time. However, due to the bug an error occured.

System:

  • OS: [win10]
  • NVIDIA Driver version: [511.79]
  • CUDA version: [11.2]
  • Python version: [3.9.0]
  • TensorFlow version: [2.6.0]

GPUs:

  • Model: [QUADRO RTX 5000]
  • Memory: [16GB]

Proposed solution
Replace all tf.shape()[ind] with Tensor.shape[ind]
Example solution for OFDMModulator layer:

  • Replace cp = x[...,tf.shape(inputs)[-1]-self._cyclic_prefix_length:] --> cp = x[...,inputs.shape[-1]-self._cyclic_prefix_length:]

Error when using LMMSE Equalizer function

Hi All,

I was attempting to run the Sionna Tutorial on "Part 3: Advanced Link-Level Simulations" when I encountered this error in the LMMSE Equalizer. The notebook was taken directly from the site. The Sionna version I am using is 0.14.0.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [13], in <cell line: 25>()
     23 print("Shape of h_hat: ", h_hat.shape)
     24 print("Shape of err_var: ", err_var.shape)
---> 25 x_hat, no_eff = lmmse_equ([y, h_hat, err_var, no])
     26 print("Shape of x_hat: ", x_hat.shape)
     27 print("Shape of no_eff: ", no_eff.shape)

File ~\Anaconda3\envs\Sionna\lib\site-packages\keras\utils\traceback_utils.py:70, in filter_traceback.<locals>.error_handler(*args, **kwargs)
     67     filtered_tb = _process_traceback_frames(e.__traceback__)
     68     # To get the full stack trace, call:
     69     # `tf.debugging.disable_traceback_filtering()`
---> 70     raise e.with_traceback(filtered_tb) from None
     71 finally:
     72     del filtered_tb

File ~\Anaconda3\envs\Sionna\lib\site-packages\sionna\ofdm\equalization.py:227, in OFDMEqualizer.call(self, inputs)
    220 s = tf.cast(s, self._dtype)
    222 ############################################################
    223 ### Compute symbol estimate and effective noise variance ###
    224 ############################################################
    225 # [batch_size, num_rx, num_ofdm_symbols, num_effective_subcarriers,...
    226 #  ..., num_stream_per_rx]
--> 227 x_hat, no_eff = self._equalizer(y_dt, h_dt_desired, s)
    229 ################################################
    230 ### Extract data symbols for all detected TX ###
    231 ################################################
    232 # Transpose tensor to shape
    233 # [num_rx, num_streams_per_rx, num_ofdm_symbols,...
    234 #  ..., num_effective_subcarriers, batch_size]
    235 x_hat = tf.transpose(x_hat, [1, 4, 2, 3, 0])

File ~\Anaconda3\envs\Sionna\lib\site-packages\sionna\ofdm\equalization.py:352, in LMMSEEqualizer.__init__.<locals>.equalizer(y, h, s)
    351 def equalizer(y, h, s):
--> 352     return lmmse_equalizer(y, h, s, whiten_interference)

File ~\Anaconda3\envs\Sionna\lib\site-packages\sionna\mimo\equalization.py:119, in lmmse_equalizer(y, h, s, whiten_interference)
    115     g = tf.matmul(h, matrix_inv(g), adjoint_a=True)
    117 else:
    118     # Whiten channel
--> 119     y, h  = whiten_channel(y, h, s, return_s=False) # pylint: disable=unbalanced-tuple-unpacking
    121     # Compute G
    122     i = expand_to_rank(tf.eye(h.shape[-1], dtype=s.dtype), tf.rank(s), 0)

File ~\Anaconda3\envs\Sionna\lib\site-packages\sionna\mimo\utils.py:343, in whiten_channel(y, h, s, return_s)
    296 r"""Whitens a canonical MIMO channel.
    297 
    298 Assume the canonical MIMO channel model
   (...)
    340     Only returned if ``return_s`` is `True`.
    341 """
    342 # Compute whitening matrix
--> 343 s_inv_1_2 = matrix_sqrt_inv(s)
    344 s_inv_1_2 = expand_to_rank(s_inv_1_2, tf.rank(h), 0)
    346 # Whiten obervation and channel matrix

File ~\Anaconda3\envs\Sionna\lib\site-packages\sionna\utils\tensors.py:242, in matrix_sqrt_inv(tensor)
    216 def matrix_sqrt_inv(tensor):
    217     r""" Computes the inverse square root of a Hermitian matrix.
    218 
    219     Given a batch of Hermitian positive definite matrices
   (...)
    240         See :py:attr:`~sionna.Config.xla_compat`.
    241     """
--> 242     if sn.config.xla_compat and not tf.executing_eagerly():
    243         s, u = tf.linalg.eigh(tensor)
    245         # Compute 1/sqrt of eigenvalues

AttributeError: Exception encountered when calling layer 'lmmse_equalizer' (type LMMSEEqualizer).

module 'sionna' has no attribute 'config'

Call arguments received by layer 'lmmse_equalizer' (type LMMSEEqualizer):
  • inputs=['tf.Tensor(shape=(1, 1, 4, 14, 76), dtype=complex64)', 'tf.Tensor(shape=(1, 1, 4, 1, 1, 14, 76), dtype=complex64)', 'tf.Tensor(shape=(1, 1, 1, 1, 1, 14, 76), dtype=float32)', 'tf.Tensor(shape=(), dtype=float32)']

Any suggestions on what I should do so that I can use this equalizer?

Problem with "scene.preview()"

Dear Sionna community,

First of all, thank you for providing this helpful tool.

I am currently running Sionna_Ray_Tracing_Tutorial in the Jupyter Lab environment. I faced some problems:

  1. The Tensorflow installed via pip install sionna cannot detect any GPU, while directly running pip install tensorflow works. So I have to manually re-install the TensorFlow after installing the Sionna.
    my GPU Driver Version: 512.78 CUDA Version: 11.6

  2. scene.preview() will raise error:

[Open Browser Console for more detailed log - Double click to close this message]
Model class 'RendererModel' from module 'jupyter-threejs' is loaded but can not be instantiated
TypeError: Cannot read properties of undefined (reading 'then')
    at http://localhost:8888/lab/extensions/jupyter-threejs/static/jupyter-threejs-chunk.75bff6c5b3e16e2f7d65.js?v=75bff6c5b3e16e2f7d65:1:32057
    at async Promise.all (index 20)
    at async f._make_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.267f129ae5fd6a33b390.js?v=267f129ae5fd6a33b390:1:7925)

The following is the jupyter information:

jupyter-client            8.1.0                    pypi_0    pypi
jupyter-core              5.3.0                    pypi_0    pypi
jupyter-events            0.6.3                    pypi_0    pypi
jupyter-server            2.5.0                    pypi_0    pypi
jupyter-server-fileid     0.8.0                    pypi_0    pypi
jupyter-server-terminals  0.4.4                    pypi_0    pypi
jupyter-server-ydoc       0.8.0                    pypi_0    pypi
jupyter-ydoc              0.2.3                    pypi_0    pypi
jupyterlab                3.6.2                    pypi_0    pypi
jupyterlab-pygments       0.2.2                    pypi_0    pypi
jupyterlab-server         2.21.0                   pypi_0    pypi
jupyterlab-widgets        3.0.6                    pypi_0    pypi

Do you have any ideas on how to solve it?

Thanks a lot!

_init_rate_match(k, n) gives wrong CRC degree

I want to decode the PBCH. In matlab I can do it like this

    iBIL = false;
    iIL = true;
    crcLen = 24;
    nMax = 9;
    A = 32;
    P = 24;
    K = A+P;
    N = 512;
    decIn = nrRateRecoverPolar(pbchBits_csi,K,N,iBIL);
    decBits = nrPolarDecode(decIn,K,E,polarListLength,nMax,iIL,crcLen);

However when I try it with sionna like this

    from sionna.fec.polar import PolarEncoder, Polar5GEncoder, PolarSCLDecoder, Polar5GDecoder, PolarSCDecoder
    enc = Polar5GEncoder(k=K, n=864)
    dec = Polar5GDecoder(enc, dec_type="SCL", list_size=8)
    dec(np.expand_dims(pbchBits_csi, 0))

I get a wrong (different than matlab) result. I know the matlab result is correct, because the CRC gives 0.
I found something suspicious with enc._init_rate_match(k, n), when I call it with k=54 and n=512 (or n=864) it gives CRC order 11, but it should be 24 (24C CRC polynomial). Is this a bug?

`ResourceGridDemapper` layer contains some bugs.

Describe the bug
The layer ResourceGridDemapper does not work properly.

To Reproduce
Please, find below a minimal code to reproduce the error:

import tensorflow as tf
from tensorflow.keras import Model
from sionna.ofdm import ResourceGrid,ResourceGridDemapper
from sionna.mimo import StreamManagement
from sionna.utils import QAMSource
import numpy as np

class E2ESystem(Model):
    def __init__(self):
        super().__init__()
        self.cp_length = 0
        self.fft_size = 72
        self.num_ofdm_symbols = 14
        self.num_streams_per_tx = 1
        self.subcarrier_spacing = 15e3
        self.stream_manager = StreamManagement(np.array([[1]]),1)
        self.rg = ResourceGrid(num_ofdm_symbols = self.num_ofdm_symbols,
                  fft_size = self.fft_size,
                  subcarrier_spacing = self.subcarrier_spacing,
                  num_tx = 1,
                  num_streams_per_tx = self.num_streams_per_tx)
        self.qam = QAMSource(4)
        self.rg_demap  = ResourceGridDemapper(self.rg,self.stream_manager)

    
    @tf.function
    def call(self, batch_size):
        x_rg = self.qam([batch_size, 1, 1, self.num_ofdm_symbols, self.fft_size])
        print(x_rg.shape)
        x_rg_dem = self.rg_demap(x_rg)
        return x_rg_dem

e2e = E2ESystem()
e2e(128)

Expected behavior
The ResourceGridDemapper layer should return the data mapped from the qam layer.

Proposed solution
In the ResourceGridDemapper layer replace :
1. if tf.rank(y)==5: --> if len(y.shape)==5:
2. if tf.shape(y)[-1]==1: --> if y.shape[-1]==1:
Please, find below the new version of the layer:

class _ResourceGridDemapper(Layer):
    # pylint: disable=line-too-long
    r"""ResourceGridDemapper(resource_grid, stream_management, dtype=tf.complex64, **kwargs)

    Extracts data-carrying resource elements from a resource grid.

    This layer takes as input an OFDM :class:`~sionna.ofdm.ResourceGrid` and
    extracts the data-carrying resource elements. In other words, it implements
    the reverse operation of :class:`~sionna.ofdm.ResourceGridMapper`.

    Parameters
    ----------
    resource_grid : ResourceGrid
        An instance of :class:`~sionna.ofdm.ResourceGrid`.

    stream_management : StreamManagement
        An instance of :class:`~sionna.mimo.StreamManagement`.

    dtype : tf.Dtype
        Datatype for internal calculations and the output dtype.
        Defaults to `tf.complex64`.

    Input
    -----
    : [batch_size, num_rx, num_streams_per_rx, num_ofdm_symbols, fft_size, data_dim]
        The full OFDM resource grid in the frequency domain.
        The last dimension `data_dim` is optional. If `data_dim`
        is used, it refers to the dimensionality of the data that should be
        demapped to individual streams. An example would be LLRs.

    Output
    ------
    : [batch_size, num_rx, num_streams_per_rx, num_data_symbols, data_dim]
        The data that were mapped into the resource grid.
        The last dimension `data_dim` is only returned if it was used for the
        input.
    """
    def __init__(self,
                 resource_grid,
                 stream_management,
                 dtype=tf.complex64,
                 **kwargs):
        super().__init__(dtype=dtype, **kwargs)
        self._stream_management = stream_management
        self._resource_grid = resource_grid

        # Precompute indices to extract data symbols
        mask = resource_grid.pilot_pattern.mask
        num_data_symbols = resource_grid.pilot_pattern.num_data_symbols
        data_ind = tf.argsort(flatten_last_dims(mask), direction="ASCENDING")
        self._data_ind = data_ind[...,:num_data_symbols]

    def call(self, y): # pylint: disable=arguments-renamed

        # y has shape
        # [batch_size, num_rx, num_streams_per_rx, num_ofdm_symbols,...
        # ..., fft_size, data_dim]

        # If data_dim is not provided, add a dummy dimension
        if len(y.shape)==5:
            y = tf.expand_dims(y, -1)

        # Remove nulled subcarriers from y (guards, dc). New shape:
        # [batch_size, num_rx, num_rx_ant, ...
        #  ..., num_ofdm_symbols, num_effective_subcarriers, data dim]
        y = tf.gather(y, self._resource_grid.effective_subcarrier_ind, axis=-2)

        # Transpose tensor to shape
        # [num_rx, num_streams_per_rx, num_ofdm_symbols,...
        #  ..., num_effective_subcarriers, data_dim, batch_size]
        y = tf.transpose(y, [1, 2, 3, 4, 5, 0])

        # Merge num_rx amd num_streams_per_rx
        # [num_rx * num_streams_per_rx, num_ofdm_symbols,...
        #  ...,num_effective_subcarriers, data_dim, batch_size]
        y = flatten_dims(y, 2, 0)

        # Put first dimension into the right ordering
        stream_ind = self._stream_management.stream_ind
        y = tf.gather(y, stream_ind, axis=0)

        # Reshape first dimensions to [num_tx, num_streams] so that
        # we can compared to the way the streams were created.
        # [num_tx, num_streams, num_ofdm_symbols, num_effective_subcarriers,...
        #  ..., data_dim, batch_size]
        num_streams = self._stream_management.num_streams_per_tx
        num_tx = self._stream_management.num_tx
        y = split_dim(y, [num_tx, num_streams], 0)

        # Flatten resource grid dimensions
        # [num_tx, num_streams, num_ofdm_symbols*num_effective_subcarriers,...
        #  ..., data_dim, batch_size]
        y = flatten_dims(y, 2, 2)

        # Gather data symbols
        # [num_tx, num_streams, num_data_symbols, data_dim, batch_size]
        y = tf.gather(y, self._data_ind, batch_dims=2, axis=2)

        # Put batch_dim first
        # [batch_size, num_tx, num_streams, num_data_symbols]
        y = tf.transpose(y, [4, 0, 1, 2, 3])

        # Squeeze data_dim
        if y.shape[-1]==1:
            y = tf.squeeze(y, -1)

        return y

Mac M1 Could not find compiler for platform METAL

Describe the bug
I am trying to execute "Part 2: Differentiable Communication Systems" on my macos m1 based python environment.

To Reproduce
Steps to reproduce the behavior:
When I execute the following part, I get an error

ber_plots.simulate(model,
                  ebno_dbs=np.linspace(EBN0_DB_MIN, EBN0_DB_MAX, 20),
                  batch_size=BATCH_SIZE,
                  num_target_block_errors=100, # simulate until 100 block errors occured
                  legend="Untrained model",
                  soft_estimates=True,
                  max_mc_iter=100, # run 100 Monte-Carlo simulations (each with batch_size samples)
                  show_fig=True);

Error:


tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at xla_ops.cc:296 : UNIMPLEMENTED: Could not find compiler for platform METAL: NOT_FOUND: could not find registered compiler for platform METAL -- check target linkage
Traceback (most recent call last):

  File "/Users/ozgur/miniforge3/lib/python3.9/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "/Users/ozgur/Dropbox/MyPublications/6G/sionna_ex/basic_tutorial_02.py", line 252, in <module>
    ber_plots.simulate(model,

  File "/Users/ozgur/miniforge3/lib/python3.9/site-packages/sionna/utils/plotting.py", line 411, in simulate
    ber, bler = sim_ber(mc_fun,

  File "/Users/ozgur/miniforge3/lib/python3.9/site-packages/sionna/utils/misc.py", line 633, in sim_ber
    outputs = mc_fun(batch_size=batch_size, ebno_db=ebno_dbs[i])

  File "/Users/ozgur/miniforge3/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None

  File "/Users/ozgur/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 54, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,

UnimplementedError: Could not find compiler for platform METAL: NOT_FOUND: could not find registered compiler for platform METAL -- check target linkage [Op:__inference___call___123156]

Ray Tracing Channel based key extraction

Hello,

I want to build a channel-based key extraction using ray tracing. For this, I calculate the CIR based on the paths and then create an OFDM channel with the CIR. In the end, I simulate some noise on the channel with awgn.
My problem now is that h_alice and h_bob only have a shape of (48, ) which is not a lot and also not enough channel output to calculate a secure key.
Is there some way to up this shape?

In issue #108 it was proposed to use a flat fading channel and a batch_size of 1000. Is there something similar I can use for this scenario? I found the CIRDataset class, where I could set a batch_size, but I don't understand how to use the required generator in this case or if this even is the correct way.

I have added my code below.

Thank you,
Emily

# Load example scene
scene_munich = load_scene(sn.rt.scene.munich)

# Configure antenna array for all transmitters
scene_munich.tx_array = PlanarArray(num_rows=1,
                          num_cols=1,
                          vertical_spacing=0.5,
                          horizontal_spacing=0.5,
                          pattern="tr38901",
                          polarization="V")

# Configure antenna array for all receivers
scene_munich.rx_array = PlanarArray(num_rows=1,
                          num_cols=1,
                          vertical_spacing=0.5,
                          horizontal_spacing=0.5,
                          pattern="dipole",
                          polarization="V")

# Create transmitter
tx = Transmitter(name="tx",
              position=[8.5,21,27],
              orientation=[0,0,0])
scene_munich.add(tx)

# Create a receiver
rx = Receiver(name="rx",
           position=[45,90,1.5],
           orientation=[0,0,0])
scene_munich.add(rx)

# TX points towards RX
tx.look_at(rx)

scene_munich.frequency = 2.14e9
scene_munich.synthetic_array = True

paths_munich = scene_munich.compute_paths()

# Default parameters in the PUSCHConfig
subcarrier_spacing = 15e3
fft_size = 48

# Transform paths into channel impulse responses
p2c = Paths2CIR(sampling_frequency=subcarrier_spacing,
                num_time_steps=1,
                scene=scene_munich)
a, tau = p2c(paths_munich.as_tuple())

# Compute frequencies of subcarriers and center around carrier frequency
frequencies = subcarrier_frequencies(fft_size, subcarrier_spacing)

# Compute the frequency response of the channel at frequencies.
h_freq = tf.squeeze(cir_to_ofdm_channel(frequencies,
                             a,
                             tau,
                             normalize=True)) # Non-normalized includes path-loss

# Setup resource grid
rg = ResourceGrid(num_ofdm_symbols=1,
                  fft_size=fft_size,
                  subcarrier_spacing=15e3)

# Generate time channel from CIR
l_min, l_max = time_lag_discrete_time_channel(rg.bandwidth)
h_time = cir_to_time_channel(rg.bandwidth, a, tau, l_min=l_min, l_max=l_max, normalize=True)

# Generate OFDM channel from time channel
h_freq_hat = tf.squeeze(time_to_ofdm_channel(h_time, rg, l_min))

awgn = AWGN() # -> Used to simulate internal noise of wireless receivers

no = 0.01 # MSE of the channel estimate (Noise variance)

h_alice = awgn([h_freq_hat, no])
h_bob = awgn([h_freq_hat, no])

Data set used by Neural network

Hello,

I was wondering if it is possible to sene me the data set you used for the neural receiver's training?

I wanted to ask you if you have any other example that model the LS channel estimator using neural receiver? I need a data set to just model LS Channel estimator using neural network.

Any help from you is really appreciated,

OFDMModulator() returns a time-domain OFDM signal with `size = None` (in training)

Describe the bug
The class OFDMModulator() returns a time-domain OFDM signal with size = None while Training the Keras model. (only while training the model)

To Reproduce
Please find a gist link : "https://gist.github.com/kassankar/70d62384d05b00fa8b9486ed862a4784" to reproduce the error.

The bug occurred while running block number 7 due to OFDMModulator() in block number 6.

Expected behavior
Based on the OFDMModulator description, the function should return an output size = num_ofdm_symbols*(fft_size+cyclic_prefix_length)

Screenshots

image

Additional context
The problem is directly connected to the function flatten_last_dims() used in the OFDMModulator() class. More precisely, in the last two lines new_shape = tf.concat([shape[:-num_dims], [-1]], 0), return tf.reshape(tensor, new_shape). I think the problem is occuring due to the use of [-1] in the tf.reshape() function. In the training the batch_size is equal to None, and based on the description of the tf.reshape() function with an axis shape = [-1], the dimension is computed so that the total size remains constant. However, due to batch_size = None, the tf.reshape() return another 'None' dimension for the last output.

Note: tf.reshape() with [-1] is also used in OFDMDemodulator(), in
new_shape = tf.concat([tf.shape(inputs)[:-1], [-1], [self.fft_size + self.cyclic_prefix_length]], 0)

Simulating a single transmitter transmitting to multiple receiver

Hi! First of all thank you for this software.
I was trying to build a simulation where 2 MIMO BS receive data from a single-antenna receiver. Accordingly, I set the number of tx_streams to be equal to 1; however, the StreamManagement object returns that the _detection_desired_ind is empty, because the num_streams_per_rx is 0. Therefore, the stream results undesired to both receiver and the LMMSEEqualizer tries to output an empty x_hat estimated from an empty h_dt_desired tensor. This generated an error in line 241 of ofdm/equalizer.py, when x_hat is reshaped.

Is this a bug, or is it intended? If the latter, did I make some mistake in the set up?
In the follows, I paste the code for the setup of the Stream Management, while is it attach the whole script (only 86 lines of code).
Thank you!

self._num_ut = 1
self._num_bs = 2
self._num_ut_ant = 1
self._num_bs_ant = 64
self._num_streams_per_tx = self._num_ut_ant
self._perfect_csi = perfect_csi

# Setup Stream Management
self._rx_tx_association = np.zeros([self._num_bs, self._num_ut])
self._rx_tx_association[:, 0] = 1
self._stream_management = sn.mimo.StreamManagement(self._rx_tx_association, self._num_streams_per_tx)

rayleigh_experiment.zip

Screenshots
Added the screenshot of the error:
Screenshot from 2022-11-25 16-06-33

System:

  • OS: Ubuntu 20.04 and Linux Mint (last)
  • NVIDIA Driver version: 510.85.02
  • CUDA version: 11.6
  • Python version: 3.7 and 3.8
  • TensorFlow version: 2.6.2
    Tested also in Google collab, same issue there.

Model class 'RendererModel' from module 'jupyter-threejs' is loaded but can not be instantiated in raytrace demo

In raytrace demo, running on local gpu (not colab), when executing scene.preview(), I get

[Open Browser Console for more detailed log - Double click to close this message]
Model class 'RendererModel' from module 'jupyter-threejs' is loaded but can not be instantiated
1233/e/<@http://localhost:8888/lab/extensions/jupyter-threejs/static/jupyter-threejs-chunk.75bff6c5b3e16e2f7d65.js?v=75bff6c5b3e16e2f7d65:1:32036

Here is a screenshot
sionna-raytrace-error

ValueError: Cannot convert a partially known TensorShape to a Tensor: (None, 4) at sim_ber() function under MIMO_OFDM_Transmissions_over_CDL project

I'm using the CPU itself for testing. Tensorflow version used - 2.6.2

Error faced ----> ValueError: Cannot convert a partially known TensorShape to a Tensor: (None, 4)


While running the Compare Uplink Performance Over the CDL Models block of the MIMO_OFDM_Transmissions_over_CDL project, I face the TensorShape error under sim_ber() function. [Only change I made is replacing num_target_block_errors with num_target_bit_errors. Rest entire code is same]

image


Further debugging into the sim_ber() function, the exact line where this issue occurs is here (highlighted section) ->

image


Please refer to the error logs as per this .txt file ->
TensorShape_issue.txt

Issue with OFDMDetectorWithPrior with nulled subcarriers

Describe the bug
When applying an OFDM resource grid with nulled subcarriers (e.g. DC carriers and guard carriers), any non-zero prior leads to very poor detection performance (e.g. BLER=1). I assume that the problem lies in the indices in self._data_ind_scatter, which correspond to indices of data symbols of the whole OFDM resource grid, but not to the indices of the resource grid with removed nulled subcarriers. This becomes problematic in line 504, where the prior template applies num_effective_subcarriers in the fourth tensor dimension. My suggestion to fix this issue is to change line 449 to the following:

remove_nulled_sc = RemoveNulledSubcarriers(resource_grid)
self._data_ind_scatter = tf.where(remove_nulled_sc(rg_type)==0)

To Reproduce
Steps to reproduce the behavior:

  1. Apply the MMSE PIC OFDM detector with any ODFM resource grid which includes nulled subcarriers
  2. Provide the MMSE PIC with any (e.g. Gaussian) prior
  3. Benchmark BER/BLER

System:

  • OS: Ubuntu 20.04.4 LTS, CentOS
  • NVIDIA Driver version: 450.203.03, 515.65.01
  • CUDA version: 11.0 and 11.7
  • Python version: 3.8
  • TensorFlow version: 2.7.4

GPUs:

  • Model: A100-80GB
  • Memory: 80GB

Error installing with tensorflow2.1

Describe the bug
The following error occurred when installing in my tensorflow2.1(with ptthon3.7) environment:

File "C:\Downloads\sionna\sionna-main\sionna\utils\misc.py", line 10, in <module>
    from tensorflow.experimental.numpy import log10 as _log10
ModuleNotFoundError: No module named 'tensorflow.experimental'

To Reproduce
Steps to reproduce the behavior:

  1. Download the compressed file and decompress it;
  2. Enter the decompression directory;
  3. Switch to your own tensorflow environment(such as:activate TF2.1)
  4. pip install sionna

Screenshots
If applicable, add screenshots to help explain your problem.

System:

  • OS: [Windows 10]
  • CUDA version: [10.0]
  • Python version: [3.7.13]
  • TensorFlow version: [2.1.0]

8PSK constellation diagram

Hi!

I wanted to compare different Bit Error Rates for different modulations (QPSK, 8PSK and 16QAM) for the uncoded and encoded case (LDPC).
The system is is the same, just the modulation differs...

output1
output2

I'm not sure if the 8PSK plot is correct. Especially in the encoded case, as the BER doesnt seem to improve with the encoder.
For the QAM and 16QAM the encoded plot looks better, as an improvement is visible, in contrast to the uncoded case.
Where I think the mistake may be, is during the set up of the constellation diagram for the mapper and demapper:

8PSK:
const8PSK

NUM_BITS_PER_SYMBOL = 3
BLOCK_LENGTH = 3**8
n=12*3

real = 1 * np.cos(np.pi/4)
imag = 1 * np.sin(np.pi/4)
CONST_SHAPE = np.array([-1, 1, 1j, -1j, complex(real, imag), complex(real, -imag), complex(-real, imag), complex(-real, -imag)]) # set the shape of the constellation diagram
constellation = sn.mapping.Constellation("custom", NUM_BITS_PER_SYMBOL, CONST_SHAPE, normalize=True, center=True)
constellation.show()

16QAM:
const16qam

NUM_BITS_PER_SYMBOL = 4
BLOCK_LENGTH = 2**8
n=2**8

constellation = sn.mapping.Constellation("qam", NUM_BITS_PER_SYMBOL, normalize=True, center=True)
constellation.show();

QPSK:
constqpsk

NUM_BITS_PER_SYMBOL = 2
BLOCK_LENGTH = 2**8
n=2**8

constellation = sn.mapping.Constellation("qam", NUM_BITS_PER_SYMBOL, normalize=True, center=True)
constellation.show();

Any help or ideas would be greatly appriciated, thanks!

pip install wants to pull in tf-2.9.1, which isn't compatible

Describe the bug

pip install . from sionna source would fail, as it starts by downloading tf-2.9.1, which is not compatible.
Odd, because requirement says <2.10, which apparently doesn't work.

pip install .
Defaulting to user installation because normal site-packages is not writeable
Processing /home/nbecker/sionna
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: matplotlib in /usr/lib64/python3.10/site-packages (from sionna==0.10.0) (3.5.2)
Requirement already satisfied: importlib-resources in /home/nbecker/.local/lib/python3.10/site-packages (from sionna==0.10.0) (3.3.1)
Collecting tensorflow!=2.7.0,!=2.7.1,!=2.8.0,<2.10,>=2.6.4
  Downloading tensorflow-2.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (511.7 MB)

To Reproduce

  1. git clone https://github.com/NVlabs/sionna.git
  2. cd sionna
  3. pip install .

System:

  • OS: fedora-36
  • NVIDIA Driver version: N/A
  • CUDA version: N/A
  • Python version: 3.10.5
  • TensorFlow version: N/A

GPUs:

  • Model: [e.g. RTX 3090]
  • Memory: [e.g. 24GB]

Additional context
Add any other context about the problem here.

Channel decoder should (optionally) return CRC status

As discussed in this PR, it would be nice if the decoder functions return the CRC status (ok or failed). Sebastian suggested to add an extra flag return_crc_status to the decoder routine to enable the CRC status output optionally. Should I make a PR for this or is somebody else already on it?

fec: ldpc: _llr_max attribute overwritten in base LDPCBPDecoder class

Describe the bug
_llr_max attribute is set in both LDPC5GDecoder and LDPCBPDecoder. Since the initialization of the latter is done after the setting in the child class, this might create some inconsistency.

To Reproduce
Static code analysis, so not required IMO.

Expected behavior
Set the value only in one place (e.g. in parent class and passing it as argument).

Screenshots
N/A

System:
N/A

GPUs:
N/A

Additional context
N/A

CUDA backend disabled when trying to import Sionna

I'm trying to run the ray tracing tutorial notebook. After running the imports' cell I get the following error:
jit_cuda_api_init(): could not find symbol "cuDevicePrimaryCtxRelease_v2" -- disabling CUDA backend!

When I start a Python interactive session and try to import sionna I get more errors:

jit_cuda_api_init(): could not find symbol "cuDevicePrimaryCtxRelease_v2" -- disabling CUDA backend!
2023-03-29 17:18:42.865875: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:982] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-03-29 17:18:42.906978: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:982] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-03-29 17:18:42.907998: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:982] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
Traceback (most recent call last):
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/mitsuba/__init__.py", line 107, in __getattribute__
    _import('mitsuba.mitsuba_' + variant + '_ext'),
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 556, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1166, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: jit_init_thread_state(): the CUDA backend hasn't been initialized. Make sure to call jit_init(JitBackend::CUDA) to properly initialize this backend.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/sionna/__init__.py", line 19, in <module>
    from . import rt
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/sionna/rt/__init__.py", line 23, in <module>
    mi.set_variant('cuda_ad_rgb')
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/mitsuba/__init__.py", line 317, in set_variant
    _import('mitsuba.ad.integrators')
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/mitsuba/python/ad/__init__.py", line 1, in <module>
    from .integrators import *
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/mitsuba/python/ad/integrators/__init__.py", line 25, in <module>
    importlib.import_module('mitsuba.ad.integrators.' + name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/mitsuba/python/ad/integrators/prb_basic.py", line 6, in <module>
    from .common import RBIntegrator
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/mitsuba/python/ad/integrators/common.py", line 8, in <module>
    class ADIntegrator(mi.CppADIntegrator):
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/mitsuba/__init__.py", line 253, in __getattribute__
    result = module.__getattribute__(key)
  File "/home/tyassine/.virtualenvs/sionna/lib/python3.8/site-packages/mitsuba/__init__.py", line 115, in __getattribute__
    raise AttributeError(e)
AttributeError: jit_init_thread_state(): the CUDA backend hasn't been initialized. Make sure to call jit_init(JitBackend::CUDA) to properly initialize this backend.

I'm using WSL2. I installed the NVIDIA drivers and toolkits following the NVIDIA docs. I have the latest NVIDIA drivers installed on windows and have purposely intalled version 11.8 of the NVIDIA toolkit to comply with TF's requirements. I should mention that I encountered some problems related to some environment variables (CUDNN_PATH and LD_LIBRARY_PATH) not properly set that I manually managed to fix.

Any idea on what causes this?
Thanks in advance!

validation and add new scenarios

  1. The tdlb channel we verified is quite different from that TS38.901, as shown in the following figure.
    image

  2. In UMI, UMA and RMA scenarios, the validation results of batch size=400000 and 500000 are quite different. How to set this parameters

  3. I wonder is there a plan to add an indoor office scenarios.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.