Kaspersky Neuromorphic Platform  1.0.0
API Reference
Loading...
Searching...
No Matches
altai.h
Go to the documentation of this file.
1
22#pragma once
23
24#include <knp/core/device.h>
25
26#include <cstdlib>
27#include <memory>
28#include <string>
29#include <utility>
30#include <vector>
31
41{
42
47struct Port
48{
53 enum class port_side
54 {
74 };
75
79 // cppcheck-suppress unusedStructMember
80 size_t start_core;
84 // cppcheck-suppress unusedStructMember
89 // cppcheck-suppress unusedStructMember
91};
92
99Port make_standart_north_port(size_t begin_core);
100
104class AltAI : public knp::core::Device
105{
106public:
110 virtual ~AltAI() = default;
111
116 [[nodiscard]] knp::core::DeviceType get_type() const override;
117
122 [[nodiscard]] std::pair<size_t, size_t> get_grid_cols_rows() const;
123
128 [[nodiscard]] std::vector<Port> get_grid_ports() const;
129
130protected:
134 // cppcheck-suppress unusedStructMember
135 size_t columns_;
139 // cppcheck-suppress unusedStructMember
140 size_t rows_;
144 // cppcheck-suppress unusedStructMember
145 std::vector<Port> ports_;
146};
147
148
152class AltAI_GM : public AltAI
153{
154public:
158 AltAI_GM(const AltAI_GM &) = delete;
159
163 AltAI_GM &operator=(const AltAI_GM &) = delete;
164
169
175
179 ~AltAI_GM() override;
180
181public:
186 [[nodiscard]] const std::string &get_name() const override;
187
192 [[nodiscard]] float get_power() const override;
193
194public:
202 size_t rows, size_t columns, const std::vector<Port> &ports = {make_standart_north_port(0)});
203
204private:
209 AltAI_GM();
210 friend std::vector<std::unique_ptr<AltAI>> list_altai_devices();
211
212private:
213 // cppcheck-suppress unusedStructMember
214 std::string altai_name_;
215};
216
220class AltAI_HW : public AltAI
221{
222public:
226 AltAI_HW() = delete;
227
231 AltAI_HW(const AltAI_HW &) = delete;
232
236 AltAI_HW &operator=(const AltAI_HW &) = delete;
237
242
248
252 ~AltAI_HW() override;
253
254public:
259 [[nodiscard]] const std::string &get_name() const override;
260
265 [[nodiscard]] float get_power() const override;
266
267private:
274 AltAI_HW(size_t rows, size_t columns, const std::vector<Port> &ports);
275 friend std::vector<std::unique_ptr<AltAI>> list_altai_devices();
276
277private:
278 // cppcheck-suppress unusedStructMember
279 std::string altai_name_;
280};
281
287std::vector<std::unique_ptr<AltAI>> list_altai_devices();
288} // namespace knp::devices::altai
The AltAI_GM class is a definition of an interface to the AltAI golden model device.
Definition altai.h:153
AltAI_GM(const AltAI_GM &)=delete
Avoid copy of a AltAI_GM device.
const std::string & get_name() const override
Get device name.
AltAI_GM(AltAI_GM &&)
AltAI_GM device move constructor.
AltAI_GM & operator=(const AltAI_GM &)=delete
Avoid copy assignment of a AltAI_GM device.
void load_core_grid_params(size_t rows, size_t columns, const std::vector< Port > &ports={make_standart_north_port(0)})
Load parameters to initialization grid of the AltAI core network.
AltAI_GM & operator=(AltAI_GM &&) noexcept
AltAI_GM device move operator.
float get_power() const override
Get power consumption details for the device.
friend std::vector< std::unique_ptr< AltAI > > list_altai_devices()
List all AltAI devices on which backend can be initialized.
The AltAI_HW class is a definition of an interface to AltAI hardware device.
Definition altai.h:221
AltAI_HW & operator=(const AltAI_HW &)=delete
Avoid copy assignment of a AltAI_HW device.
AltAI_HW()=delete
AltAI_HW device constructor is deleted.
AltAI_HW & operator=(AltAI_HW &&) noexcept
AltAI_HW device move operator.
float get_power() const override
Get power consumption details for the device.
AltAI_HW(AltAI_HW &&)
AltAI_HW device move constructor.
AltAI_HW(const AltAI_HW &)=delete
Avoid copy of a AltAI_HW device.
const std::string & get_name() const override
Get device name.
friend std::vector< std::unique_ptr< AltAI > > list_altai_devices()
List all AltAI devices on which backend can be initialized.
Base class for AltAI devices.
Definition altai.h:105
virtual ~AltAI()=default
AltAI destructor.
std::pair< size_t, size_t > get_grid_cols_rows() const
Get number of columns and rows in device grid.
size_t columns_
Number of columns in core grid of AltAI device.
Definition altai.h:135
size_t rows_
Number of rows in core grid of AltAI device.
Definition altai.h:140
std::vector< Port > ports_
Ports in core grid of AltAI device.
Definition altai.h:145
knp::core::DeviceType get_type() const override
Get device type.
std::vector< Port > get_grid_ports() const
Get port vector of device grid.
Class definition for device base class.
DeviceType
The DeviceType class defines IDs of supported device types.
Definition device.h:38
AltAI device namespace.
Definition altai.h:41
Port make_standart_north_port(size_t begin_core)
Create port of standard size (4) on the north side of the AltAI grid.
Structure used to define location of input and output ports in a grid of AltAI cores.
Definition altai.h:48
size_t start_core
Start core.
Definition altai.h:80
port_side side
Side: kNorth, kSouth, kEast, or kWest.
Definition altai.h:90
size_t port_length
Port length from start core.
Definition altai.h:85
port_side
The port_side class is an enumeration class that represents sides of port connections to a grid of Al...
Definition altai.h:54
@ kWest
The west side of the grid (x = x_max).
Definition altai.h:73
@ kSouth
The south side of the grid (y = y_max).
Definition altai.h:63
@ kNorth
The north side of the grid (y = 0).
Definition altai.h:58
@ kEast
The east side of the grid (x = 0).
Definition altai.h:68