Hi,
Comments/suggestions on section 3.6.3 "A Simple One-Dimensional Example"
In the following code snippet :
int i = get_global_id(0);
result[i] = dot(matrix[i], vector[0])
The reader assumes that for the first work item the variable i takes a value of 0, for the second work item i takes a value of 1, etc.
He/she also assumes that since there are 4 work items, each work item will be passed only a fourth of the original matrix.
Taking the second work items (with i=1) as an example, he/she then wonders how result[1] = dot(matrix[1], vector[0]) means :
mutltiply matrix[4:7] with the vector.
I feel that it would be useful to elaborate on how the global id relate to the indexes in the original matrix (and also on the consequences of the partitioning on the second argument: the 0 in vector[0] needs explaining).
Overall, I enjoy reading the book which is quite clear.
|