Skip to main content

M_newDevice

Function M_newDevice 

Source
pub unsafe extern "C" fn M_newDevice(
    type_: M_DeviceType,
    id: c_int,
    status: *mut M_Status,
) -> *mut M_Device
Expand description

Creates a device of the specified type and ID.

For HOST devices, the ID is typically 0. For ACCELERATOR devices, the ID specifies which GPU to use (0 for first ACCELERATOR, etc.).

@param type The type of device to create (M_HOST or M_ACCELERATOR). @param id The device ID. Use 0 for the default device of that type. @param status The status object for reporting errors.

@returns A pointer to the device. You are responsible for the memory associated with the pointer returned. The memory can be deallocated by calling M_freeDevice(). Returns NULL if the device could not be created, with an error message in the status.