77//! - [cl_context](https://docs.rs/cl-sys/0.4.2/cl_sys/type.cl_context.html)
88//! - [cl_command_queue](https://docs.rs/cl-sys/0.4.2/cl_sys/type.cl_command_queue.html)
99
10- use arrayfire:: { AfError , HANDLE_ERROR } ;
10+ use arrayfire:: { handle_error_general , AfError } ;
1111use cl_sys:: {
1212 cl_command_queue, cl_context, cl_device_id, CL_DEVICE_TYPE_ACCELERATOR , CL_DEVICE_TYPE_ALL ,
1313 CL_DEVICE_TYPE_CPU , CL_DEVICE_TYPE_DEFAULT , CL_DEVICE_TYPE_GPU ,
@@ -62,7 +62,7 @@ pub fn get_context(retain: bool) -> cl_context {
6262 unsafe {
6363 let mut out: cl_context = std:: ptr:: null_mut ( ) ;
6464 let err_val = afcl_get_context ( & mut out as * mut cl_context , retain) ;
65- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
65+ handle_error_general ( AfError :: from ( err_val) ) ;
6666 out
6767 }
6868}
@@ -72,7 +72,7 @@ pub fn get_queue(retain: bool) -> cl_command_queue {
7272 unsafe {
7373 let mut out: cl_command_queue = std:: ptr:: null_mut ( ) ;
7474 let err_val = afcl_get_queue ( & mut out as * mut cl_command_queue , retain) ;
75- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
75+ handle_error_general ( AfError :: from ( err_val) ) ;
7676 out
7777 }
7878}
@@ -82,7 +82,7 @@ pub fn get_device_id() -> cl_device_id {
8282 unsafe {
8383 let mut out: cl_device_id = std:: ptr:: null_mut ( ) ;
8484 let err_val = afcl_get_device_id ( & mut out as * mut cl_device_id ) ;
85- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
85+ handle_error_general ( AfError :: from ( err_val) ) ;
8686 out
8787 }
8888}
@@ -91,31 +91,31 @@ pub fn get_device_id() -> cl_device_id {
9191pub fn set_device_id ( dev_id : cl_device_id ) {
9292 unsafe {
9393 let err_val = afcl_set_device_id ( dev_id) ;
94- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
94+ handle_error_general ( AfError :: from ( err_val) ) ;
9595 }
9696}
9797
9898/// Push user provided device, context and queue tuple to ArrayFire device mamanger
9999pub fn add_device_context ( dev_id : cl_device_id , ctx : cl_context , queue : cl_command_queue ) {
100100 unsafe {
101101 let err_val = afcl_add_device_context ( dev_id, ctx, queue) ;
102- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
102+ handle_error_general ( AfError :: from ( err_val) ) ;
103103 }
104104}
105105
106106/// Set the device identified by device & context pair as the active device for ArrayFire
107107pub fn set_device_context ( dev_id : cl_device_id , ctx : cl_context ) {
108108 unsafe {
109109 let err_val = afcl_set_device_context ( dev_id, ctx) ;
110- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
110+ handle_error_general ( AfError :: from ( err_val) ) ;
111111 }
112112}
113113
114114/// Remove the user provided device, context pair from ArrayFire device mamanger
115115pub fn delete_device_context ( dev_id : cl_device_id , ctx : cl_context ) {
116116 unsafe {
117117 let err_val = afcl_delete_device_context ( dev_id, ctx) ;
118- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
118+ handle_error_general ( AfError :: from ( err_val) ) ;
119119 }
120120}
121121
@@ -124,7 +124,7 @@ pub fn get_device_type() -> DeviceType {
124124 unsafe {
125125 let mut out: i32 = 0 ;
126126 let err_val = afcl_get_device_type ( & mut out as * mut c_int ) ;
127- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
127+ handle_error_general ( AfError :: from ( err_val) ) ;
128128 match out {
129129 -1 => mem:: transmute ( out as u64 ) ,
130130 _ => DeviceType :: ALL ,
@@ -137,7 +137,7 @@ pub fn get_platform() -> VendorPlatform {
137137 unsafe {
138138 let mut out: i32 = 0 ;
139139 let err_val = afcl_get_platform ( & mut out as * mut c_int ) ;
140- HANDLE_ERROR ( AfError :: from ( err_val) ) ;
140+ handle_error_general ( AfError :: from ( err_val) ) ;
141141 mem:: transmute ( out)
142142 }
143143}
0 commit comments