acc.h Source File

acc.h Source File#

Runtime Library: acc.h Source File
Runtime Library v0.30
Mobilint SDK qb
acc.h
Go to the documentation of this file.
1// Copyright ⓒ 2019- Mobilint Inc. All rights reserved.
5
6#ifndef MACCEL_ACC_H_
7#define MACCEL_ACC_H_
8
9#ifndef _MSC_VER
10#include <experimental/propagate_const>
11#endif
12#include <memory>
13#include <string>
14#include <vector>
15
16#include "maccel/export.h"
17#include "maccel/model.h"
18#include "maccel/status_code.h"
19#include "maccel/type.h"
20
21namespace mobilint {
22
27
28class AcceleratorImpl;
29
35MACCEL_EXPORT const std::string& getMaccelVersion();
36
42MACCEL_EXPORT const std::string& getMaccelGitVersion();
43
51MACCEL_EXPORT const std::string& getMaccelVendor();
52
61MACCEL_EXPORT const std::string& getMaccelProduct();
62
66class MACCEL_EXPORT Accelerator {
67public:
78 static std::unique_ptr<Accelerator> create(StatusCode& sc);
79
91 static std::unique_ptr<Accelerator> create(int dev_no, StatusCode& sc);
92
97 static std::unique_ptr<Accelerator> create(int dev_no, bool verbose, StatusCode& sc);
98
99 Accelerator(const Accelerator& other) = delete;
100 Accelerator(Accelerator&& other) noexcept;
101 Accelerator& operator=(const Accelerator& rhs) = delete;
102 Accelerator& operator=(Accelerator&& rhs) noexcept;
103
108
119 std::vector<CoreId> getAvailableCores() const;
120
121private:
122 Accelerator();
123
124#ifndef _MSC_VER
125 std::experimental::propagate_const<std::unique_ptr<AcceleratorImpl>> mImpl;
126#else
127 std::unique_ptr<AcceleratorImpl> mImpl;
128#endif
129
130 friend class Model;
131 friend class AsyncModel;
132};
133
135
136} // namespace mobilint
137
138#endif
static std::unique_ptr< Accelerator > create(StatusCode &sc)
Creates an Accelerator object for executing models, using device number 0.
static std::unique_ptr< Accelerator > create(int dev_no, bool verbose, StatusCode &sc)
std::vector< CoreId > getAvailableCores() const
Retrieves a list of available NPU cores.
static std::unique_ptr< Accelerator > create(int dev_no, StatusCode &sc)
Creates an Accelerator object for a specific device.
~Accelerator()
Destroys the Accelerator object and releases resources.
MACCEL_EXPORT const std::string & getMaccelProduct()
Retrieves product information of the maccel runtime.
StatusCode
Enumerates status codes for the maccel runtime.
Definition status_code.h:26
MACCEL_EXPORT const std::string & getMaccelVendor()
Retrieves the vendor name of the maccel runtime.
MACCEL_EXPORT const std::string & getMaccelGitVersion()
Retrieves the Git commit hash of the maccel runtime.
MACCEL_EXPORT const std::string & getMaccelVersion()
Retrieves the version of the maccel runtime.