# OrtCUDAProviderOptions (onnxruntime 1.15.0 API)

Package ai.onnxruntime.providers

## Class OrtCUDAProviderOptions

- java.lang.Object
- - ai.onnxruntime.OrtProviderOptions
  - - ai.onnxruntime.providers.OrtCUDAProviderOptions

All Implemented Interfaces:
  `java.lang.AutoCloseable`

    public final class OrtCUDAProviderOptions
    extends OrtProviderOptions

Options for configuring the CUDA execution provider.

Supported options are listed on the ORT website.

### Nested Class Summary

### Nested classes/interfaces inherited from class ai.onnxruntime.OrtProviderOptions

`OrtProviderOptions.OrtProviderSupplier`

### Field Summary

Fields
`protected java.util.Map<java.lang.String,​java.lang.String>` `options`

### Fields inherited from class ai.onnxruntime.OrtProviderOptions

`nativeHandle`

### Constructor Summary

Constructors
`OrtCUDAProviderOptions()` Constructs CUDA execution provider options for device 0.
`OrtCUDAProviderOptions​(int deviceId)` Constructs CUDA execution provider options for the specified non-negative device id.

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `add​(long apiHandle, long nativeHandle, java.lang.String key, java.lang.String value)` Adds an option to this options instance.
`void` `add​(java.lang.String key, java.lang.String value)` Adds a configuration option to this options.
`protected void` `close​(long apiHandle, long nativeHandle)` Closes this options instance.
`java.lang.String` `getOptionsString()` Returns the serialized options string
`OrtProvider` `getProvider()` Gets the provider enum for this options instance.
`void` `parseOptionsString​(java.lang.String serializedForm)` Parses the output of `getOptionsString()` and adds those options to this options instance.
`java.lang.String` `toString()`

### Methods inherited from class ai.onnxruntime.OrtProviderOptions

`close, getApiHandle, loadLibraryAndCreate`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### options

    protected final java.util.Map<java.lang.String,​java.lang.String> options

### Constructor Detail

#### OrtCUDAProviderOptions

    public OrtCUDAProviderOptions()
                           throws OrtException

Constructs CUDA execution provider options for device 0.

Throws:
  `OrtException` - If CUDA is unavailable.

#### OrtCUDAProviderOptions

    public OrtCUDAProviderOptions​(int deviceId)
                           throws OrtException

Constructs CUDA execution provider options for the specified non-negative device id.

Parameters:
  `deviceId` - The device id.
Throws:
  `OrtException` - If CUDA is unavailable.

### Method Detail

#### getProvider

    public OrtProvider getProvider()

Description copied from class: `OrtProviderOptions`
Gets the provider enum for this options instance.

Specified by:
  `getProvider` in class `OrtProviderOptions`
Returns:
  The provider enum.

#### add

    protected void add​(long apiHandle,
                       long nativeHandle,
                       java.lang.String key,
                       java.lang.String value)
                throws OrtException

Adds an option to this options instance.

Parameters:
  `apiHandle` - The api pointer.
  `nativeHandle` - The native options pointer.
  `key` - The option key.
  `value` - The option value.
Throws:
  `OrtException` - If the addition failed.

#### close

    protected void close​(long apiHandle,
                         long nativeHandle)

Closes this options instance.

Specified by:
  `close` in class `OrtProviderOptions`
Parameters:
  `apiHandle` - The api pointer.
  `nativeHandle` - The native options pointer.

#### add

    public void add​(java.lang.String key,
                    java.lang.String value)
             throws OrtException

Adds a configuration option to this options.

Parameters:
  `key` - The key.
  `value` - The value.
Throws:
  `OrtException` - If the addition failed.

#### parseOptionsString

    public void parseOptionsString​(java.lang.String serializedForm)
                            throws OrtException

Parses the output of `getOptionsString()` and adds those options to this options instance.

Parameters:
  `serializedForm` - The serialized form to parse.
Throws:
  `OrtException` - If the option could not be added.

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### getOptionsString

    public java.lang.String getOptionsString()

Returns the serialized options string

Returns:
  The serialized options string.