Class 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.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.String,​java.lang.String> options
      A Java side copy of the options.
    • Constructor Summary

      Constructors 
      Constructor Description
      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 
      Modifier and Type Method Description
      void add​(java.lang.String key, java.lang.String value)
      Adds a configuration option to this options.
      protected void applyToNative()
      Applies the Java side configuration to the native side object.
      protected void applyToNative​(long apiHandle, long nativeHandle, java.lang.String[] keys, java.lang.String[] values)
      Adds the options to this options instance.
      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 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
        A Java side copy of the 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

      • applyToNative

        protected void applyToNative​(long apiHandle,
                                     long nativeHandle,
                                     java.lang.String[] keys,
                                     java.lang.String[] values)
                              throws OrtException
        Adds the options to this options instance.
        Parameters:
        apiHandle - The api pointer.
        nativeHandle - The native options pointer.
        keys - The option keys.
        values - The option values.
        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.