2026-01-28 06:16:04 +00:00

49 lines
1.4 KiB
C++

//
// Created by Xiang Zhou on 10/6/21.
//
#pragma once
#include <string>
#include <vector>
#include <memory>
extern "C" {
#include "kplus/kp_struct.h"
}
namespace dynasty {
namespace inferencer {
namespace kplus {
class KplusPlatform {
private:
bool initialized_;
std::shared_ptr<kp_device_group_s> device_group_{};
kp_model_nef_descriptor_t nef_{};
kp_product_id_t product_;
private:
static std::vector<int> collect_all_port_ids(kp_devices_list_t *list, kp_product_id_t target_product);
static std::shared_ptr<kp_device_group_s> connect_devices(const kp_product_id_t& product);
static void upload_firmware(std::shared_ptr<kp_device_group_s> devices_group, const std::string& scpu_fw_path, const std::string& ncpu_fw_path);
static kp_model_nef_descriptor_t upload_model(std::shared_ptr<kp_device_group_s> devices_group, const std::string& _model_file_path_520);
public:
KplusPlatform();
~KplusPlatform();
void initialize(const std::string& product, const std::string& nef_file_path, const std::string& scpu_fw_path="", const std::string& ncpu_fw_path="" );
bool isInitialized() const { return initialized_;}
std::shared_ptr<kp_device_group_s> getDeviceGroup() const { return device_group_;}
kp_model_nef_descriptor_t getNeFDesc() const { return nef_; }
kp_product_id_t getProduct() const {return product_; }
std::string toString() const;
};
}
}
}