-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84daf64
commit dd6b25a
Showing
9 changed files
with
78 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::env::current_exe; | ||
use luisa::*; | ||
use luisa_compute as luisa; | ||
fn _signal_handler(signal: libc::c_int) { | ||
if signal == libc::SIGSEGV { | ||
panic!("segfault detected"); | ||
} | ||
} | ||
static ONCE: std::sync::Once = std::sync::Once::new(); | ||
pub fn device_name() -> String { | ||
match std::env::var("LUISA_TEST_DEVICE") { | ||
Ok(device) => device, | ||
Err(_) => "cpu".to_string(), | ||
} | ||
} | ||
pub fn get_device() -> Device { | ||
let show_log = match std::env::var("LUISA_TEST_LOG") { | ||
Ok(log) => log == "1", | ||
Err(_) => false, | ||
}; | ||
ONCE.call_once(|| unsafe { | ||
if show_log { | ||
init_logger_verbose(); | ||
} | ||
libc::signal(libc::SIGSEGV, _signal_handler as usize); | ||
}); | ||
let curr_exe = current_exe().unwrap(); | ||
let runtime_dir = curr_exe.parent().unwrap().parent().unwrap(); | ||
let ctx = Context::new(runtime_dir); | ||
let device = device_name(); | ||
let device = ctx.create_device(&device); | ||
device.create_buffer_from_slice(&[1.0f32]); | ||
device | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule LuisaCompute
updated
3 files
+5 −2 | src/runtime/context.cpp | |
+19 −10 | src/rust/luisa_compute_backend/src/lib.rs | |
+7 −48 | src/rust/luisa_compute_backend/src/proxy.rs |