41 lines
2 KiB
C++
41 lines
2 KiB
C++
// Restricted integer AltAILIF + Delta inference backend. No plasticity or topology mutation after initialization.
|
|
#pragma once
|
|
#include <knp/backends/cpu-single-threaded/backend.h>
|
|
#include <memory>
|
|
|
|
namespace knp_altai_cuda {
|
|
class Backend final : public knp::backends::single_threaded_cpu::SingleThreadedCPUBackend {
|
|
using Base = knp::backends::single_threaded_cpu::SingleThreadedCPUBackend;
|
|
struct State;
|
|
std::unique_ptr<State> state_;
|
|
int device_index_ = 0;
|
|
void synchronize();
|
|
// Mutable CPU iterators are implementation details, not a supported mutation API.
|
|
using Base::begin_populations; using Base::end_populations;
|
|
using Base::begin_projections; using Base::end_projections;
|
|
using Base::load_populations; using Base::load_projections;
|
|
public:
|
|
Backend();
|
|
~Backend() override;
|
|
static std::shared_ptr<knp::core::Backend> create();
|
|
bool plasticity_supported() const override { return false; }
|
|
std::vector<std::string> get_supported_neurons() const override;
|
|
std::vector<std::string> get_supported_synapses() const override;
|
|
std::vector<size_t> get_supported_population_indexes() const override;
|
|
std::vector<size_t> get_supported_projection_indexes() const override;
|
|
std::vector<std::unique_ptr<knp::core::Device>> get_devices() const override;
|
|
void select_devices(const std::set<knp::core::UID> &uids) override;
|
|
void select_device(std::unique_ptr<knp::core::Device> &&device) override;
|
|
void load_all_populations(const std::vector<knp::core::AllPopulationsVariant> &) override;
|
|
void load_all_projections(const std::vector<knp::core::AllProjectionsVariant> &) override;
|
|
void remove_populations(const std::vector<knp::core::UID> &) override;
|
|
void remove_projections(const std::vector<knp::core::UID> &) override;
|
|
void start_learning() override;
|
|
void stop_learning() override { Base::stop_learning(); }
|
|
DataRanges get_network_data() const override;
|
|
void _step() override;
|
|
protected:
|
|
void _init() override;
|
|
void _uninit() override;
|
|
};
|
|
}
|