1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Copyright © 2023-2024 Apple Inc. */
#ifndef MLX_DEVICE_H
#define MLX_DEVICE_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup mlx_device Device
* MLX device object.
*/
/**@{*/
/**
* A MLX device object.
*/
typedef struct mlx_device_* mlx_device;
/**
* Device type.
*/
typedef enum mlx_device_type_ { MLX_CPU, MLX_GPU } mlx_device_type;
/**
* Returns a new device of specified `type`, with specified `index`.
*/
mlx_device mlx_device_new(mlx_device_type type, int index);
/**
* Returns the type of the device.
*/
mlx_device_type mlx_device_get_type(mlx_device dev);
/**
* Returns the default MLX device.
*/
mlx_device mlx_default_device(void);
/**
* Set the default MLX device.
*/
mlx_device mlx_set_default_device(mlx_device dev);
/**@}*/
#ifdef __cplusplus
}
#endif
#endif