Is there any a way to operate char* in the .cu file in Optix

I’m trying to use rtbuffer to pass some per ray data from .cu to C++ file in the char , but I can’t find any string operation api using in .cu file in the documentation, is there anyway to do that? Appreciate!

Are you really trying to work with strings in ray tracing device code? But why?

The only way to get data out from OptiX is via output or input_output buffers. Means every non-trivial OptiX application contains code doing that.

If you have any data stored at the rtPayload which you want to output you’d need to write it to a buffer.
https://raytracing-docs.nvidia.com/optix_6_0/guide_6_0/index.html#host#buffers

There is no dynamic memory allocation or string handling inside the device programs. You are responsible to handle where what data is placed. You need to consider that there are thousands of threads running in parallel.

I am currently working on a project to simulate Lidar using optix. And yes I am using buffer to transfer my Customized data structure (mostly optix float3 with padding) from the device to the host, but I have to convert the output position to a string at host, the loop is too expensive for such an time sensitivity job, So I am trying to figure it out if there is a way that can let me store the close-hit float3 position as string or char directly from the device.

You would need to write your own ftoa() function doing that.

Mind that this will run in parallel and there is no fast way to put the resulting strings tightly together in the correct order.
Each thread would better have a dedicated destination memory area where the result fits.
This could, for example, be done with a 2D array of chars where each destination string is one row of identical width and then null terminated to limit them to their actual size. Not sure what the maximum height is. This possibly doesn’t fit for millions of positions. Maybe put them into blocks of a wider 2D array. (These are just ideas.)

This might make more sense to be implemented in a native CUDA kernel working on the OptiX output with CUDA interop.

I would still question the application architecture if it requires ftoa() operations in a time sensitive part of the code.

Think you for your kind reply, it’s just a student’s after class project, I will give a try or change the architeccture if it’s still not satisfied the request. ;D