Copy test matrix 2D added
@@ -144,7 +144,7 @@ public class TestMatrices extends TornadoTestBase {
@Test
public void testMatrixVector() {
- final int N = 512;
+ final int N = 4;
float[] matrix = new float[N * N];
float[] vector = new float[N];
float[] result = new float[N];
@@ -172,6 +172,38 @@ public class TestMatrices extends TornadoTestBase {
}
}
+ public static void copyMatrix2D(final float[][] matrixA, final float[][] matrixB) {
+ for (@Parallel int i = 0; i < matrixA.length; i++) {
+ for (@Parallel int j = 0; j < matrixA[i].length; j++) {
+ matrixB[i][j] = matrixA[i][j];
+ }
+ }
+ }
+
+ @Test
+ @Ignore
+ public void testCopyMatrix2D() {
+ final int N = 32;
+ float[][] matrixA = new float[N][N];
+ float[][] matrixB = new float[N][N];
+
+ Random random = new Random();
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < N; j++) {
+ matrixA[i][j] = random.nextFloat();
+ }
+ }
+
+ TaskSchedule ts = new TaskSchedule("s0").task("s0", TestMatrices::copyMatrix2D, matrixA, matrixB).streamOut(matrixB);
+ ts.execute();
+
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < N; j++) {
+ assertEquals(matrixA[i][j], matrixB[i][j], 0.01);
+ }
+ }
+ }
+
@Test
public void testMatrixMultiplication() {
final int N = 64;
