aclReductionAlgGenerator.h
Go to the documentation of this file.
/*
* Advanced Simulation Library <http://asl.org.il>
*
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
*
*
* This file is part of Advanced Simulation Library (ASL).
*
* ASL is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3 of the License.
*
* ASL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACLREDUCTIONALGGENERATUR_H
#define ACLREDUCTIONALGGENERATUR_H
#include "aclVectorOfElementsDef.h"
#include <math/aslVectors.h>
#include <utilities/aslUValue.h>
namespace acl
{
class Kernel;
enum ReductionOperatorType {ROT_SUM, ROT_PRODUCT, ROT_MINIMUM, ROT_MAXIMUM};
template <typename ResType, enum ReductionOperatorType Op> class ReductionAlgGenerator
{
private:
VectorOfElements ve;
unsigned int nGroups;
unsigned int nLocal;
public:
asl::UValue<asl::AVec<ResType>> res;
private:
std::vector<std::vector<ResType>> groupRes;
VectorOfElementsData groupResACL;
shared_ptr<Kernel> kernel;
public:
ReductionAlgGenerator(VectorOfElements v);
void compute();
void generateAlg(Kernel & k);
void generateAlg();
};
template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_SUM>>
generateSumAlg(VectorOfElements v);
template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_MINIMUM>>
generateMinAlg(VectorOfElements v);
template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_MAXIMUM>>
generateMaxAlg(VectorOfElements v);
template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_PRODUCT>>
generateProductAlg(VectorOfElements v);
} //namespace acl
#endif // ACLREDUCTIONALGGENERATUR_H
acl::Kernel
OpenCl Kernel generator.
Definition: aclKernel.h:49
acl::ReductionAlgGenerator::generateAlg
void generateAlg()
acl::ReductionAlgGenerator::ReductionAlgGenerator
ReductionAlgGenerator(VectorOfElements v)
acl::ReductionAlgGenerator::generateAlg
void generateAlg(Kernel &k)
acl::ReductionAlgGenerator::res
asl::UValue< asl::AVec< ResType > > res
Definition: aclReductionAlgGenerator.h:48
acl::ReductionAlgGenerator::compute
void compute()
acl::VectorOfElements
The class represents several Element.
Definition: aclVectorOfElementsDef.h:92
asl::UValue
Updatable value. This class stores value and its TimeStamp.
Definition: aslUValue.h:35
acl
Advanced Computational Language.
Definition: acl.h:41
acl::generateSumAlg
std::shared_ptr< ReductionAlgGenerator< ResType, ROT_SUM > > generateSumAlg(VectorOfElements v)
acl::generateProductAlg
std::shared_ptr< ReductionAlgGenerator< ResType, ROT_PRODUCT > > generateProductAlg(VectorOfElements v)
acl::ReductionOperatorType
ReductionOperatorType
Definition: aclReductionAlgGenerator.h:35
acl::ROT_SUM
@ ROT_SUM
Definition: aclReductionAlgGenerator.h:35
acl::ROT_MAXIMUM
@ ROT_MAXIMUM
Definition: aclReductionAlgGenerator.h:35
acl::ROT_PRODUCT
@ ROT_PRODUCT
Definition: aclReductionAlgGenerator.h:35
acl::ROT_MINIMUM
@ ROT_MINIMUM
Definition: aclReductionAlgGenerator.h:35
acl::generateMaxAlg
std::shared_ptr< ReductionAlgGenerator< ResType, ROT_MAXIMUM > > generateMaxAlg(VectorOfElements v)
acl::generateMinAlg
std::shared_ptr< ReductionAlgGenerator< ResType, ROT_MINIMUM > > generateMinAlg(VectorOfElements v)
aclVectorOfElementsDef.h