C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 2

algorithm_container_base_batch.h
1 /* file: algorithm_container_base_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of base classes defining algorithm interface for batch processing mode.
45 //--
46 */
47 
48 #ifndef __ALGORITHM_CONTAINER_BASE_BATCH_H__
49 #define __ALGORITHM_CONTAINER_BASE_BATCH_H__
50 
51 #include "services/daal_memory.h"
52 #include "services/daal_kernel_defines.h"
53 
54 namespace daal
55 {
56 namespace algorithms
57 {
58 
62 namespace interface1
63 {
76 template<> class AlgorithmContainer<batch> : public AlgorithmContainerIfaceImpl
77 {
78 public:
83  AlgorithmContainer(daal::services::Environment::env *daalEnv) : AlgorithmContainerIfaceImpl(daalEnv) {}
84 
85  virtual ~AlgorithmContainer() {}
86 
91  virtual services::Status compute() = 0;
92 
96  virtual services::Status setupCompute() = 0;
97 
101  virtual services::Status resetCompute() = 0;
102 
103 };
104 
112 template<> class AlgorithmContainerImpl<batch> : public AlgorithmContainer<batch>
113 {
114 public:
115  DAAL_NEW_DELETE();
116 
121  AlgorithmContainerImpl(daal::services::Environment::env *daalEnv = 0): AlgorithmContainer<batch>(daalEnv), _par(0), _in(0), _res(0) {};
122 
123  virtual ~AlgorithmContainerImpl() {}
124 
131  void setArguments(Input *in, Result *res, Parameter *par)
132  {
133  _in = in;
134  _par = par;
135  _res = res;
136  }
137 
142  Result *getResult()
143  {
144  return _res;
145  }
146 
147  virtual services::Status setupCompute() DAAL_C11_OVERRIDE { return services::Status(); }
148 
149  virtual services::Status resetCompute() DAAL_C11_OVERRIDE { return services::Status(); }
150 
151 protected:
152  Parameter *_par;
153  Input *_in;
154  Result *_res;
155 };
156 
172 template<typename sse2Container
173  DAAL_KERNEL_SSSE3_ONLY(typename ssse3Container)
174  DAAL_KERNEL_SSE42_ONLY(typename sse42Container)
175  DAAL_KERNEL_AVX_ONLY(typename avxContainer)
176  DAAL_KERNEL_AVX2_ONLY(typename avx2Container)
177  DAAL_KERNEL_AVX512_mic_ONLY(typename avx512_micContainer)
178  DAAL_KERNEL_AVX512_ONLY(typename avx512Container)
179 >
180 class DAAL_EXPORT AlgorithmDispatchContainer<batch, sse2Container
181  DAAL_KERNEL_SSSE3_ONLY(ssse3Container)
182  DAAL_KERNEL_SSE42_ONLY(sse42Container)
183  DAAL_KERNEL_AVX_ONLY(avxContainer)
184  DAAL_KERNEL_AVX2_ONLY(avx2Container)
185  DAAL_KERNEL_AVX512_mic_ONLY(avx512_micContainer)
186  DAAL_KERNEL_AVX512_ONLY(avx512Container)
187 > : public AlgorithmContainerImpl<batch>
188 {
189 public:
194  AlgorithmDispatchContainer(daal::services::Environment::env *daalEnv);
195 
196  virtual ~AlgorithmDispatchContainer() { delete _cntr; }
197 
198  virtual services::Status compute() DAAL_C11_OVERRIDE
199  {
200  _cntr->setArguments(this->_in, this->_res, this->_par);
201  return _cntr->compute();
202  }
203 
204  virtual services::Status setupCompute() DAAL_C11_OVERRIDE
205  {
206  _cntr->setArguments(this->_in, this->_res, this->_par);
207  return _cntr->setupCompute();
208  }
209 
210  virtual services::Status resetCompute() DAAL_C11_OVERRIDE
211  {
212  return _cntr->resetCompute();
213  }
214 
215 protected:
216  AlgorithmContainerImpl<batch> *_cntr;
217 };
218 
220 } // namespace interface1
221 
222 }
223 }
224 
225 #endif
daal::algorithms::interface1::AlgorithmContainer::setupCompute
virtual services::Status setupCompute()=0
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container DAAL_KERNEL_AVX512_mic_ONLY(avx512_micContainer) >::resetCompute
virtual services::Status resetCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:210
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:95
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
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:181
daal::algorithms::interface1::Result
Base class to represent final results of the computation. Algorithm-specific final results are repres...
Definition: algorithm_types.h:331
daal::algorithms::interface1::AlgorithmDispatchContainer
Implements a container to dispatch algorithms to cpu-specific implementations.
Definition: algorithm_container_base_common.h:271
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::getResult
Result * getResult()
Definition: algorithm_container_base_batch.h:142
daal::batch
Definition: daal_defines.h:132
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:86
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container DAAL_KERNEL_AVX512_mic_ONLY(avx512_micContainer) >::setupCompute
virtual services::Status setupCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:204
daal::algorithms::interface1::AlgorithmContainerIfaceImpl
Implements the abstract interface AlgorithmContainerIfaceImpl. It is associated with the Algorithm cl...
Definition: algorithm_container_base_common.h:93
daal::algorithms::interface1::AlgorithmDispatchContainer< batch, sse2Container DAAL_KERNEL_AVX512_mic_ONLY(avx512_micContainer) >::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:198
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::resetCompute
virtual services::Status resetCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:149
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:112
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::AlgorithmContainerImpl
AlgorithmContainerImpl(daal::services::Environment::env *daalEnv=0)
Definition: algorithm_container_base_batch.h:121
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::setArguments
void setArguments(Input *in, Result *res, Parameter *par)
Definition: algorithm_container_base_batch.h:131
daal::algorithms::interface1::AlgorithmContainer< batch >::AlgorithmContainer
AlgorithmContainer(daal::services::Environment::env *daalEnv)
Definition: algorithm_container_base_batch.h:83
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:127
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:217
daal_kernel_defines.h
daal::algorithms::interface1::AlgorithmContainerImpl< batch >::setupCompute
virtual services::Status setupCompute() DAAL_C11_OVERRIDE
Definition: algorithm_container_base_batch.h:147

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