platform: Change detection of device code for OpenMP by stotko · Pull Request #174 · stotko/stdgpu (original) (raw)

For the OpenMP backend, the platform macros currently always report code to be STDGPU_CODE_HOST. Since some STDGPU_HOST_DEVICE annotated function may use different paths for host and device code and the device path may contain backend-specific optimizations, this choice will lead to backend-specific code being ignored.

Change the detection code to always report STDGPU_CODE_DEVICE rather than STDGPU_CODE_HOST. Note that for such functions using different code paths, these paths should result in equivalent behavior anyways.