Debian Codegraph @

src/acl/Operators/aclOperatorBinary.cxx

raw
1 /*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 #include "aclOperatorBinary.h"
25 #include "../aclUtilities.h"
26 #include <algorithm>
27
28 using namespace std;
29 using namespace asl;
30
31 namespace acl
32 {
33
34 OperatorBinary::OperatorBinary(Element a1, Element a2, const string & description):
35 // first operand dictates the typeID of the binary operator
36 ElementBase(false, 0, a1->getTypeID())
37 {
38 if ( compatible(a1, a2) )
39 {
40 size = max(a1->getSize(), a2->getSize());
41
42 if (a1->getQueue().get() != 0)
43 queue = a1->getQueue();
44 else
45 queue = a2->getQueue();
46
47 e1 = a1;
48 e2 = a2;
49 }
50 else
51 {
52 errorMessage("Operands of binary operator (" + description + ") are incompatible. \
53 Either they reside on different devices or their sizes do not match: "
54 + numToStr(a1->getSize()) + " and " + numToStr(a2->getSize()));
55 }
56 }
57
58 void OperatorBinary::addToKernelSource(vector<Element> & arguments,
59 vector<Element> & localDeclarations) const
60 {
61 addElementToKernelSource(e1, arguments, localDeclarations);
62 addElementToKernelSource(e2, arguments, localDeclarations);
63 }
64
65
66 void OperatorBinary::setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const
67 {
68 }
69
70
71 string OperatorBinary::getName() const
72 {
73 return "";
74 }
75
76
77 string OperatorBinary::getTypeSignature(const KernelConfiguration & kernelConfig) const
78 {
79 return "";
80 }
81
82
83 string OperatorBinary::getLocalDeclaration(const KernelConfiguration & kernelConfig) const
84 {
85 return "";
86 }
87
88 } // namespace acl