Skip to content

Commit 7578dc0

Browse files
author
haixuanTao
committed
fixing apple no gpu problem
1 parent 2cc0aaa commit 7578dc0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

onnxruntime-sys/wrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "onnxruntime_c_api.h"
2-
#include "cpu_provider_factory.h"
32
#if !defined(__APPLE__)
3+
#include "cpu_provider_factory.h"
44
#include "cuda_provider_factory.h"
55
#endif

onnxruntime/src/session.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,16 @@ impl<'a> SessionBuilder<'a> {
131131
}
132132

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

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

0 commit comments

Comments
 (0)