C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

algorithm_container_base_batch.h
1 /* file: algorithm_container_base_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of base classes defining algorithm interface for batch processing mode.
21 //--
22 */
23 
24 #ifndef __ALGORITHM_CONTAINER_BASE_BATCH_H__
25 #define __ALGORITHM_CONTAINER_BASE_BATCH_H__
26 
27 #include "services/daal_memory.h"
28 #include "services/daal_kernel_defines.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 
38 namespace interface1
39 {
52 template<> class AlgorithmContainer<batch> : public AlgorithmContainerIfaceImpl
53 {
54 public:
59  AlgorithmContainer(daal::services::Environment::env *daalEnv) : AlgorithmContainerIfaceImpl(daalEnv) {}
60 
61  virtual ~AlgorithmContainer() {}
62 
67  virtual services::Status compute() = 0;
68 
72  virtual services::Status setupCompute() = 0;
73 
77  virtual services::Status resetCompute() = 0;
78 
79 };
80 
88 template<> class AlgorithmContainerImpl<batch> : public AlgorithmContainer<batch>
89 {
90 public:
91  DAAL_NEW_DELETE();
92 
97  AlgorithmContainerImpl(daal::services::Environment::env *daalEnv = 0): AlgorithmContainer<batch>(daalEnv), _par(0), _in(0), _res(0) {};
98 
99  virtual ~AlgorithmContainerImpl() {}
100 
107  void setArguments(Input *in, Result *res, Parameter *par)
108  {
109  _in = in;
110  _par = par;
111  _res = res;
112  }
113 
118  Result *getResult()
119  {
120  return _res;
121  }
122 
123  virtual services::Status setupCompute() DAAL_C11_OVERRIDE { return services::Status(); }
124 
125  virtual services::Status resetCompute() DAAL_C11_OVERRIDE { return services::Status(); }
126 
127 protected:
128  Parameter *_par;
129  Input *_in;
130  Result *_res;
131 };
132 
148 template<typename sse2Container
149  DAAL_KERNEL_SSSE3_ONLY(typename ssse3Container)
150  DAAL_KERNEL_SSE42_ONLY(typename sse42Container)
151  DAAL_KERNEL_AVX_ONLY(typename avxContainer)
152  DAAL_KERNEL_AVX2_ONLY(typename avx2Container)
153  DAAL_KERNEL_AVX512_MIC_ONLY(typename avx512_micContainer)
154  DAAL_KERNEL_AVX512_ONLY(typename avx512Container)
155 >
156 class DAAL_EXPORT AlgorithmDispatchContainer<batch, sse2Container
157  DAAL_KERNEL_SSSE3_ONLY(ssse3Container)
158  DAAL_KERNEL_SSE42_ONLY(sse42Container)
159  DAAL_KERNEL_AVX_ONLY(avxContainer)
160  DAAL_KERNEL_AVX2_ONLY(avx2Container)
161  DAAL_KERNEL_AVX512_MIC_ONLY(avx512_micContainer)
162  DAAL_KERNEL_AVX512_ONLY(avx512Container)
163 > : public AlgorithmContainerImpl<batch>
164 {
165 public:
170  AlgorithmDispatchContainer(daal::services::Environment::env *daalEnv);
171 
172  virtual ~AlgorithmDispatchContainer() { delete _cntr; }
173 
174  virtual services::Status compute() DAAL_C11_OVERRIDE
175  {
176  _cntr->setArguments(this->_in, this->_res, this->_par);
177  return _cntr->compute();
178  }
179 
180  virtual services::Status setupCompute() DAAL_C11_OVERRIDE
181  {
182  _cntr->setArguments(this->_in, this->_res, this->_par);
183  return _cntr->setupCompute();
184  }
185 
186  virtual services::Status resetCompute() DAAL_C11_OVERRIDE
187  {
188  return _cntr->resetCompute();
189  }
190 
191 protected:
192  AlgorithmContainerImpl<batch> *_cntr;
193 };
194 
196 } // namespace interface1
197 
198 }
199 }
200 
201 #endif
daal::algorithms::interface1::AlgorithmContainerIfaceImpl
Implements the abstract interface AlgorithmContainerIfaceImpl. It is associated with the Algorithm cl...
Definition: algorithm_container_base_common.h:69
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::getResult
Result * getResult()
Definition: algorithm_container_base_batch.h:118
daal::batch
Definition: daal_defines.h:112
daal::algorithms::interface1::AlgorithmContainer::setupCompute
virtual services::Status setupCompute()=0
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::setupCompute
virtual services::Status setupCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:123
daal::algorithms::interface1::Result
Base class to represent final results of the computation. Algorithm-specific final results are repres...
Definition: algorithm_types.h:309
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container >::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:174
daal::algorithms::interface1::AlgorithmDispatchContainer
Implements a container to dispatch algorithms to cpu-specific implementations.
Definition: algorithm_container_base_common.h:247
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container >::setupCompute
virtual services::Status setupCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:180
daal::algorithms::interface1::AlgorithmContainer
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: algorithm_container_base_common.h:103
daal::algorithms::interface1::AlgorithmContainer::compute
virtual services::Status compute()=0
daal::algorithms::interface1::AlgorithmContainer::resetCompute
virtual services::Status resetCompute()=0
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:193
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::setArguments
void setArguments(Input *in, Result *res, Parameter *par)
Definition: algorithm_container_base_batch.h:107
daal::algorithms::interface1::AlgorithmContainer< batch >::AlgorithmContainer
AlgorithmContainer(daal::services::Environment::env *daalEnv)
Definition: algorithm_container_base_batch.h:59
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::resetCompute
virtual services::Status resetCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:125
daal::algorithms::interface1::AlgorithmContainerImpl
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: algorithm_container_base_common.h:157
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:62
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container >::resetCompute
virtual services::Status resetCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:186
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::AlgorithmContainerImpl
AlgorithmContainerImpl(daal::services::Environment::env *daalEnv=0)
Definition: algorithm_container_base_batch.h:97
daal::algorithms::interface1::AlgorithmContainerImpl< batch >
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: algorithm_container_base_batch.h:88
daal_kernel_defines.h

For more complete information about compiler optimizations, see our Optimization Notice.