Mali OpenCL SDK v1.1.0
 All Classes Files Functions Variables Macros Pages
hello_world_c.cpp
Go to the documentation of this file.
1 /*
2  * This confidential and proprietary software may be used only as
3  * authorised by a licensing agreement from ARM Limited
4  * (C) COPYRIGHT 2013 ARM Limited
5  * ALL RIGHTS RESERVED
6  * The entire notice above must be reproduced on all authorised
7  * copies and copies may only be made to the extent permitted
8  * by a licensing agreement from ARM Limited.
9  */
10 
11 #include <iostream>
12 
13 using namespace std;
14 
21 int main(void)
22 {
23  /* [Setup memory] */
24  /* Number of elements in the arrays of input and output data. */
25  int arraySize = 1000000;
26 
27  /* Arrays to hold the input and output data. */
28  int* inputA = new int[arraySize];
29  int* inputB = new int[arraySize];
30  int* output = new int[arraySize];
31  /* [Setup memory] */
32 
33  /* Fill the arrays with data. */
34  for (int i = 0; i < arraySize; i++)
35  {
36  inputA[i] = i;
37  inputB[i] = i;
38  }
39 
40  /* [C/C++ Implementation] */
41  for (int i = 0; i < arraySize; i++)
42  {
43  output[i] = inputA[i] + inputB[i];
44  }
45  /* [C/C++ Implementation] */
46 
47  /* Uncomment the following block to print results. */
48  /*
49  for (int i = 0; i < arraySize; i++)
50  {
51  cout << "i = " << i << ", output = " << output[i] << "\n";
52  }
53  */
54 
55  delete[] inputA;
56  delete[] inputB;
57  delete[] output;
58 }