25 #ifndef __LOW_ORDER_MOMENTS_DISTRIBUTED_H__
26 #define __LOW_ORDER_MOMENTS_DISTRIBUTED_H__
28 #include "algorithms/algorithm.h"
29 #include "services/daal_defines.h"
30 #include "algorithms/moments/low_order_moments_types.h"
36 namespace low_order_moments
56 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
57 class DistributedContainer
69 template<
typename algorithmFPType, Method method, CpuType cpu>
70 class DistributedContainer<step2Master, algorithmFPType, method, cpu> :
71 public daal::algorithms::AnalysisContainerIface<distributed>
79 DistributedContainer(daal::services::Environment::env *daalEnv);
81 virtual ~DistributedContainer();
86 virtual services::Status compute() DAAL_C11_OVERRIDE;
91 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
114 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
115 class DAAL_EXPORT Distributed{};
132 template<
typename algorithmFPType, Method method>
133 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
136 typedef Online<algorithmFPType, method> super;
138 typedef typename super::InputType InputType;
139 typedef typename super::ParameterType ParameterType;
140 typedef typename super::ResultType ResultType;
141 typedef typename super::PartialResultType PartialResultType;
153 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) : Online<algorithmFPType, method>(other)
161 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
163 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
167 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
169 return new Distributed<step1Local, algorithmFPType, method>(*this);
188 template<
typename algorithmFPType, Method method>
189 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public daal::algorithms::Analysis<distributed>
192 typedef algorithms::low_order_moments::DistributedInput<step2Master> InputType;
193 typedef algorithms::low_order_moments::Parameter ParameterType;
194 typedef algorithms::low_order_moments::Result ResultType;
195 typedef algorithms::low_order_moments::PartialResult PartialResultType;
197 DistributedInput<step2Master> input;
198 ParameterType parameter;
212 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
221 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
227 ResultPtr getResult()
236 services::Status setResult(
const ResultPtr &result)
238 DAAL_CHECK(result, services::ErrorNullResult)
240 _res = _result.get();
241 return services::Status();
248 PartialResultPtr getPartialResult()
250 return _partialResult;
258 services::Status setPartialResult(
const PartialResultPtr &partialResult,
bool initFlag =
false)
260 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
261 _partialResult = partialResult;
262 _pres = _partialResult.get();
263 setInitFlag(initFlag);
264 return services::Status();
272 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
274 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
278 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
280 return new Distributed<step2Master, algorithmFPType, method>(*this);
283 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
285 services::Status s = _result->allocate<algorithmFPType>(_pres, 0, 0);
286 _res = _result.get();
290 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
292 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
293 _pres = _partialResult.get();
297 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
299 return services::Status();
304 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
307 _result.reset(
new ResultType());
308 _partialResult.reset(
new PartialResultType());
312 PartialResultPtr _partialResult;
317 using interface1::DistributedInput;
318 using interface1::DistributedContainer;
319 using interface1::Distributed;
daal::step1Local
Definition: daal_defines.h:123
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &result)
Definition: low_order_moments_distributed.h:236
daal::algorithms::low_order_moments::interface1::DistributedContainer
Provides methods to run implementations of the low order moments algorithm in the distributed process...
Definition: low_order_moments_distributed.h:57
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: low_order_moments_distributed.h:272
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >
Computes the result of the second step of the moments of low order algorithm in the distributed proce...
Definition: low_order_moments_distributed.h:189
daal::step2Master
Definition: daal_defines.h:124
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: low_order_moments_distributed.h:198
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::input
DistributedInput< step2Master > input
Definition: low_order_moments_distributed.h:197
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed()
Definition: low_order_moments_distributed.h:201
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag=false)
Definition: low_order_moments_distributed.h:258
daal::algorithms::kmeans::init::interface2::Distributed
class DAAL_EXPORT Distributed
Computes initial clusters for K-Means algorithm in the distributed processing mode.
Definition: kmeans_init_distributed.h:277
daal::algorithms::low_order_moments::interface1::Online
Computes moments of low order in the online processing mode.
Definition: low_order_moments_online.h:94
daal::algorithms::low_order_moments::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed()
Definition: low_order_moments_distributed.h:144
daal::algorithms::low_order_moments::interface1::DistributedInput< step2Master >
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: low_order_moments_distributed.h:212
daal::algorithms::low_order_moments::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: low_order_moments_distributed.h:161
daal::algorithms::low_order_moments::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: low_order_moments_distributed.h:153
daal::algorithms::low_order_moments::interface1::Distributed
Computes moments of low order in the distributed processing mode.
Definition: low_order_moments_distributed.h:115
daal::algorithms::low_order_moments::interface1::Distributed< step1Local, algorithmFPType, method >
Computes the result of the first step of the moments of low order algorithm in the distributed proces...
Definition: low_order_moments_distributed.h:133
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: low_order_moments_distributed.h:221
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: low_order_moments_distributed.h:248
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:107
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: low_order_moments_distributed.h:227
daal::distributed
Definition: daal_defines.h:113