FLEX  1.2.0
NvFlexDevice.h File Reference

Go to the source code of this file.


NV_FLEX_API int NvFlexDeviceGetSuggestedOrdinal ()
NV_FLEX_API bool NvFlexDeviceCreateCudaContext (int ordinal)
NV_FLEX_API void NvFlexDeviceDestroyCudaContext ()

Detailed Description

NvFlexDevice is an optional helper library that performs some initialization tasks related to GPU device management. The library can be used to query the NVIDIA PhysX control panel for the selected "PhysX" GPU, and to create an optimized CUDA context. Currently the library is a closed source component but is purely optional. See the FlexDemo for an example of how to use the device API.

Function Documentation

NV_FLEX_API int NvFlexDeviceGetSuggestedOrdinal ( )

Returns the CUDA ordinal of the GPU selected as "PhysX" in the NVIDIA control panel. Returns -1 if there is no NVIDIA CUDA device available.

The returned ordinal is a CUDA ordinal and does not correspond to the DXGI ordinal. D3D users should use their own device selection method and pass the appropriate DXGI device index or custom D3D devices to NvFlexInit().
NV_FLEX_API bool NvFlexDeviceCreateCudaContext ( int  ordinal)

Creates a CUDA context optimized for Flex, returns true on success and sets the context as current on the calling thread. If using this method to initialize CUDA then you should ensure that no prior CUDA calls are made prior to avoid creating multiple contexts.

[in]ordinalThe CUDA ordinal of the GPU to create the context on, this can be the suggested ordinal (see flexDeviceGetSuggestedOrdinal()), or a manually selected ordinal.
NV_FLEX_API void NvFlexDeviceDestroyCudaContext ( )

Destroy the context associated with the current thread, can be used to destroy the CUDA context created by flexDeviceCreateCudaContext().