Crash after modifying shape and radio devices positions & orientations (-1073740791 (0xC0000409))
I tried to modify the position of the vehicle in the scene and set the receiver and transmitter to face the vehicle, but after looping through 60 different positions, I got the following error:
正在仿真: 2%|▏ | 1/60 [00:00<00:39, 1.50it/s]
进程已结束,退出代码为 -1073740791 (0xC0000409)
my code:
car_metal=scene.get("car-itu_metal")
car_glass=scene.get("car-itu_glass")
print("car_glass_position:",car_glass.position.numpy())
print("car_metal_position:",car_metal.position.numpy())
tx_position=[46.25,1.7,10.28]
rx_position=tx_position
scene.add(Transmitter("tx", position=tx_position, look_at=car_glass.position.numpy() , power_dbm=30, color=[0.8, 0.1, 0.1]))
scene.tx_array = PlanarArray(1, 1, 0.5, 0.5, "iso", "V")
#------------------------------------------------------
scene.add(Receiver("rx", position=rx_position,look_at=car_glass.position.numpy()))
scene.rx_array =PlanarArray(1, 1, 0.5, 0.5, "iso", "V")
scene.synthetic_array = True
Gr_gain=compute_gain(iso_pattern)
print("gain:",Gr_gain)
clear_directory(r'.\Figure')
#----------------------------------------------
scene.add(Camera("cam", position=[1,1,1], look_at=tx_position))
displaycement_vec=[0.5,0,0]
#===============
print(f" start:Time= {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
start_time = time.time()
for snapid in tqdm(range(60), desc="prograssing"):
paths = scene.compute_paths(
max_depth=3,
num_samples=1e5,
los=True,
reflection=True,
diffraction=True,
scattering=True
)
scene.get("car-itu_metal").position +=displaycement_vec
scene.get("car-itu_glass").position +=displaycement_vec
paths.normalize_delays = False
H_rt = np.squeeze(cir_to_ofdm_channel(frequencies, *paths.cir(), normalize=False))
h_rt = np.squeeze(cir_to_time_channel(bandwidth, *paths.cir(), 0, 1023, normalize=False))
H_rt_list.append(H_rt)
h_rt_list.append(h_rt)
rt_paths['a'][snapid] = tf.squeeze(paths.a).numpy()
rt_paths['tau'][snapid] = tf.squeeze(paths.tau).numpy() * 1e9 # ns
rt_paths['theta_t'][snapid] = tf.squeeze(paths.theta_t).numpy()
rt_paths['phi_t'][snapid] = tf.squeeze(paths.phi_t).numpy()
rt_paths['theta_r'][snapid] = tf.squeeze(paths.theta_r).numpy()
rt_paths['phi_r'][snapid] = tf.squeeze(paths.phi_r).numpy()
rt_paths['source_coordinates'][snapid] = tf.squeeze(paths.sources).numpy()
rt_paths['target_coordinates'][snapid] = tf.squeeze(paths.targets).numpy()
rt_paths['Transmitter_coordinates'][snapid] = list(scene.transmitters.values())[0].position.numpy()
rt_paths['Receiver_coordinates'][snapid] = list(scene.receivers.values())[0].position.numpy()
rt_paths['mask'][snapid] = tf.squeeze(paths.mask).numpy()
rt_paths['objects'][snapid] = tf.squeeze(paths.objects).numpy()
rt_paths['types'][snapid] = tf.squeeze(paths.types).numpy()
rt_paths['vertices'][snapid] = tf.squeeze(paths.vertices).numpy()
end_time = time.time()
print(f" end:Time= {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
print(f"cost: {end_time - start_time} seconds")
Hello @potatoess11,
Could you please try again with the latest release (1.0.1) and report back if the issue still persists?
Hello @merlinND,
I got the same error (-1073740791 (0xC0000409)) when using load_scene() in Sionna 1.0.1, but it works with Sionna 0.19.1.
My code is the same as the new tutorial (Introduction to Sionna RT):
# Import Sionna
import sionna.rt
# Other imports
import matplotlib.pyplot as plt
import numpy as np
# Import relevant components from Sionna RT
from sionna.rt import load_scene, PlanarArray, Transmitter, Receiver, Camera,\
PathSolver, RadioMapSolver, subcarrier_frequencies
scene = load_scene(sionna.rt.scene.etoile)
Hello @NekoYuchi,
Could you please share all of the details of your system (OS, Python version, NVIDIA driver version if any, GPU model if any, etc) as well as the full output of running your script? I tried it locally with your code snippet, but it executes fine on my machine.
Hello @merlinND ,
Here are the details of my system:
- OS: Windows 11 24H2 26100.3476
- Python version: 3.10.1
- Sionna version: 1.0.1
- Laptop GPU: NVIDIA GeForce MX450
- GPU driver version: 572.70
- CUDA version: 11.2
But I am running my code on CPU, not GPU. So it doesn't seem to be an issue with the graphics card.
And here is the full output:
- When using Jupyterlab (4.3.6), it said:
The kernel for channel_v1.ipynb appears to have died. It will restart automatically.
- When using Pycharm (2024.3.4 Community), it just said:
D:\Code\Sionna101.venv\Scripts\python.exe D:\Code\Sionna101\test.py
Process finished with exit code -1073740791 (0xC0000409)
Btw, when debugging step by step, it was discovered that the program was continuously looping in file: ElementPath.py. e.tag in elem equals to 'shape', so it keeps looping from for e in elem: to if e.tag == tag:. I'm not sure if this is related to the issue.
def prepare_child(next, token):
tag = token[1]
if _is_wildcard_tag(tag):
select_tag = _prepare_tag(tag)
def select(context, result):
def select_child(result):
for elem in result:
yield from elem
return select_tag(context, select_child(result))
else:
if tag[:2] == '{}':
tag = tag[2:] # '{}tag' == 'tag'
def select(context, result):
for elem in result:
for e in elem:
if e.tag == tag:
yield e
return select
I hope these can help you.
Thanks for these details @NekoYuchi.
Your sample code referred to sionna.rt.scene.etoile. Did you make any modification to the scene XML? I'm attaching the version I've just confirmed works for me (Python 3.10.16).
Thanks for your response @merlinND.
I did not modify the scene XML. I've tried with scene = load_scene(), but loading an empty scene would also result in this error. I am testing on my colleague's laptop to see if there is a similar issue.
I've tried it on my colleague's laptop (Python 3.12.1 and Sionna 1.0.1). scene = load_scene() still didn't work with exit code -1073741819 (0xC0000005). I'm not sure if it is due to an incompatibility issue or something else. If you have any further insights, please let me know. Thanks!
Hello @NekoYuchi,
I've tried reproducing on a Windows laptop with driver 572.83, Python 3.11.0 and Sionna 1.0.1. The scene loaded without issues.
As a workaround, could you try using the CPU to check that this works at least
import mitsuba as mi
mi.set_variant("llvm_ad_mono_polarized")
# ... (the rest of your script)
You might have to install LLVM if you have never used the CPU backend before.
Thanks for your response @merlinND.
Your code worked! The issue is resolved now.
Btw, I have installed LLVM and I found that the issue might be related to the Mitsuba version. In version 3.6.2 (Sionna 1.0.1), Mitsuba depends on DrJit 1.0.3, while in 3.5.2 (Sionna 0.19.2), it depends on DrJit 0.4.6. This version difference might be the reason? On my laptop (when using Mitsuba 3.6.2 in Sionna 1.0.1), I have to write mi.set_variant("llvm_ad_mono_polarized") at beginning to avoid this issue.
I really appreciate your support! Let me know if you have any insights on this. Thanks again!
Glad this workaround works for you, although it would have been great to be able to use the GPU!
Mitsuba and DrJit indeed got major updates and Sionna RT 1.0+ relies on them. It's possible that some of those changes are related to the crash you are encountering, but since I cannot reproduce locally it is difficult to tell :(
But I don't know if @potatoess11‘s problem has been solved. Maybe you can try this method.
I really appreciate your help! This is indeed a strange issue. Considering the major updates in Mitsuba and DrJit, it makes sense that some changes might be related to the issue. Hopefully, future updates to these libraries will address this. Thanks again for your help!
One way to further debug would be to try running the basic Mitsuba hello world & tutorials (https://mitsuba.readthedocs.io/en/latest/#hello-world) to see if the same problem occurs, or whether it's specific to Sionna RT.
That makes sense! I'll try running the basic Mitsuba hello world & tutorials to see if the issue persists outside of Sionna RT. Hopefully, this will help narrow down the cause. If I find anything new, I'll report back. 🧐
Hello @potatoess11,
Could you please try again with the latest release (1.0.1) and report back if the issue still persists?
hi,I tried to change the location of the car in the .xml file several times and visualize the path in the transformed scene, but the three images I visualized were identical.
displacement_vec=[-10,0,0]
print(f" start:Time= {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
start_time = time.time()
num_displacements = 2
for _ in range(num_displacements+1):
paths = p_solver(scene=scene,
max_depth=5,
synthetic_array=False,
los=True,
specular_reflection=True,
diffuse_reflection=False,
refraction=True,
seed=41)
scene.scene_geometry_updated()
if no_preview:
scene.render(camera=my_cam, paths=paths, clip_at=20);
else:
scene.preview(paths=paths, clip_at=20);
H_rt = np.squeeze(paths.cfr(frequencies=frequencies,
normalize=False, # Normalize energy
normalize_delays=False,
out_type="numpy"))
print("Shape of H_rt: ", H_rt.shape)
h_rt = np.squeeze(paths.taps(bandwidth, 0, 1023, sampling_frequency=None, normalize_delays=False, normalize=False,
out_type="numpy"))
print("Shape of h_rt: ", h_rt.shape)
complex_a = paths.a[0].numpy()[:, :, :, :, :] + 1j * paths.a[1].numpy()[:, :, :, :, :]
print("complex_a:", complex_a.shape)
car_glass.position = car_glass.position - displacement_vec
car_metal.position = car_metal.position - displacement_vec
print(f"car_glass now: {car_glass.position}, car_metal now: {car_metal.position}")
end_time = time.time()
print(f" end:Time= {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
print(f"RT cost: {end_time - start_time} s")
Hello @potatoess11,
Could you try a simpler version of your script to narrow down the source of the problem. If you only:
- Set the location in the car in the XML file by setting its
to_worldtransform - Load the scene in Sionna
- Render with
scene.render_to_file(),
then you should see the car's position changing based on the values you set in the XML.
Closing due to inactivity