Adding Java example to CUDA execution provider docs (#13899)

### Description
Adds an example of specifying CUDA options in Java to the CUDA execution
provider docs.

### Motivation and Context
Fixes #13896.
This commit is contained in:
Adam Pocock 2022-12-08 16:54:14 -05:00 committed by GitHub
parent 7fb9d8e35d
commit c4dee79eed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,3 +178,20 @@ cudaProviderOptions.UpdateOptions(providerOptionsDict);
SessionOptions options = SessionOptions.MakeSessionOptionWithCudaProvider(cudaProviderOptions); // Dispose this finally
```
### Java
```java
OrtCUDAProviderOptions cudaProviderOptions = new OrtCUDAProviderOptions(/*device id*/0); // Must be closed after the session closes
cudaProviderOptions.add("gpu_mem_limit","2147483648");
cudaProviderOptions.add("arena_extend_strategy","kSameAsRequested");
cudaProviderOptions.add("cudnn_conv_algo_search","DEFAULT");
cudaProviderOptions.add("do_copy_in_default_stream","1");
cudaProviderOptions.add("cudnn_conv_use_max_workspace","1");
cudaProviderOptions.add("cudnn_conv1d_pad_to_nc1d","1");
OrtSession.SessionOptions options = new OrtSession.SessionOptions(); // Must be closed after the session closes
options.addCUDA(cudaProviderOptions);
```