修复了命令队列太大导致的问题(
This commit is contained in:
parent
ea7a1c212e
commit
0e9a6b769e
14
src/main.rs
14
src/main.rs
@ -28,6 +28,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
println!("警告: get_device_info failed: {}\n也许是你没有一张AMD显卡,让我们试试非AMD", err);
|
println!("警告: get_device_info failed: {}\n也许是你没有一张AMD显卡,让我们试试非AMD", err);
|
||||||
match get_device_info(device_id, CL_DEVICE_MAX_WORK_GROUP_SIZE) {
|
match get_device_info(device_id, CL_DEVICE_MAX_WORK_GROUP_SIZE) {
|
||||||
Ok(size) => {
|
Ok(size) => {
|
||||||
|
println!("非 amd size 获取成功");
|
||||||
size.to_size()
|
size.to_size()
|
||||||
},
|
},
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@ -46,12 +47,17 @@ 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 queue = CommandQueue::create_default_with_properties(
|
let queue = match CommandQueue::create_default_with_properties(
|
||||||
&context,
|
&context,
|
||||||
CL_QUEUE_PROFILING_ENABLE,
|
CL_QUEUE_PROFILING_ENABLE,
|
||||||
worker_count as u32,
|
10, // 写死试试, 看起来没问题
|
||||||
)
|
) {
|
||||||
.expect("create_command_queue_with_properties failed");
|
Ok(q) => q,
|
||||||
|
Err(err) => {
|
||||||
|
println!("创建命令队列失败: {}", err);
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Build the OpenCL program source and create the kernel.
|
// Build the OpenCL program source and create the kernel.
|
||||||
let program = match Program::create_and_build_from_source(&context, PROGRAM_SOURCE, "") {
|
let program = match Program::create_and_build_from_source(&context, PROGRAM_SOURCE, "") {
|
||||||
|
Loading…
Reference in New Issue
Block a user