Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Tags in this Discussion

Atomic operations in OptiX?
  • Hi,
    Is there a way to implement/call atomic operations in OptiX?
  • 6 Comments sorted by
  • Vote Up1Vote Down Mazenoz
    Posts: 5 Accepted Answer
    Got it working finally by adding the line

    OPTIONS -arch sm_13

    to the block

    OPTIX_add_sample_executable(
    ...
    ...
    )


    in the CMakeList.txt file, then using the atomic* operations on integers. Thanks everyone.
  • You can do atomic operations using the built-in atomic* functions (e.g. atomicAdd, atomicInc, etc). Cuda allows you to make custom atomic operations using the atomicCAS() function.
  • This is right in CUDA code, but in OptiX I cannot normally call the CUDA atomic* operations (i.e. no CUDA-OptiX interop that I am aware of)
  • I know you can at least call atomicAdd as there is an Optix sample that has that: zoneplate.
  • Yes, atomic operations available to CUDA C are available in OptiX. The only conditional is that atomics do not work when OptiX is running with multiple GPUs (output buffers are stored in zero-copy host memory and atomic operations across the PCIe bus are not supported).
  • kch86 said:

    I know you can at least call atomicAdd as their is an Optix sample that has that: zoneplate.


    Your comment was helpful, I figured out a way to include the atomic* operations by adding the following line

    OPTIONS -arch sm_21


    to the CMakeList.txt file in an OptiX project. The code compiles correctly. However, once executed I get the following error:

    OptiX Error: Parse error (Details: Function "_rtProgramCreateFromPTXFile" caught exception: (string): error: Cannot parse input PTX string C:/<directory_here>/tutorial_generated_stereo_full.cu.ptx, line 23; fatal : Parsing error near ';': syntax error [4849804])

    Any ideas?

    P.S. My device supports SM 2.1