summaryrefslogtreecommitdiff
path: root/test-chill/unit-tests/cpp_validate_prog
diff options
context:
space:
mode:
authordhuth <derickhuth@gmail.com>2014-11-21 13:35:20 -0700
committerdhuth <derickhuth@gmail.com>2014-11-21 13:35:20 -0700
commita1834b22c43c282442b0cb164767e6c877cf0e5b (patch)
treebedc5be7d1bdb8d32c1868caa496a8a1530d8d8a /test-chill/unit-tests/cpp_validate_prog
parentded84bb4aec7461738e7b7033d782a518e2c606b (diff)
parenteb9236c5353785472ae132f27e1cfb9f1e4264a5 (diff)
downloadchill-a1834b22c43c282442b0cb164767e6c877cf0e5b.tar.gz
chill-a1834b22c43c282442b0cb164767e6c877cf0e5b.tar.bz2
chill-a1834b22c43c282442b0cb164767e6c877cf0e5b.zip
Merge branch 'master' into doe
Diffstat (limited to 'test-chill/unit-tests/cpp_validate_prog')
-rwxr-xr-xtest-chill/unit-tests/cpp_validate_prog/mm_in.py9
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one.cc29
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one.testproc6
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one_defines.cc25
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one_longer_main.cc93
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one_longer_wrong_main.cc93
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one_main.cc91
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one_out.cc60
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one_with.cc30
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one_with.testproc7
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_one_with_defines.cc25
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_three_basic.cc33
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_three_basic.cc.databin0 -> 124 bytes
-rw-r--r--test-chill/unit-tests/cpp_validate_prog/mm_three_slow.cc35
-rwxr-xr-xtest-chill/unit-tests/cpp_validate_prog/print_mm_out.py10
15 files changed, 546 insertions, 0 deletions
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_in.py b/test-chill/unit-tests/cpp_validate_prog/mm_in.py
new file mode 100755
index 0000000..93eb080
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_in.py
@@ -0,0 +1,9 @@
+#!/usr/bin/python
+
+import struct
+
+data = list(range(15)) + list(range(10)) + [0]*6
+bindata = ''.join([struct.pack('f',n) for n in data])
+with open('mm.in.data','wb') as f:
+ f.write(bindata)
+
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one.cc b/test-chill/unit-tests/cpp_validate_prog/mm_one.cc
new file mode 100644
index 0000000..6131ae1
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one.cc
@@ -0,0 +1,29 @@
+#define AN 3
+#define BM 2
+#define AMBN 5
+
+/*
+
+<test name='mm_small'>
+
+procedure void mm(
+ in float[3][5] A = matrix([*,*],lambda i,j: random(-8,8)),
+ in float[5][2] B = matrix([*,*],lambda i,j: random(-8,8)),
+ out float[3][2] C = matrix([*,*],lambda i,j: 0))
+
+</test>
+
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ int i;
+ int j;
+ int k;
+ for(i = 0; i < AN; i++) {
+ for(j = 0; j < BM; j++) {
+ for(k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one.testproc b/test-chill/unit-tests/cpp_validate_prog/mm_one.testproc
new file mode 100644
index 0000000..a12a963
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one.testproc
@@ -0,0 +1,6 @@
+
+procedure void mm(
+ in float[3][5] A = matrix([*,*],lambda i,j: random(-8,8)),
+ in float[5][2] B = matrix([*,*],lambda i,j: random(-8,8)),
+ out float[3][2] C = matrix([*,*],lambda i,j: 0))
+
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one_defines.cc b/test-chill/unit-tests/cpp_validate_prog/mm_one_defines.cc
new file mode 100644
index 0000000..e35f189
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one_defines.cc
@@ -0,0 +1,25 @@
+
+/*
+<test name='mm_small' define="{'AN':3, 'BM':2, 'AMBN':5}">
+
+procedure void mm(
+ in float[AN][AMBN] A = matrix([*,*],lambda i,j: random(-8,8)),
+ in float[AMBN][BM] B = matrix([*,*],lambda i,j: random(-8,8)),
+ out float[AN][BM] C = matrix([*,*],lambda i,j: 0))
+
+</test>
+
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ int i;
+ int j;
+ int k;
+ for(i = 0; i < AN; i++) {
+ for(j = 0; j < BM; j++) {
+ for(k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one_longer_main.cc b/test-chill/unit-tests/cpp_validate_prog/mm_one_longer_main.cc
new file mode 100644
index 0000000..5b7e6c1
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one_longer_main.cc
@@ -0,0 +1,93 @@
+#define AN 3
+#define BM 2
+#define AMBN 5
+//#define PRINT
+
+#include <time.h>
+#include <fstream>
+#include <cstdio>
+
+/*
+
+<test name='mm_small'>
+
+procedure void mm(
+ in float[3][5] A = matrix([*,*],lambda i,j: random(-8,8)),
+ in float[5][2] B = matrix([*,*],lambda i,j: random(-8,8)),
+ out float[3][2] C = matrix([*,*],lambda i,j: 0))
+
+</test>
+
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ int i;
+ int j;
+ int k;
+ for(i = 0; i < AN; i++) {
+ for(j = 0; j < BM; j++) {
+ C[i][j] = 0;
+ for(k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+}
+
+int main(int argc, char** argv) {
+ float A[3][5] = {{0,1,2,3,4},{5,6,7,8,9},{10,11,12,13,14}};
+ float B[5][2] = {{0,1},{2,3},{4,5},{6,7},{8,9}};
+ float C[3][2] = {{0,0},{0,0},{0,0}};
+ timespec start_time;
+ timespec end_time;
+
+ if (argc == 3) {
+ std::ifstream is(argv[1], std::ifstream::in | std::ifstream::binary);
+ is.read((char*)A, 15*sizeof(float));
+ is.read((char*)B, 10*sizeof(float));
+ is.close();
+ }
+
+ clock_gettime(CLOCK_REALTIME, &start_time);
+ for(int i = 0; i < 10000; i++) {
+ mm(A,B,C);
+ }
+ clock_gettime(CLOCK_REALTIME, &end_time);
+
+ if (argc == 3) {
+ std::ofstream os(argv[2], std::ofstream::out | std::ofstream::binary);
+ os.write((char*)C, 6*sizeof(float));
+ os.close();
+ }
+
+ #ifdef PRINT
+ std::printf("A:\n");
+ for(int i = 0; i < 3; i++) {
+ std::printf("[");
+ for(int j = 0; j < 5; j++) {
+ std::printf("%f,",A[i][j]);
+ }
+ std::printf("]\n");
+ }
+ std::printf("B:\n");
+ for(int i = 0; i < 5; i++) {
+ std::printf("[");
+ for(int j = 0; j < 2; j++) {
+ std::printf("%f,",B[i][j]);
+ }
+ std::printf("]\n");
+ }
+ std::printf("C:\n");
+ for(int i = 0; i < 3; i++) {
+ std::printf("[");
+ for(int j = 0; j < 2; j++) {
+ std::printf("%f,",C[i][j]);
+ }
+ std::printf("]\n");
+ }
+ #else
+ double time_diff = (end_time.tv_sec - start_time.tv_sec) + (end_time.tv_nsec - start_time.tv_nsec)/1000000000.0;
+ std::printf("(%f,)", time_diff);
+ #endif
+ return 0;
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one_longer_wrong_main.cc b/test-chill/unit-tests/cpp_validate_prog/mm_one_longer_wrong_main.cc
new file mode 100644
index 0000000..7d96248
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one_longer_wrong_main.cc
@@ -0,0 +1,93 @@
+#define AN 3
+#define BM 2
+#define AMBN 5
+//#define PRINT
+
+#include <time.h>
+#include <fstream>
+#include <cstdio>
+
+/*
+
+<test name='mm_small'>
+
+procedure void mm(
+ in float[3][5] A = matrix([*,*],lambda i,j: random(-8,8)),
+ in float[5][2] B = matrix([*,*],lambda i,j: random(-8,8)),
+ out float[3][2] C = matrix([*,*],lambda i,j: 0))
+
+</test>
+
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ int i;
+ int j;
+ int k;
+ for(i = 0; i < AN; i++) {
+ for(j = 0; j < BM; j++) {
+ C[i][j] = 0;
+ for(k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] + B[k][j];
+ }
+ }
+ }
+}
+
+int main(int argc, char** argv) {
+ float A[3][5] = {{0,1,2,3,4},{5,6,7,8,9},{10,11,12,13,14}};
+ float B[5][2] = {{0,1},{2,3},{4,5},{6,7},{8,9}};
+ float C[3][2] = {{0,0},{0,0},{0,0}};
+ timespec start_time;
+ timespec end_time;
+
+ if (argc == 3) {
+ std::ifstream is(argv[1], std::ifstream::in | std::ifstream::binary);
+ is.read((char*)A, 15*sizeof(float));
+ is.read((char*)B, 10*sizeof(float));
+ is.close();
+ }
+
+ clock_gettime(CLOCK_REALTIME, &start_time);
+ for(int i = 0; i < 1000000; i++) {
+ mm(A,B,C);
+ }
+ clock_gettime(CLOCK_REALTIME, &end_time);
+
+ if (argc == 3) {
+ std::ofstream os(argv[2], std::ofstream::out | std::ofstream::binary);
+ os.write((char*)C, 6*sizeof(float));
+ os.close();
+ }
+
+ #ifdef PRINT
+ std::printf("A:\n");
+ for(int i = 0; i < 3; i++) {
+ std::printf("[");
+ for(int j = 0; j < 5; j++) {
+ std::printf("%f,",A[i][j]);
+ }
+ std::printf("]\n");
+ }
+ std::printf("B:\n");
+ for(int i = 0; i < 5; i++) {
+ std::printf("[");
+ for(int j = 0; j < 2; j++) {
+ std::printf("%f,",B[i][j]);
+ }
+ std::printf("]\n");
+ }
+ std::printf("C:\n");
+ for(int i = 0; i < 3; i++) {
+ std::printf("[");
+ for(int j = 0; j < 2; j++) {
+ std::printf("%f,",C[i][j]);
+ }
+ std::printf("]\n");
+ }
+ #else
+ double time_diff = (end_time.tv_sec - start_time.tv_sec) + (end_time.tv_nsec - start_time.tv_nsec)/1000000000.0;
+ std::printf("(%f,)", time_diff);
+ #endif
+ return 0;
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one_main.cc b/test-chill/unit-tests/cpp_validate_prog/mm_one_main.cc
new file mode 100644
index 0000000..a03b505
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one_main.cc
@@ -0,0 +1,91 @@
+#define AN 3
+#define BM 2
+#define AMBN 5
+//#define PRINT
+
+#include <time.h>
+#include <fstream>
+#include <cstdio>
+
+/*
+
+<test name='mm_small'>
+
+procedure void mm(
+ in float[3][5] A = matrix([*,*],lambda i,j: random(-8,8)),
+ in float[5][2] B = matrix([*,*],lambda i,j: random(-8,8)),
+ out float[3][2] C = matrix([*,*],lambda i,j: 0))
+
+</test>
+
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ int i;
+ int j;
+ int k;
+ for(i = 0; i < AN; i++) {
+ for(j = 0; j < BM; j++) {
+ C[i][j] = 0;
+ for(k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+}
+
+int main(int argc, char** argv) {
+ float A[3][5] = {{0,1,2,3,4},{5,6,7,8,9},{10,11,12,13,14}};
+ float B[5][2] = {{0,1},{2,3},{4,5},{6,7},{8,9}};
+ float C[3][2] = {{0,0},{0,0},{0,0}};
+ timespec start_time;
+ timespec end_time;
+
+ if (argc == 3) {
+ std::ifstream is(argv[1], std::ifstream::in | std::ifstream::binary);
+ is.read((char*)A, 15*sizeof(float));
+ is.read((char*)B, 10*sizeof(float));
+ is.close();
+ }
+
+ clock_gettime(CLOCK_REALTIME, &start_time);
+ mm(A,B,C);
+ clock_gettime(CLOCK_REALTIME, &end_time);
+
+ if (argc == 3) {
+ std::ofstream os(argv[2], std::ofstream::out | std::ofstream::binary);
+ os.write((char*)C, 6*sizeof(float));
+ os.close();
+ }
+
+ #ifdef PRINT
+ std::printf("A:\n");
+ for(int i = 0; i < 3; i++) {
+ std::printf("[");
+ for(int j = 0; j < 5; j++) {
+ std::printf("%f,",A[i][j]);
+ }
+ std::printf("]\n");
+ }
+ std::printf("B:\n");
+ for(int i = 0; i < 5; i++) {
+ std::printf("[");
+ for(int j = 0; j < 2; j++) {
+ std::printf("%f,",B[i][j]);
+ }
+ std::printf("]\n");
+ }
+ std::printf("C:\n");
+ for(int i = 0; i < 3; i++) {
+ std::printf("[");
+ for(int j = 0; j < 2; j++) {
+ std::printf("%f,",C[i][j]);
+ }
+ std::printf("]\n");
+ }
+ #else
+ double time_diff = (end_time.tv_sec - start_time.tv_sec) + (end_time.tv_nsec - start_time.tv_nsec)/1000000000.0;
+ std::printf("(%f,)", time_diff);
+ #endif
+ return 0;
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one_out.cc b/test-chill/unit-tests/cpp_validate_prog/mm_one_out.cc
new file mode 100644
index 0000000..6151301
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one_out.cc
@@ -0,0 +1,60 @@
+#include <time.h>
+#include <fstream>
+#include <cstdio>
+
+
+#define AN 3
+#define BM 2
+#define AMBN 5
+
+/*
+
+<test name='mm_small'>
+
+procedure void mm(
+ in float[3][5] A = matrix([*,*],lambda i,j: random(-8,8)),
+ in float[5][2] B = matrix([*,*],lambda i,j: random(-8,8)),
+ out float[3][2] C = matrix([*,*],lambda i,j: 0))
+
+</test>
+
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ int i;
+ int j;
+ int k;
+ for(i = 0; i < AN; i++) {
+ for(j = 0; j < BM; j++) {
+ for(k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+}
+
+int main(int argc, char** argv) {
+ float A[3][5];
+ float B[5][2];
+ float C[3][2];
+ timespec start_time;
+ timespec end_time;
+
+ std::ifstream datafile_initialize(argv[1]);
+ datafile_initialize.read((char*)A, 15*sizeof(float));
+ datafile_initialize.read((char*)B, 10*sizeof(float));
+ datafile_initialize.read((char*)C, 6*sizeof(float));
+ datafile_initialize.close();
+
+ clock_gettime(CLOCK_REALTIME, &start_time);
+ mm(A,B,C);
+ clock_gettime(CLOCK_REALTIME, &end_time);
+
+ std::ofstream datafile_out(argv[2]);
+ datafile_out.write((char*)C, 6*sizeof(float));
+ datafile_out.close();
+
+ double time_diff = (end_time.tv_sec - start_time.tv_sec) + (end_time.tv_nsec - start_time.tv_nsec)/1000000000.0;
+ std::printf("(%f,)", time_diff);
+ return 0;
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one_with.cc b/test-chill/unit-tests/cpp_validate_prog/mm_one_with.cc
new file mode 100644
index 0000000..9cb0ae4
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one_with.cc
@@ -0,0 +1,30 @@
+#define AN 3
+#define BM 2
+#define AMBN 5
+
+/*
+
+<test name='mm_small'>
+
+with {evendist2:lambda i,j: random(-8,8), zero2:lambda i,j: 0}
+procedure void mm(
+ in float[3][5] A = matrix([*,*],evendist2),
+ in float[5][2] B = matrix([*,*],evendist2),
+ out float[3][2] C = matrix([*,*],zero2))
+
+</test>
+
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ int i;
+ int j;
+ int k;
+ for(i = 0; i < AN; i++) {
+ for(j = 0; j < BM; j++) {
+ for(k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one_with.testproc b/test-chill/unit-tests/cpp_validate_prog/mm_one_with.testproc
new file mode 100644
index 0000000..80bc841
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one_with.testproc
@@ -0,0 +1,7 @@
+
+with {evendist2:lambda i,j: random(-8,8), zero2:lambda i,j: 0}
+procedure void mm(
+ in float[3][5] A = matrix([*,*],evendist2),
+ in float[5][2] B = matrix([*,*],evendist2),
+ out float[3][2] C = matrix([*,*],zero2))
+
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_one_with_defines.cc b/test-chill/unit-tests/cpp_validate_prog/mm_one_with_defines.cc
new file mode 100644
index 0000000..77ce673
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_one_with_defines.cc
@@ -0,0 +1,25 @@
+
+/*
+<test name='mm_small' define="{'AN':3, 'BM':2, 'AMBN':5}">
+
+with {evendist2:lambda i,j: random(-8,8), zero2:lambda i,j: 0}
+procedure void mm(
+ in float[AN][AMBN] A = matrix([*,*],evendist2),
+ in float[AMBN][BM] B = matrix([*,*],evendist2),
+ out float[AN][BM] C = matrix([*,*],zero2))
+
+</test>
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ int i;
+ int j;
+ int k;
+ for(i = 0; i < AN; i++) {
+ for(j = 0; j < BM; j++) {
+ for(k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_three_basic.cc b/test-chill/unit-tests/cpp_validate_prog/mm_three_basic.cc
new file mode 100644
index 0000000..49df049
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_three_basic.cc
@@ -0,0 +1,33 @@
+/*
+<test name=small define="{'AN':2, 'AMBN':5, 'BM':3}">
+ procedure void mm(
+ in float[AN][AMBN] A = matrix([,],lambda i,j: i*AMBN + j),
+ in float[AMBN][BM] B = matrix([,],lambda i,j: i*BM + j),
+ out float[AN][BM] C = matrix([,],lambda i,j: 0))
+</test>
+
+<test name=medium define="{'AN':20, 'AMBN':50, 'BM':30}">
+ procedure void mm(
+ in float[AN][AMBN] A = matrix([,],lambda i,j: i*AMBN + j),
+ in float[AMBN][BM] B = matrix([,],lambda i,j: i*BM + j),
+ out float[AN][BM] C = matrix([,],lambda i,j: 0))
+</test>
+
+<test name=big define="{'AN':200, 'AMBN':500, 'BM':300}">
+ procedure void mm(
+ in float[AN][AMBN] A = matrix([,],lambda i,j: i*AMBN + j),
+ in float[AMBN][BM] B = matrix([,],lambda i,j: i*BM + j),
+ out float[AN][BM] C = matrix([,],lambda i,j: 0))
+</test>
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ for(int i = 0; i < AN; i++) {
+ for(int j = 0; j < BM; j++) {
+ C[i][j] = 0;
+ for(int k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_three_basic.cc.data b/test-chill/unit-tests/cpp_validate_prog/mm_three_basic.cc.data
new file mode 100644
index 0000000..82c5ce6
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_three_basic.cc.data
Binary files differ
diff --git a/test-chill/unit-tests/cpp_validate_prog/mm_three_slow.cc b/test-chill/unit-tests/cpp_validate_prog/mm_three_slow.cc
new file mode 100644
index 0000000..dd8c7e7
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/mm_three_slow.cc
@@ -0,0 +1,35 @@
+/*
+<test name=small define="{'AN':2, 'AMBN':5, 'BM':3}">
+ procedure void mm(
+ in float[AN][AMBN] A = matrix([,],lambda i,j: i*AMBN + j),
+ in float[AMBN][BM] B = matrix([,],lambda i,j: i*BM + j),
+ out float[AN][BM] C = matrix([,],lambda i,j: 0))
+</test>
+
+<test name=medium define="{'AN':20, 'AMBN':50, 'BM':30}">
+ procedure void mm(
+ in float[AN][AMBN] A = matrix([,],lambda i,j: i*AMBN + j),
+ in float[AMBN][BM] B = matrix([,],lambda i,j: i*BM + j),
+ out float[AN][BM] C = matrix([,],lambda i,j: 0))
+</test>
+
+<test name=big define="{'AN':200, 'AMBN':500, 'BM':300}">
+ procedure void mm(
+ in float[AN][AMBN] A = matrix([,],lambda i,j: i*AMBN + j),
+ in float[AMBN][BM] B = matrix([,],lambda i,j: i*BM + j),
+ out float[AN][BM] C = matrix([,],lambda i,j: 0))
+</test>
+*/
+
+void mm(float A[AN][AMBN], float B[AMBN][BM], float C[AN][BM]) {
+ for(int w = 0; w < 100; w++) {
+ for(int i = 0; i < AN; i++) {
+ for(int j = 0; j < BM; j++) {
+ C[i][j] = 0;
+ for(int k = 0; k < AMBN; k++) {
+ C[i][j] += A[i][k] * B[k][j];
+ }
+ }
+ }
+ }
+}
diff --git a/test-chill/unit-tests/cpp_validate_prog/print_mm_out.py b/test-chill/unit-tests/cpp_validate_prog/print_mm_out.py
new file mode 100755
index 0000000..fefbd2a
--- /dev/null
+++ b/test-chill/unit-tests/cpp_validate_prog/print_mm_out.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+import struct
+import numpy as np
+
+with open('mm.out.data','rb') as f:
+ data = f.read()
+
+mat = np.array([struct.unpack_from('f',data,n*4) for n in range(len(data)/4)]).reshape((3,2))
+print(mat)