This file is indexed.

/usr/include/ASL/acl/acl.h is in libasl-dev 0.1.7-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
/*
 * 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 ACL_H
#define ACL_H

#include "aclStdIncludes.h"
#include <memory>
#include "Kernels/aclKernelConfiguration.h"
//#include "aclHardware.h"
#include "aclTypes.h"

namespace cl
{
	class CommandQueue;
}


/// Advanced Computational Language
namespace acl
{
	class ExpressionContainer;
	class VectorOfElements;
	class MatrixOfElements;
	class MemBlock;
	class ElementBase;
	template <class T> class Array;
	typedef std::shared_ptr<MemBlock> ElementData;
	typedef std::shared_ptr<ElementBase> Element;
	extern const KernelConfiguration KERNEL_BASIC;
	typedef std::shared_ptr<cl::CommandQueue> CommandQueue;	

	
	/// definitions of mathematical operators and functions for class ::Element
	namespace elementOperators
	{
	// Math Operators
		/**
			 \ingroup MathOperators
		 */
		Element operator-(Element e);

		/**
			 \ingroup MathOperators
		 */
		Element operator+(Element e1, Element e2);

		/**
			 \ingroup MathOperators
		 */
		Element operator-(Element e1, Element e2);

		/**
			 \ingroup MathOperators
		 */
		Element operator*(Element e1, Element e2);

		/**
			 \ingroup MathOperators
		 */
		Element operator/(Element e1, Element e2);

		/**
			 \ingroup MathOperators
		 */
		Element operator%(Element e1, Element e2);


		
	// Assignment Operators
		/**
			 \ingroup AssignmentOperators
		 */		
		Element operatorAssignment(Element e1, Element e2);

		/**
			 \ingroup AssignmentOperators
		 */		
		Element operatorAssignmentSafe(Element e1, Element e2);

		/**
			 \ingroup AssignmentOperators
		 */		
		Element operator+=(Element e1, Element e2);

		/**
			 \ingroup AssignmentOperators
		 */		
		Element operator-=(Element e1, Element e2);

		/**
			 \ingroup AssignmentOperators
		 */		
		Element operator*=(Element e1, Element e2);

		/**
			 \ingroup AssignmentOperators
		 */		
		Element operator/=(Element e1, Element e2);


		/**
			 \ingroup BooleanOperators
		 */		
		Element operator>(Element e1, Element e2);

		/**
			 \ingroup BooleanOperators
		 */	
		Element operator<(Element e1, Element e2);

		/**
			 \ingroup BooleanOperators
		 */	
		Element operator>=(Element e1, Element e2);

		/**
			 \ingroup BooleanOperators
		 */	
		Element operator<=(Element e1, Element e2);

		/**
			 \ingroup BooleanOperators
		 */	
		Element isEqual(Element e1, Element e2);

		/**
			 \ingroup BooleanOperators
		 */	
		Element isNotEqual(Element e1, Element e2);

		/**
			 \ingroup BooleanOperators
		 */	
		Element operator&&(Element e1, Element e2);

		/**
			 \ingroup BooleanOperators
		 */	
		Element operator||(Element e1, Element e2);

		/**
			 \ingroup MathOperators
		 */
		Element operator!(Element e);

		
	// Mathematical Functions
		/**
			 \ingroup MathFunctions
		 */
		Element sin(Element e);

		/**
			 \ingroup MathFunctions
		 */
		Element cos(Element e);

		/**
			 \ingroup MathFunctions
		 */
		Element sqrt(Element e);

		/**
			 \ingroup MathFunctions
		 */
		Element rsqrt(Element e);

		/**
			 \ingroup MathFunctions
		 */
		Element log(Element e);

		/**
			 \ingroup MathFunctions
		 */
		Element log10(Element e);
		
		/**
			 a^i
			 \ingroup MathFunctions
		 */
		Element powI(Element a, unsigned int i);

		/**
			 exp(a)
			 \ingroup MathFunctions
		 */
		Element exp(Element a);

		/**
			 fabs(a)
			 \ingroup MathFunctions
		 */
		Element fabs(Element a);

		/**
			 abs(a)
			 \ingroup MathFunctions
		 */
		Element abs(Element a);

		/**
			 abs_diff(a,b)
			 \ingroup MathFunctions
		 */
		Element abs_diff(Element a,Element b);
		
		/**
			 floor(a)
			 \ingroup MathFunctions
		 */
		Element floor(Element a);
		
		/**
			 isnan(a)
			 \ingroup MathFunctions
		 */
		Element isnan(Element a);

		/// Return nan of corresponding float type
		/// \ingroup MathFunctions
		Element nan(TypeID t);
		
		/**
		 	returns \p a with sign of \p b
			 copysign(a,b)
			 \ingroup MathFunctions
		 */
		Element copysign(Element a,Element b);

		/**
		 	returns 1 with sign of \p a and 0 for a = +-0 
			 copysign(a,b)
			 \ingroup MathFunctions
		 */
		Element sign(Element a);
		
		/**
			 min(a,b)
			 \ingroup MathFunctions
		 */
		Element min(Element a,Element b);

		/**
			 max(a,b)
			 \ingroup MathFunctions
		 */
		Element max(Element a,Element b);
		
		/// Atomic sum
		/// \ingroup AtomicFunctions
		Element atomic_add(Element e1, Element e2);

		/// Atomic subtraction
		/// \ingroup AtomicFunctions
		Element atomic_sub(Element e1, Element e2);

		/// Atomic exchange
		/// \ingroup AtomicFunctions
		Element atomic_xchg(Element e1, Element e2);


		/// ternary mad operator e1 * e2 + e3
		/// \ingroup MathFunctions
		Element mad(Element e1, Element e2, Element e3);


	// Synchronization Functions
		/**
		 Synchronous copy: Global memory <-> Local memory

		 \ingroup SynchronizationFunctions
		 */
		Element syncCopy(Element source,
		                 Element destination,
		                 Element srcOffset,
		                 Element dstOffset,
		                 Element length);



		/**
		 Sets work-group barrier

		 \ingroup SynchronizationFunctions
		 */
		Element barrier(std::string flags = "CLK_LOCAL_MEM_FENCE");



	// Special Purpose Functions
		/**
		 Creates excerpt from source defined by filter
		 by replacing of "INDEX" occurrences
		 in source->str() by filter->str()
			 
		 \ingroup SpecialPurposeFunctions
		 */
		Element excerpt(Element source, Element filter);

		/**
		 Parses statement by replacing occurrences of
		 element's names by corresponding element->str()
		 from elementNamePairs
			 
		 \ingroup SpecialPurposeFunctions
		 */
		Element parse(const std::vector<std::pair<Element, std::string> > & elementNamePairs, 
		              const std::string & statement);

		/**
		 type conversion
		 \ingroup SpecialPurposeFunctions
		 */			
		Element convert(const TypeID tName, Element e1, bool strong=true);

		/// printf()
		/// \ingroup SpecialPurposeFunctions
		Element printfFunction(std::string args);
		
		
		/// Return statement (terminates the execution of a kernel)
		/// \ingroup ControlStructures
		Element returnStatement();

		
		/// If-Else conditional structure
		/// \ingroup ControlStructures
		Element ifElse(Element condition, 
		               const std::vector<Element> & thenBody, 
		               const std::vector<Element> & elseBody);

			
		/// ternary branching operator
		/// \ingroup ControlStructures
		Element select(Element e1, Element e2, Element e3);


		/// For loop
		/// \ingroup ControlStructures
		Element forLoop(Element initialization, 
		                Element condition, 
		                Element increase, 
		                const std::vector<Element> & body);

		/// Corresponds to the openCL operation any	
		Element any(Element e);
		/// Corresponds to the openCL operation all
		Element all(Element e);
		

	}

	
	//	RTTI functions

	bool isConstant(Element e);

	/// The function returns true when the input is a single valued object e.g. aclConstatnt, aclVariable 
	bool isSingleValue(Element e); 

	bool isMemBlock(Element e);

	/// Copies source to destination, resizes destination to accommodate source.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(MemBlock &source, T* destination);

	/// Copies source to destination, exit(1) if sizes do not match.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(T* source, MemBlock &destination);

	/// Copies source to destination, resizes destination to accommodate source.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(MemBlock &source, std::vector<T> &destination);

	/// Copies source to destination, exit(1) if sizes do not match.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(std::vector<T> &source, MemBlock &destination);

	/// Copies source to destination, exit(1) if sizes do not match.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(MemBlock &source, MemBlock &destination);

	/// Copies source to destination, resizes destination to accommodate source.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(Element source, std::vector<T> &destination);	
	
	/// Copies source to destination, exit(1) if sizes do not match.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(std::vector<T> &source, Element destination);

	/// Copies source to destination.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(Element source, T* destination);	
	
	/// Copies source to destination.
	/// \ingroup HostInteractionFunctions
	template <typename T> void copy(T* source, Element destination);

	/// puts a vector<Element> in ExpressionContainer
	/**
		 \relates ExpressionContainer
		 \relates VectorOfElements
	 */
	ExpressionContainer & operator<<(ExpressionContainer & ec,
	                                 const std::vector<Element> & a);
	
	/// puts a vector<Element> in ExpressionContainer
	/**
		 \relates ExpressionContainer
		 \relates VectorOfElements
	 */
	std::vector<Element> & operator<<(std::vector<Element> & ec,
	                                 const std::vector<Element> & a);

	
	/// puts a MatrixOfElements in ExpressionContainer
	/**
		 \relates ExpressionContainer
		 \relates VectorOfElements
	 */
	ExpressionContainer & operator<<(ExpressionContainer & ec,
	                                 const MatrixOfElements & a);
	
	/// puts a ExpressionContainer in ExpressionContainer
	/**
		 \relates ExpressionContainer
		 \relates VectorOfElements
	 */
	ExpressionContainer & operator<<(ExpressionContainer & ec,
	                                 const ExpressionContainer & a);
	
	/// function writes data from \p initializationValue to \p a
	///	\ingroup SpecialPurposeFunctions
	void initData(Element a,
	              Element initializationValue,
	              const KernelConfiguration & kernelConfig = KERNEL_BASIC);

	/// function creates subElement with given length and offset; offset is constant
	Element generateSubElement(Element, unsigned int size, int offset);		
	
	///function creates subElement with given length and offset; offset can be a variable
	Element generateSubElement(Element, unsigned int size, int * offset);		

	Element generateSubElement(Element, unsigned int size, Element offset);		

	Element generateShiftedElement(Element, int offset);			
	Element generateShiftedElement(Element, int* offset);		
	Element generateShiftedElement(Element, Element offset);		

	template <typename T> void swapBuffers(std::shared_ptr<Array<T> >a, 
	                                       std::shared_ptr<Array<T> > b);


	ElementData generateElementArray(TypeID typeID,
	                                 unsigned int size);
	ElementData generateElementArray(TypeID typeID,
	                                 unsigned int size,
	                                 CommandQueue queue_);


	Element generateElementLocalArray(TypeID typeID,
	                                  unsigned int size);

} // namespace acl
#endif // ACL_H