Create camera sensor fail on buffer

I have problems creating a camera sensor with enable_tensors set to True. The interop_torch.py example fails with the same error.
The line
cam_handle = gym.create_camera_sensor(env, cam_props)
throw the following error:

[Error] [carb.gym.plugin] cudaExternamMemoryGetMappedBuffer failed on depthImage buffer with error 101
[Error] [carb.gym.plugin] cudaExternamMemoryGetMappedBuffer failed on segmentationImage buffer with error 101
[Error] [carb.gym.plugin] cudaExternamMemoryGetMappedBuffer failed on optical flow buffer with error 101

And the PyTorch tensor can’t be created afterwards.

Here is the full output of the interop_torch.py example:



```/usr/bin/python3.8 /snap/pycharm-community/248/plugins/python-ce/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 40069 --file /home/alex/isaacgym/python/examples/interop_torch.py
Connected to pydev debugger (build 212.4746.96)
Importing module 'gym_38' (/home/alex/isaacgym/python/isaacgym/_bindings/linux-x86_64/gym_38.so)
Setting GYM_USD_PLUG_INFO_PATH to /home/alex/isaacgym/python/isaacgym/_bindings/linux-x86_64/usd/plugInfo.json
PyTorch version 1.9.0+cu111
Device count 2
/home/alex/isaacgym/python/isaacgym/_bindings/src/gymtorch
Using /home/alex/.cache/torch_extensions as PyTorch extensions root...
Emitting ninja build file /home/alex/.cache/torch_extensions/gymtorch/build.ninja...
Building extension module gymtorch...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module gymtorch...
Not connected to PVD
+++ Using GPU PhysX
Physics Engine: PhysX
Physics Device: cuda:0
GPU Pipeline: enabled
[Error] [carb.gym.plugin] cudaExternamMemoryGetMappedBuffer failed on rgbImage buffer with error 101
[Error] [carb.gym.plugin] cudaExternamMemoryGetMappedBuffer failed on depthImage buffer with error 101
[Error] [carb.gym.plugin] cudaExternamMemoryGetMappedBuffer failed on segmentationImage buffer with error 101
[Error] [carb.gym.plugin] cudaExternamMemoryGetMappedBuffer failed on optical flow buffer with error 101
Got camera tensor with shape (128, 128, 4)
*** Can't create empty tensor
Traceback (most recent call last):
  File "/snap/pycharm-community/248/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/snap/pycharm-community/248/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/alex/isaacgym/python/examples/interop_torch.py", line 121, in <module>
    print("  Torch camera tensor device:", torch_cam_tensor.device)
AttributeError: 'NoneType' object has no attribute 'device'
python-BaseException
1 Like

I have been able to make it work by removing a GPU from my machine. Before I had a 1080 TI and RTX 3080 in my PC. If I remove the 1080 TI the example works without problems. However, I would still like to keep both GPUs installed.

Hi @kogli2000

To bypass the issue for now, you can try setting CUDA_VISIBLE_DEVICES to just one of your GPUs when running your script so you do not have to remove your other GPU for it to work.

This works unfortunately only for the 1080 TI. When I select the RTX 3080 I receive a segfault.

Importing module 'gym_38' (/home/alex/isaacgym/python/isaacgym/_bindings/linux-x86_64/gym_38.so)
Setting GYM_USD_PLUG_INFO_PATH to /home/alex/isaacgym/python/isaacgym/_bindings/linux-x86_64/usd/plugInfo.json
PyTorch version 1.9.0+cu111
Device count 1
/home/alex/isaacgym/python/isaacgym/_bindings/src/gymtorch
Using /home/alex/.cache/torch_extensions as PyTorch extensions root...
Emitting ninja build file /home/alex/.cache/torch_extensions/gymtorch/build.ninja...
Building extension module gymtorch...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module gymtorch...
Not connected to PVD
+++ Using GPU PhysX
Physics Engine: PhysX
Physics Device: cuda:0
GPU Pipeline: enabled
Segmentation fault (core dumped)
1 Like

I have finally solved this problem by also setting the ‘MESA_VK_DEVICE_SELECT’ variable.

So this is the code I used. And it has to be run before any isaacgym import.

os.environ['MESA_VK_DEVICE_SELECT'] = '10de:2206'
os.environ["CUDA_VISIBLE_DEVICES"] = '0'

The device id can be figured out with the command

MESA_VK_DEVICE_SELECT=list vulkaninfo
2 Likes