Cuda Exercise 1

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

1.

Revese Array
1. Given an input array {a0, a1, ..., an-1} in pointer d_a, store the reversed array {an-1, an-
2, ..., a0} in pointer d_b .
2. Start from the reverseArray_sin!"eb"o#$% temp"ate . &n"y one thread b"o#$ "aun#hed, to
reverse an array of si'e . ( ) num*hreads ) 2+, e"ements .
-. A"" you have to do is imp"ement the body of the
.. $erne" reverseArray/"o#$01%
+. 2a#h thread moves a sin!"e e"ement to reversed position
,. Read input from d_a pointer
3. Store output in reversed "o#ation in d_b pointer
2. Reverse array 04u"ti /"o#$1
Given an input array {a0, a1, ..., an-1} in pointer d_a, store the reversed array {an-1, an-2, ..., a0} in
pointer d_b
1. Start from the reverseArray_mu"tib"o#$% temp"ate
2. 4u"tip"e 2+,-thread b"o#$s "aun#hed
-. *o reverse an array of si'e (, (52+, b"o#$s
.. 6art 17 8ompute the number of b"o#$s to "aun#h
+. 6art 27 9mp"ement the $erne" reverseArray/"o#$01
,. (ote that no: you must #ompute both
3. *he reversed "o#ation :ithin the b"o#$
;. *he reversed offset to the start of the b"o#$

You might also like