mlx/mlx/device.h
Fangjun Kuang f20e97b092
minor fixes (#1194)
* minor fixes

* fix build errors
2024-06-12 22:06:49 -07:00

30 lines
563 B
C++

// Copyright © 2023 Apple Inc.
#pragma once
namespace mlx::core {
struct Device {
enum class DeviceType {
cpu,
gpu,
};
static constexpr DeviceType cpu = DeviceType::cpu;
static constexpr DeviceType gpu = DeviceType::gpu;
Device(DeviceType type, int index = 0) : type(type), index(index) {}
DeviceType type;
int index;
};
const Device& default_device();
void set_default_device(const Device& d);
bool operator==(const Device& lhs, const Device& rhs);
bool operator!=(const Device& lhs, const Device& rhs);
} // namespace mlx::core