/home/runner/work/HiCR/HiCR/include/hicr/backends/boost/computeManager.hpp Source File

HiCR: /home/runner/work/HiCR/HiCR/include/hicr/backends/boost/computeManager.hpp Source File
HiCR
computeManager.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2025 Huawei Technologies Co., Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
24#pragma once
25
26#include <memory>
30
31namespace HiCR::backend::boost
32{
33
40{
41 public:
42
47 : HiCR::ComputeManager()
48 {}
49
53 ~ComputeManager() override = default;
54
62 __INLINE__ std::shared_ptr<HiCR::ExecutionUnit> createExecutionUnit(const replicableFc_t &function) override { return std::make_shared<boost::ExecutionUnit>(function); }
63
71 __INLINE__ std::unique_ptr<HiCR::ExecutionState> createExecutionState(std::shared_ptr<HiCR::ExecutionUnit> executionUnit, void *const argument = nullptr) const override
72 {
73 // Creating and returning new execution state
74 return std::make_unique<boost::ExecutionState>(executionUnit, argument);
75 }
76
77 [[nodiscard]] __INLINE__ std::unique_ptr<HiCR::ProcessingUnit> createProcessingUnit(std::shared_ptr<HiCR::ComputeResource> computeResource) const override
78 {
79 {
80 HICR_THROW_LOGIC("This backend does not implement this function");
81 }
82 }
83
84 private:
85
86 __INLINE__ void initializeImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
87 {
88 {
89 HICR_THROW_LOGIC("This backend does not implement this function");
90 }
91 }
92
93 __INLINE__ void startImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit, std::unique_ptr<HiCR::ExecutionState> &executionState) override
94 {
95 {
96 HICR_THROW_LOGIC("This backend does not implement this function");
97 }
98 }
99
100 __INLINE__ void suspendImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
101 {
102 {
103 HICR_THROW_LOGIC("This backend does not implement this function");
104 }
105 }
106
107 __INLINE__ void resumeImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
108 {
109 {
110 HICR_THROW_LOGIC("This backend does not implement this function");
111 }
112 }
113
114 __INLINE__ void terminateImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
115 {
116 {
117 HICR_THROW_LOGIC("This backend does not implement this function");
118 }
119 }
120
121 __INLINE__ void awaitImpl(std::unique_ptr<HiCR::ProcessingUnit> &processingUnit) override
122 {
123 {
124 HICR_THROW_LOGIC("This backend does not implement this function");
125 }
126 }
127};
128
129} // namespace HiCR::backend::boost
This file implements the execution state class for the Boost backend.
Definition computeManager.hpp:48
Definition computeManager.hpp:40
__INLINE__ std::unique_ptr< HiCR::ProcessingUnit > createProcessingUnit(std::shared_ptr< HiCR::ComputeResource > computeResource) const override
Definition computeManager.hpp:77
__INLINE__ std::shared_ptr< HiCR::ExecutionUnit > createExecutionUnit(const replicableFc_t &function) override
Definition computeManager.hpp:62
ComputeManager()
Definition computeManager.hpp:46
__INLINE__ std::unique_ptr< HiCR::ExecutionState > createExecutionState(std::shared_ptr< HiCR::ExecutionUnit > executionUnit, void *const argument=nullptr) const override
Definition computeManager.hpp:71
Provides a definition for the abstract compute manager class.
std::function< void(void *)> replicableFc_t
Definition executionUnit.hpp:34
Provides a failure model and corresponding exception classes.
#define HICR_THROW_LOGIC(...)
Definition exceptions.hpp:67