This commit is contained in:
shenjack 2024-10-16 22:16:51 +08:00
parent 807977cc27
commit 7059eb5a9f
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -54,8 +54,13 @@ fn main() -> anyhow::Result<()> {
// Create a Context on an OpenCL device // Create a Context on an OpenCL device
let context = Context::from_device(&device).expect("Context::from_device failed"); let context = Context::from_device(&device).expect("Context::from_device failed");
let property = let mut property =
CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE; CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
// 如果命令行参数包含 -d, 则 | 一个 CL_QUEUE_ON_DEVICE
let args = std::env::args().collect::<Vec<String>>();
if args.contains(&"-d".to_string()) {
property |= CL_QUEUE_ON_DEVICE;
}
let queue = match CommandQueue::create_default_with_properties( let queue = match CommandQueue::create_default_with_properties(
&context, property, 10, // 写死试试, 看起来没问题 &context, property, 10, // 写死试试, 看起来没问题
) { ) {