C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 5

algorithm_container_base_batch.h
1 /* file: algorithm_container_base_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of base classes defining algorithm interface for batch processing mode.
19 //--
20 */
21 
22 #ifndef __ALGORITHM_CONTAINER_BASE_BATCH_H__
23 #define __ALGORITHM_CONTAINER_BASE_BATCH_H__
24 
25 #include "services/daal_memory.h"
26 #include "services/daal_kernel_defines.h"
27 
28 namespace daal
29 {
30 namespace algorithms
31 {
32 
36 namespace interface1
37 {
50 template<> class AlgorithmContainer<batch> : public AlgorithmContainerIfaceImpl
51 {
52 public:
57  AlgorithmContainer(daal::services::Environment::env *daalEnv) : AlgorithmContainerIfaceImpl(daalEnv) {}
58 
59  virtual ~AlgorithmContainer() {}
60 
65  virtual services::Status compute() = 0;
66 
70  virtual services::Status setupCompute() = 0;
71 
75  virtual services::Status resetCompute() = 0;
76 
77 };
78 
86 template<> class AlgorithmContainerImpl<batch> : public AlgorithmContainer<batch>
87 {
88 public:
89  DAAL_NEW_DELETE();
90 
95  AlgorithmContainerImpl(daal::services::Environment::env *daalEnv = 0): AlgorithmContainer<batch>(daalEnv), _par(0), _in(0), _res(0) {};
96 
97  virtual ~AlgorithmContainerImpl() {}
98 
105  void setArguments(Input *in, Result *res, Parameter *par)
106  {
107  _in = in;
108  _par = par;
109  _res = res;
110  }
111 
116  Result *getResult()
117  {
118  return _res;
119  }
120 
121  virtual services::Status setupCompute() DAAL_C11_OVERRIDE { return services::Status(); }
122 
123  virtual services::Status resetCompute() DAAL_C11_OVERRIDE { return services::Status(); }
124 
125 protected:
126  Parameter *_par;
127  Input *_in;
128  Result *_res;
129 };
130 
146 template<typename sse2Container
147  DAAL_KERNEL_SSSE3_ONLY(typename ssse3Container)
148  DAAL_KERNEL_SSE42_ONLY(typename sse42Container)
149  DAAL_KERNEL_AVX_ONLY(typename avxContainer)
150  DAAL_KERNEL_AVX2_ONLY(typename avx2Container)
151  DAAL_KERNEL_AVX512_MIC_ONLY(typename avx512_micContainer)
152  DAAL_KERNEL_AVX512_ONLY(typename avx512Container)
153 >
154 class DAAL_EXPORT AlgorithmDispatchContainer<batch, sse2Container
155  DAAL_KERNEL_SSSE3_ONLY(ssse3Container)
156  DAAL_KERNEL_SSE42_ONLY(sse42Container)
157  DAAL_KERNEL_AVX_ONLY(avxContainer)
158  DAAL_KERNEL_AVX2_ONLY(avx2Container)
159  DAAL_KERNEL_AVX512_MIC_ONLY(avx512_micContainer)
160  DAAL_KERNEL_AVX512_ONLY(avx512Container)
161 > : public AlgorithmContainerImpl<batch>
162 {
163 public:
168  AlgorithmDispatchContainer(daal::services::Environment::env *daalEnv);
169 
170  virtual ~AlgorithmDispatchContainer() { delete _cntr; }
171 
172  virtual services::Status compute() DAAL_C11_OVERRIDE
173  {
174  _cntr->setArguments(this->_in, this->_res, this->_par);
175  return _cntr->compute();
176  }
177 
178  virtual services::Status setupCompute() DAAL_C11_OVERRIDE
179  {
180  _cntr->setArguments(this->_in, this->_res, this->_par);
181  return _cntr->setupCompute();
182  }
183 
184  virtual services::Status resetCompute() DAAL_C11_OVERRIDE
185  {
186  return _cntr->resetCompute();
187  }
188 
189 protected:
190  AlgorithmContainerImpl<batch> *_cntr;
191 };
192 
194 } // namespace interface1
195 
196 }
197 }
198 
199 #endif
daal::algorithms::interface1::AlgorithmContainer::setupCompute
virtual services::Status setupCompute()=0
daal
Definition: algorithm_base_common.h:31
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:155
daal::algorithms::interface1::Result
Base class to represent final results of the computation. Algorithm-specific final results are repres...
Definition: algorithm_types.h:307
daal::algorithms::interface1::AlgorithmDispatchContainer
Implements a container to dispatch algorithms to cpu-specific implementations.
Definition: algorithm_container_base_common.h:245
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container >::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:172
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::getResult
Result * getResult()
Definition: algorithm_container_base_batch.h:116
daal::batch
Definition: daal_defines.h:110
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:60
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container >::resetCompute
virtual services::Status resetCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:184
daal::algorithms::interface1::AlgorithmContainerIfaceImpl
Implements the abstract interface AlgorithmContainerIfaceImpl. It is associated with the Algorithm cl...
Definition: algorithm_container_base_common.h:67
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::resetCompute
virtual services::Status resetCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:123
daal::algorithms::interface1::AlgorithmContainer::compute
virtual services::Status compute()=0
daal::algorithms::interface1::AlgorithmContainer::resetCompute
virtual services::Status resetCompute()=0
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:86
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container >::setupCompute
virtual services::Status setupCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:178
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::AlgorithmContainerImpl
AlgorithmContainerImpl(daal::services::Environment::env *daalEnv=0)
Definition: algorithm_container_base_batch.h:95
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::setArguments
void setArguments(Input *in, Result *res, Parameter *par)
Definition: algorithm_container_base_batch.h:105
daal::algorithms::interface1::AlgorithmContainer< batch >::AlgorithmContainer
AlgorithmContainer(daal::services::Environment::env *daalEnv)
Definition: algorithm_container_base_batch.h:57
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:101
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:191
daal_kernel_defines.h
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::setupCompute
virtual services::Status setupCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:121

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