Skip to content

Commit

Permalink
fixing apple no gpu problem
Browse files Browse the repository at this point in the history
  • Loading branch information
haixuanTao committed Aug 9, 2021
1 parent 2cc0aaa commit 7578dc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion onnxruntime-sys/wrapper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "onnxruntime_c_api.h"
#include "cpu_provider_factory.h"
#if !defined(__APPLE__)
#include "cpu_provider_factory.h"
#include "cuda_provider_factory.h"
#endif
3 changes: 2 additions & 1 deletion onnxruntime/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ impl<'a> SessionBuilder<'a> {
}

/// Set the session to use cpu
#[cfg(feature = "cuda")]
pub fn use_cpu(self, use_arena: i32) -> Result<SessionBuilder<'a>> {
unsafe {
sys::OrtSessionOptionsAppendExecutionProvider_CPU(self.session_options_ptr, use_arena);
}
Ok(self)
}

#[cfg(feature = "cuda")]
/// Set the session to use cuda
#[cfg(feature = "cuda")]
pub fn use_cuda(self, device_id: i32) -> Result<SessionBuilder<'a>> {
unsafe {
sys::OrtSessionOptionsAppendExecutionProvider_CUDA(self.session_options_ptr, device_id);
Expand Down

0 comments on commit 7578dc0

Please sign in to comment.