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

[BUG] opencl-interop get_device_type always returns DeviceType::ALL #382

Open
Labels
@nikhilr612

Description

Description

The get_device_type function transmutes the value -1 into DeviceType or returns DeviceType::ALL; however, the enum variant that corresponds to the value (-1i32 as u64) is DeviceType::ALL. This does not seem to be the intended behaviour.

///// Fetch Active ArrayFire device's type i.e. CPU/GPU/Accelerator etc.
pub fn get_device_type() -> DeviceType {
 let mut out: i32 = 0;
 let err_val = unsafe { afcl_get_device_type(&mut out as *mut c_int) };
 handle_error_general(AfError::from(err_val));
 match out {
 -1 => unsafe { mem::transmute(out as u64) },
 _ => DeviceType::ALL,
 }
}

The value of -1 corresponds to AFCL_DEVICE_TYPE_UNKNOWN in arrayfire, whilst -1 corresponds to CL_DEVICE_TYPE_ALL in cl-sys

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /