summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2012-04-27 16:27:36 -0400
committerTom Stellard <thomas.stellard@amd.com>2012-04-27 16:27:36 -0400
commit8946be85b1f4000da5ad95f7179e85582276dba1 (patch)
treeb657e756f69f05be4169eee17470a644dca7d37a
parent118b7b08a62a79cb8409cf619fb18a49feb7e04b (diff)
mat-mul: It works now
-rw-r--r--mat_mul.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/mat_mul.c b/mat_mul.c
index fbe7cc8..802bfad 100644
--- a/mat_mul.c
+++ b/mat_mul.c
@@ -24,28 +24,27 @@ int main(int argc, char ** argv)
size_t a_bytes;
size_t b_bytes;
-/*
- int A[8] = {1, 3, 4, 7,
+
+ /* 2 x 4 */
+ int A[8] = {1, 3, 5, 7,
2, 4, 6, 8};
+ /* 4 x 3 */
int B[12] = {1, 8, 9,
2, 7, 10,
3, 6, 11,
4, 5, 12};
-*/
- int A[1] = {5};
- int B[1] = {3};
- widthA = 1;
- heightA = 1;
+ heightA = 2;
+ widthA = 4;
- widthB = 1;
- heightB = 1;
+ heightB = 4;
+ widthB = 3;
global_work_size[0] = widthB;
global_work_size[1] = heightA;
- out_size = heightA * heightB;
+ out_size = heightA * widthB;
out_bytes = sizeof(int) * out_size;
a_bytes = sizeof(int) * widthA * heightA;
@@ -96,7 +95,7 @@ int main(int argc, char ** argv)
for (i = 0; i < out_size; i++) {
fprintf(stderr, "%d ", out[i]);
- if ((i + 1) % heightB == 0) {
+ if ((i + 1) % widthB == 0) {
fprintf(stderr, "\n");
}
}