试试这样呢

This commit is contained in:
shenjack 2024-10-16 21:52:06 +08:00
parent fb493b9216
commit 61afe5b63f
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -50,7 +50,7 @@ fn main() -> anyhow::Result<()> {
let property = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE; let property = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
let queue = match CommandQueue::create_default_with_properties( let queue = match CommandQueue::create_default_with_properties(
&context, &context,
property, 0,
10, // 写死试试, 看起来没问题 10, // 写死试试, 看起来没问题
) { ) {
Ok(q) => q, Ok(q) => q,
@ -149,9 +149,13 @@ fn main() -> anyhow::Result<()> {
.set_global_work_size(worker_count as usize) .set_global_work_size(worker_count as usize)
.enqueue_nd_range(&queue)? .enqueue_nd_range(&queue)?
}; };
let start_tick = std::time::Instant::now();
kernel_event.wait()?; kernel_event.wait()?;
let end_tick = std::time::Instant::now();
queue.finish()?; queue.finish()?;
println!("外置计时: {:?}", end_tick - start_tick);
if !output.is_fine_grained() { if !output.is_fine_grained() {
unsafe { queue.enqueue_svm_map(CL_BLOCKING, CL_MAP_WRITE, &mut output, &[]) }?; unsafe { queue.enqueue_svm_map(CL_BLOCKING, CL_MAP_WRITE, &mut output, &[]) }?;
} }