Skip to content

Commit

Permalink
Proper convolution mode for fast GPU processing (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
nshmyrev authored Oct 7, 2023
1 parent 36017d4 commit c12286f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sherpa-onnx/csrc/session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ static Ort::SessionOptions GetSessionOptionsImpl(int32_t num_threads,
sess_opts.SetIntraOpNumThreads(num_threads);
sess_opts.SetInterOpNumThreads(num_threads);

// Other possible options
// sess_opts.SetGraphOptimizationLevel(ORT_ENABLE_EXTENDED);
// sess_opts.SetLogSeverityLevel(ORT_LOGGING_LEVEL_VERBOSE);
// sess_opts.EnableProfiling("profile");

switch (p) {
case Provider::kCPU:
break; // nothing to do for the CPU provider
Expand All @@ -36,6 +41,8 @@ static Ort::SessionOptions GetSessionOptionsImpl(int32_t num_threads,
// The CUDA provider is available, proceed with setting the options
OrtCUDAProviderOptions options;
options.device_id = 0;
// Default OrtCudnnConvAlgoSearchExhaustive is extremely slow
options.cudnn_conv_algo_search = OrtCudnnConvAlgoSearchHeuristic;
// set more options on need
sess_opts.AppendExecutionProvider_CUDA(options);
} else {
Expand Down

0 comments on commit c12286f

Please sign in to comment.