Unittest to check same buffer copy-in and copy-out
@@ -51,6 +51,12 @@ public class TestHello extends TornadoTestBase {
}
}
+ public static void compute(int[] a) {
+ for (@Parallel int i = 0; i < a.length; i++) {
+ a[i] = a[i] * 2;
+ }
+ }
+
@Test
public void testHello() {
TaskSchedule task = new TaskSchedule("s0").task("t0", TestHello::printHello, 8);
@@ -131,4 +137,23 @@ public class TestHello extends TornadoTestBase {
}
}
+ @Test
+ public void testSimpleInOut() {
+ int numElements = 256;
+ int[] a = new int[numElements];
+
+ Arrays.fill(a, 10);
+
+ //@formatter:off
+ new TaskSchedule("s0")
+ .task("t0", TestHello::compute, a)
+ .streamOut(a)
+ .execute();
+ //@formatter:on
+
+ for (int i = 0; i < a.length; i++) {
+ assertEquals(20, a[i]);
+ }
+ }
+
}
