Get cuda device pointer from SyntheticData SdRenderVarPtr node


I’ve been digging around for a way to get a GPU handle to a render product. The SyntheticData SdRenderVarPtr node seems promising as it can be hooked up to a viewports render product, and outputs a “cudaDeviceIndex” and “dataPtr” . According to the documentation I found here, dataPtr should be a cuda device pointer if cudaDeviceIndex is not -1.

I’ve put together some code to make use of the node similar to how omni.syntheticdata.sensors.get_rgb() and omni.syntheticdata.sensors.enable_sensors() are implemented and from what I can tell this is working as the node has reasonable outputs. The width/height are correct, cudaDeviceIndex is 0 and dataPtr seems ok. However, if I try use dataPtr in any cuda functions I get an invalid parameter error.

Here are the relevant bits of code,

# Activate SdRenderVarPtr for LdrColor render var
from omni.syntheticdata import sensors

viewport_api = ... # An omni.kit.widget.viewport.widget.ViewportAPI
render_var = "LdrColorSDPtr"
sd = sensors.get_synthetic_data()
sd.activate_node_template(render_var, 0, [viewport_api.render_product_path])

... in an update subscription (

# Get the node outputs
output_names = [

sd.get_node_attributes(render_var,  output_names, viewport_api.render_product_path)

ptr = outputs["outputs:dataPtr"]
device = outputs["outputs:cudaDeviceIndex"]
width = outputs["outputs:width"]
height = outputs["outputs:height"]
format = outputs["outputs:format"]

if device != -1:
  # Call a C function (that uses cuda) with ptr, width, height, and format.

Is there any advice you can give for using this node or any potential alternatives?


Hi Michael. I’ve moved this over to the SDG forum where someone from the Replicator team can help with this.