Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87a331e

Browse files
committed
Fix the missing cl_mem retain in opencl-af example
1 parent8d076a6 commit87a331e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎opencl-interop/examples/ocl_af_app.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use af_opencl_interopas afcl;
33
use arrayfireas af;
44

5-
use ocl_core::{ContextProperties,Event};
5+
use ocl_core::{retain_mem_object,ContextProperties,Event};
66

77
fnmain(){
88
// Set the arrayfire backend to use OpenCL first,
@@ -20,7 +20,7 @@ fn main() {
2020
let dims =[8,1,1];
2121

2222
// Create a `Buffer`:
23-
letmut vec =vec![0.0f32; dims[0]];
23+
letmut vec =vec![1.0f32; dims[0]];
2424
let buffer =unsafe{
2525
ocl_core::create_buffer(
2626
&context,
@@ -37,6 +37,9 @@ fn main() {
3737
afcl::set_device_context(device_id.as_raw(), context.as_ptr());
3838
af::info();
3939

40+
unsafe{
41+
retain_mem_object(&buffer).unwrap();
42+
}
4043
letmut af_buffer = af::Array::new_from_device_ptr(
4144
buffer.as_ptr()as*mutf32,
4245
af::Dim4::new(&[dims[0]asu64,1,1,1]),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp