This section will provide an example specification-file and
implementation, implementing a simple 3-step algorithm, assuming the
existence of two vectors, vec1 and vec2:
- Multiply vec1 and vec2 by the parameter
m1.
- Add the two vectors together, and store the result in
vec3.
- Multiply vec3 by another parameter m2.
- Calculate the sum of vec3.
These three steps can easily be factored into one, but for the sake of
illustration, they will be kept seperately. The input vectors
vec1 and vec2 will be stored in some file, and will
serve as the input of our algorithm. The specification-file can now be
defined as follows:
We have chosen for the default memory-allocation scheme (dynamic),
because we cannot know in advance how large the vectors in the file
are. Another option would have been to set a maximum vector size, and
check if vectorSize is within this maximum. However, because
we only process one run of data, the dynamic scheme will not cause any
unnecessary overhead.
To generate the framework, call HyCuda from the commandline:
$ hycuda spec.hycuda -m
Joren Heit
2013-12-17