[example] MxM locking I/O objects
*/
package uk.ac.manchester.tornado.examples.compute;
+import java.util.Random;
+
import uk.ac.manchester.tornado.api.GridScheduler;
import uk.ac.manchester.tornado.api.TaskSchedule;
import uk.ac.manchester.tornado.api.WorkerGrid;
@@ -25,8 +27,13 @@ import uk.ac.manchester.tornado.api.annotations.Parallel;
import uk.ac.manchester.tornado.api.collections.types.Matrix2DFloat;
import uk.ac.manchester.tornado.api.enums.TornadoDeviceType;
-import java.util.Random;
-
+/**
+ * How to run?
+ *
+ * <code>
+ * $ tornado --threadInfo -Ds0.t0.device=0:0 -m tornado.examples/uk.ac.manchester.tornado.examples.compute.MatrixMultiplication2D
+ * </code>
+ */
public class MatrixMultiplication2D {
private static final int WARMING_UP_ITERATIONS = 15;
@@ -73,11 +80,12 @@ public class MatrixMultiplication2D {
GridScheduler gridScheduler = new GridScheduler("s0.t0", workerGrid);
// [Optional] Set the global work size
workerGrid.setGlobalWork(size, size, 1);
- // [Optional] Set the local work group to be 32x32
- workerGrid.setLocalWork(32, 32, 1);
+ // [Optional] Set the local work group to be 16x16
+ workerGrid.setLocalWork(16, 16, 1);
//@formatter:off
TaskSchedule t = new TaskSchedule("s0")
+ .lockObjectsInMemory(matrixA, matrixB, matrixC) // lock these objects
.task("t0", MatrixMultiplication2D::matrixMultiplication, matrixA, matrixB, matrixC, size)
.streamOut(matrixC);
//@formatter:on
