MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / parse_device_list

Function parse_device_list

common/arg.cpp:783–802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

781}
782
783static std::vector<ggml_backend_dev_t> parse_device_list(const std::string & value) {
784 std::vector<ggml_backend_dev_t> devices;
785 auto dev_names = string_split<std::string>(value, ',');
786 if (dev_names.empty()) {
787 throw std::invalid_argument("no devices specified");
788 }
789 if (dev_names.size() == 1 && dev_names[0] == "none") {
790 devices.push_back(nullptr);
791 } else {
792 for (const auto & device : dev_names) {
793 auto * dev = ggml_backend_dev_by_name(device.c_str());
794 if (!dev || ggml_backend_dev_type(dev) == GGML_BACKEND_DEVICE_TYPE_CPU) {
795 throw std::invalid_argument(string_format("invalid device: %s", device.c_str()));
796 }
797 devices.push_back(dev);
798 }
799 devices.push_back(nullptr);
800 }
801 return devices;
802}
803
804static void add_rpc_devices(const std::string & servers) {
805 auto rpc_servers = string_split<std::string>(servers, ',');

Callers 1

Calls 6

ggml_backend_dev_by_nameFunction · 0.85
string_formatFunction · 0.70
ggml_backend_dev_typeFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected