diff --git a/tornado-api/src/main/java/uk/ac/manchester/tornado/api/ExecutionPlanType.java b/tornado-api/src/main/java/uk/ac/manchester/tornado/api/ExecutionPlanType.java
new file mode 100644
index 0000000000..c74db148c4
--- /dev/null
+++ b/tornado-api/src/main/java/uk/ac/manchester/tornado/api/ExecutionPlanType.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2024, APT Group, Department of Computer Science,
+ * The University of Manchester.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package uk.ac.manchester.tornado.api;
+
+import uk.ac.manchester.tornado.api.plan.types.OffConcurrentDevices;
+import uk.ac.manchester.tornado.api.plan.types.OffMemoryLimit;
+import uk.ac.manchester.tornado.api.plan.types.OffPrintKernel;
+import uk.ac.manchester.tornado.api.plan.types.OffProfiler;
+import uk.ac.manchester.tornado.api.plan.types.OffThreadInfo;
+import uk.ac.manchester.tornado.api.plan.types.WithBatch;
+import uk.ac.manchester.tornado.api.plan.types.WithClearProfiles;
+import uk.ac.manchester.tornado.api.plan.types.WithCompilerFlags;
+import uk.ac.manchester.tornado.api.plan.types.WithConcurrentDevices;
+import uk.ac.manchester.tornado.api.plan.types.WithDefaultScheduler;
+import uk.ac.manchester.tornado.api.plan.types.WithDevicePlan;
+import uk.ac.manchester.tornado.api.plan.types.WithDynamicReconfiguration;
+import uk.ac.manchester.tornado.api.plan.types.WithFreeDeviceMemory;
+import uk.ac.manchester.tornado.api.plan.types.WithGridScheduler;
+import uk.ac.manchester.tornado.api.plan.types.WithMemoryLimit;
+import uk.ac.manchester.tornado.api.plan.types.WithPrintKernel;
+import uk.ac.manchester.tornado.api.plan.types.WithProfiler;
+import uk.ac.manchester.tornado.api.plan.types.WithResetDevice;
+import uk.ac.manchester.tornado.api.plan.types.WithThreadInfo;
+import uk.ac.manchester.tornado.api.plan.types.WithWarmUp;
+
+public abstract sealed class ExecutionPlanType extends TornadoExecutionPlan //
+ permits OffConcurrentDevices, OffMemoryLimit, OffPrintKernel, //
+ OffProfiler, OffThreadInfo, WithWarmUp, WithBatch, WithClearProfiles, //
+ WithCompilerFlags, WithConcurrentDevices, WithDefaultScheduler, //
+ WithDevicePlan, WithDynamicReconfiguration, WithFreeDeviceMemory, //
+ WithGridScheduler, WithMemoryLimit, WithPrintKernel, WithProfiler, //
+ WithResetDevice, WithThreadInfo {
+
+ public ExecutionPlanType(TornadoExecutionPlan parentNode) {
+
+ // Set link between the previous action (parent) and the new one
+ this.parentLink = parentNode;
+
+ // Propagate the root node of the current execution plan
+ this.rootNode = parentNode.rootNode;
+
+ // Set Link the root node to the leaf
+ this.rootNode.childLink = this;
+
+ // Copy the reference for the executor
+ this.tornadoExecutor = parentNode.tornadoExecutor;
+
+ // Copy the reference for the execution frame
+ this.executionFrame = parentNode.executionFrame;
+
+ // Set child reference to this instance
+ this.childLink = this;
+ }
+}
diff --git a/tornado-api/src/main/java/uk/ac/manchester/tornado/api/ImmutableTaskGraph.java b/tornado-api/src/main/java/uk/ac/manchester/tornado/api/ImmutableTaskGraph.java
index bd03d33070..dabd1423d2 100644
--- a/tornado-api/src/main/java/uk/ac/manchester/tornado/api/ImmutableTaskGraph.java
+++ b/tornado-api/src/main/java/uk/ac/manchester/tornado/api/ImmutableTaskGraph.java
@@ -36,7 +36,7 @@
* affecting the execution of graphs encapsulated in {@link ImmutableTaskGraph}.
*
*
- * @since TornadoVM-0.15
+ * @since 0.15
*/
public class ImmutableTaskGraph {
@@ -170,10 +170,6 @@ void enableProfiler(ProfilerMode profilerMode) {
taskGraph.enableProfiler(profilerMode);
}
- void disableProfiler(ProfilerMode profilerMode) {
- taskGraph.disableProfiler(profilerMode);
- }
-
void withConcurrentDevices() {
taskGraph.withConcurrentDevices();
}
diff --git a/tornado-api/src/main/java/uk/ac/manchester/tornado/api/TaskGraph.java b/tornado-api/src/main/java/uk/ac/manchester/tornado/api/TaskGraph.java
index 95b3b48b5e..ead6cca220 100644
--- a/tornado-api/src/main/java/uk/ac/manchester/tornado/api/TaskGraph.java
+++ b/tornado-api/src/main/java/uk/ac/manchester/tornado/api/TaskGraph.java
@@ -862,10 +862,6 @@ void enableProfiler(ProfilerMode profilerMode) {
taskGraphImpl.enableProfiler(profilerMode);
}
- void disableProfiler(ProfilerMode profilerMode) {
- taskGraphImpl.disableProfiler(profilerMode);
- }
-
void withConcurrentDevices() {
taskGraphImpl.withConcurrentDevices();
}
diff --git a/tornado-api/src/main/java/uk/ac/manchester/tornado/api/TornadoExecutionPlan.java b/tornado-api/src/main/java/uk/ac/manchester/tornado/api/TornadoExecutionPlan.java
index c7871ede15..c4231acd79 100644
--- a/tornado-api/src/main/java/uk/ac/manchester/tornado/api/TornadoExecutionPlan.java
+++ b/tornado-api/src/main/java/uk/ac/manchester/tornado/api/TornadoExecutionPlan.java
@@ -17,17 +17,32 @@
*/
package uk.ac.manchester.tornado.api;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.stream.Collectors;
import uk.ac.manchester.tornado.api.common.TornadoDevice;
import uk.ac.manchester.tornado.api.enums.ProfilerMode;
import uk.ac.manchester.tornado.api.enums.TornadoVMBackendType;
import uk.ac.manchester.tornado.api.exceptions.TornadoExecutionPlanException;
-import uk.ac.manchester.tornado.api.exceptions.TornadoRuntimeException;
+import uk.ac.manchester.tornado.api.plan.types.OffConcurrentDevices;
+import uk.ac.manchester.tornado.api.plan.types.OffMemoryLimit;
+import uk.ac.manchester.tornado.api.plan.types.OffPrintKernel;
+import uk.ac.manchester.tornado.api.plan.types.OffProfiler;
+import uk.ac.manchester.tornado.api.plan.types.OffThreadInfo;
+import uk.ac.manchester.tornado.api.plan.types.WithWarmUp;
+import uk.ac.manchester.tornado.api.plan.types.WithBatch;
+import uk.ac.manchester.tornado.api.plan.types.WithClearProfiles;
+import uk.ac.manchester.tornado.api.plan.types.WithCompilerFlags;
+import uk.ac.manchester.tornado.api.plan.types.WithConcurrentDevices;
+import uk.ac.manchester.tornado.api.plan.types.WithDefaultScheduler;
+import uk.ac.manchester.tornado.api.plan.types.WithDevicePlan;
+import uk.ac.manchester.tornado.api.plan.types.WithDynamicReconfiguration;
+import uk.ac.manchester.tornado.api.plan.types.WithFreeDeviceMemory;
+import uk.ac.manchester.tornado.api.plan.types.WithGridScheduler;
+import uk.ac.manchester.tornado.api.plan.types.WithMemoryLimit;
+import uk.ac.manchester.tornado.api.plan.types.WithPrintKernel;
+import uk.ac.manchester.tornado.api.plan.types.WithProfiler;
+import uk.ac.manchester.tornado.api.plan.types.WithResetDevice;
+import uk.ac.manchester.tornado.api.plan.types.WithThreadInfo;
import uk.ac.manchester.tornado.api.runtime.ExecutorFrame;
import uk.ac.manchester.tornado.api.runtime.TornadoRuntimeProvider;
@@ -40,7 +55,7 @@
*
* @since v0.15
*/
-public class TornadoExecutionPlan implements AutoCloseable {
+public sealed class TornadoExecutionPlan implements AutoCloseable permits ExecutionPlanType {
/**
* Method to obtain the default device in TornadoVM. The default one corresponds
@@ -48,11 +63,32 @@ public class TornadoExecutionPlan implements AutoCloseable {
*/
public static TornadoDevice DEFAULT_DEVICE = TornadoRuntimeProvider.getTornadoRuntime().getDefaultDevice();
- private final TornadoExecutor tornadoExecutor;
- private ProfilerMode profilerMode;
- private boolean disableProfiler;
private static final AtomicLong globalExecutionPlanCounter = new AtomicLong(0);
- private final ExecutorFrame executionPackage;
+
+ /**
+ * The TornadoVM executor is a list of chain of actions to be performed.
+ * Each action can enable/disable runtime features, influence the compiler,
+ * influence the code optimization, adapt runtime parameters, etc.
+ */
+ protected TornadoExecutor tornadoExecutor;
+
+ protected ExecutorFrame executionFrame;
+
+ // Pointers
+ /**
+ * Pointer to the Root of the List
+ */
+ protected TornadoExecutionPlan rootNode;
+
+ /**
+ * Pointer to the next node in the list
+ */
+ protected TornadoExecutionPlan childLink;
+
+ /**
+ * Pointer to the previous node in the list
+ */
+ protected TornadoExecutionPlan parentLink;
/**
* Create an Execution Plan: Object to create and optimize an execution plan for
@@ -65,9 +101,10 @@ public class TornadoExecutionPlan implements AutoCloseable {
* {@link ImmutableTaskGraph}
*/
public TornadoExecutionPlan(ImmutableTaskGraph... immutableTaskGraphs) {
- this.tornadoExecutor = new TornadoExecutor(immutableTaskGraphs);
+ tornadoExecutor = new TornadoExecutor(immutableTaskGraphs);
final long id = globalExecutionPlanCounter.incrementAndGet();
- executionPackage = new ExecutorFrame(id);
+ executionFrame = new ExecutorFrame(id);
+ rootNode = this;
}
/**
@@ -114,17 +151,9 @@ public static TornadoDeviceMap getTornadoDeviceMap() {
* @return {@link TornadoExecutionPlan}
*/
public TornadoExecutionResult execute() {
- checkProfilerEnabled();
- tornadoExecutor.execute(executionPackage);
- return new TornadoExecutionResult(new TornadoProfilerResult(tornadoExecutor));
- }
-
- private void checkProfilerEnabled() {
- if (this.profilerMode != null && !this.disableProfiler) {
- tornadoExecutor.enableProfiler(profilerMode);
- } else if (this.profilerMode != null) {
- tornadoExecutor.disableProfiler(profilerMode);
- }
+ tornadoExecutor.execute(executionFrame);
+ TornadoProfilerResult profilerResult = new TornadoProfilerResult(tornadoExecutor);
+ return new TornadoExecutionResult(profilerResult);
}
/**
@@ -134,9 +163,8 @@ private void checkProfilerEnabled() {
* @return {@link TornadoExecutionPlan}
*/
public TornadoExecutionPlan withWarmUp() {
- checkProfilerEnabled();
- tornadoExecutor.warmup(executionPackage);
- return this;
+ tornadoExecutor.warmup(executionFrame);
+ return new WithWarmUp(this);
}
/**
@@ -147,7 +175,31 @@ public TornadoExecutionPlan withWarmUp() {
*/
public TornadoExecutionPlan withDevice(TornadoDevice device) {
tornadoExecutor.setDevice(device);
- return this;
+ return new WithDevicePlan(this);
+ }
+
+ /**
+ * Print all operations enabled/disabled from the Execution Plan.
+ *
+ * @since 1.0.8
+ */
+ public void printTraceExecutionPlan() {
+ System.out.println(childLink);
+ }
+
+ /**
+ * Returns a string with all the operations enabled/disabled from the
+ * Execution Plan.
+ *
+ * @since 1.0.8
+ */
+ public String getTraceExecutionPlan() {
+ return childLink.toString();
+ }
+
+ @Override
+ public String toString() {
+ return "Root";
}
/**
@@ -163,7 +215,7 @@ public TornadoExecutionPlan withDevice(TornadoDevice device) {
*/
public TornadoExecutionPlan withDevice(String taskName, TornadoDevice device) {
tornadoExecutor.setDevice(taskName, device);
- return this;
+ return new WithDevicePlan(this);
}
/**
@@ -177,7 +229,7 @@ public TornadoExecutionPlan withDevice(String taskName, TornadoDevice device) {
*/
public TornadoExecutionPlan withConcurrentDevices() {
tornadoExecutor.withConcurrentDevices();
- return this;
+ return new WithConcurrentDevices(this);
}
/**
@@ -188,7 +240,7 @@ public TornadoExecutionPlan withConcurrentDevices() {
*/
public TornadoExecutionPlan withoutConcurrentDevices() {
tornadoExecutor.withoutConcurrentDevices();
- return this;
+ return new OffConcurrentDevices(this);
}
/**
@@ -219,7 +271,7 @@ public TornadoDevice getDevice(int immutableTaskGraphIndex) {
*/
public TornadoExecutionPlan freeDeviceMemory() {
tornadoExecutor.freeDeviceMemory();
- return this;
+ return new WithFreeDeviceMemory(this);
}
/**
@@ -233,7 +285,7 @@ public TornadoExecutionPlan freeDeviceMemory() {
*/
public TornadoExecutionPlan withGridScheduler(GridScheduler gridScheduler) {
tornadoExecutor.withGridScheduler(gridScheduler);
- return this;
+ return new WithGridScheduler(this);
}
/**
@@ -243,7 +295,7 @@ public TornadoExecutionPlan withGridScheduler(GridScheduler gridScheduler) {
*/
public TornadoExecutionPlan withDefaultScheduler() {
tornadoExecutor.withDefaultScheduler();
- return this;
+ return new WithDefaultScheduler(this);
}
/**
@@ -257,8 +309,8 @@ public TornadoExecutionPlan withDefaultScheduler() {
* @return {@link TornadoExecutionPlan}
*/
public TornadoExecutionPlan withDynamicReconfiguration(Policy policy, DRMode mode) {
- executionPackage.withPolicy(policy).withMode(mode);
- return this;
+ executionFrame.withPolicy(policy).withMode(mode);
+ return new WithDynamicReconfiguration(this);
}
/**
@@ -273,7 +325,7 @@ public TornadoExecutionPlan withDynamicReconfiguration(Policy policy, DRMode mod
*/
public TornadoExecutionPlan withBatch(String batchSize) {
tornadoExecutor.withBatch(batchSize);
- return this;
+ return new WithBatch(this);
}
/**
@@ -286,9 +338,8 @@ public TornadoExecutionPlan withBatch(String batchSize) {
* @return {@link TornadoExecutionPlan}
*/
public TornadoExecutionPlan withProfiler(ProfilerMode profilerMode) {
- this.profilerMode = profilerMode;
- disableProfiler = false;
- return this;
+ executionFrame.withProfilerOn(profilerMode);
+ return new WithProfiler(this);
}
/**
@@ -297,8 +348,8 @@ public TornadoExecutionPlan withProfiler(ProfilerMode profilerMode) {
* @return {@link TornadoExecutionPlan}
*/
public TornadoExecutionPlan withoutProfiler() {
- this.disableProfiler = true;
- return this;
+ executionFrame.withProfilerOff();
+ return new OffProfiler(this);
}
/**
@@ -314,7 +365,7 @@ public TornadoExecutionPlan withoutProfiler() {
*/
public TornadoExecutionPlan withMemoryLimit(String memoryLimit) {
tornadoExecutor.withMemoryLimit(memoryLimit);
- return this;
+ return new WithMemoryLimit(this);
}
/**
@@ -329,7 +380,7 @@ public TornadoExecutionPlan withMemoryLimit(String memoryLimit) {
*/
public TornadoExecutionPlan withoutMemoryLimit() {
tornadoExecutor.withoutMemoryLimit();
- return this;
+ return new OffMemoryLimit(this);
}
/**
@@ -342,14 +393,14 @@ public TornadoExecutionPlan withoutMemoryLimit() {
*/
public TornadoExecutionPlan resetDevice() {
tornadoExecutor.resetDevice();
- return this;
+ return new WithResetDevice(this);
}
/**
* Obtains the ID that was assigned to the execution plan.
*/
public long getId() {
- return executionPackage.getExecutionPlanId();
+ return executionFrame.getExecutionPlanId();
}
/**
@@ -366,7 +417,7 @@ public long getGlobalExecutionPlansCounter() {
*/
public TornadoExecutionPlan clearProfiles() {
tornadoExecutor.clearProfiles();
- return this;
+ return new WithClearProfiles(this);
}
/**
@@ -378,7 +429,7 @@ public TornadoExecutionPlan clearProfiles() {
*/
public TornadoExecutionPlan withThreadInfo() {
tornadoExecutor.withThreadInfo();
- return this;
+ return new WithThreadInfo(this);
}
/**
@@ -390,7 +441,7 @@ public TornadoExecutionPlan withThreadInfo() {
*/
public TornadoExecutionPlan withoutThreadInfo() {
tornadoExecutor.withoutThreadInfo();
- return this;
+ return new OffThreadInfo(this);
}
/**
@@ -400,10 +451,9 @@ public TornadoExecutionPlan withoutThreadInfo() {
*
* @return {@link TornadoExecutionPlan}
*/
-
public TornadoExecutionPlan withPrintKernel() {
tornadoExecutor.withPrintKernel();
- return this;
+ return new WithPrintKernel(this);
}
/**
@@ -415,7 +465,7 @@ public TornadoExecutionPlan withPrintKernel() {
*/
public TornadoExecutionPlan withoutPrintKernel() {
tornadoExecutor.withoutPrintKernel();
- return this;
+ return new OffPrintKernel(this);
}
/**
@@ -430,13 +480,14 @@ public TornadoExecutionPlan withoutPrintKernel() {
*/
public TornadoExecutionPlan withCompilerFlags(TornadoVMBackendType backend, String compilerFlags) {
tornadoExecutor.withCompilerFlags(backend, compilerFlags);
- return this;
+ return new WithCompilerFlags(this);
}
/**
* @since 1.0.4
*
- * @throws TornadoExecutionPlanException
+ * @throws {@link
+ * TornadoExecutionPlanException}
*/
@Override
public void close() throws TornadoExecutionPlanException {
@@ -453,202 +504,4 @@ public long getCurrentDeviceMemoryUsage() {
return tornadoExecutor.getCurrentDeviceMemoryUsage();
}
- static class TornadoExecutor {
-
- private final List immutableTaskGraphList;
-
- TornadoExecutor(ImmutableTaskGraph... immutableTaskGraphs) {
- immutableTaskGraphList = new ArrayList<>();
- Collections.addAll(immutableTaskGraphList, immutableTaskGraphs);
- }
-
- void execute(ExecutorFrame executionPackage) {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.execute(executionPackage));
- }
-
- void withGridScheduler(GridScheduler gridScheduler) {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.withGridScheduler(gridScheduler));
- }
-
- void warmup(ExecutorFrame executionPackage) {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.warmup(executionPackage));
- }
-
- void withBatch(String batchSize) {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.withBatch(batchSize));
- }
-
- void withMemoryLimit(String memoryLimit) {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.withMemoryLimit(memoryLimit));
- }
-
- public void withoutMemoryLimit() {
- immutableTaskGraphList.forEach(ImmutableTaskGraph::withoutMemoryLimit);
- }
-
- /**
- * For all task-graphs contained in an Executor, update the device.
- *
- * @param device
- * {@link TornadoDevice} object
- */
- void setDevice(TornadoDevice device) {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.withDevice(device));
- }
-
- void setDevice(String taskName, TornadoDevice device) {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.withDevice(taskName, device));
- }
-
- void withConcurrentDevices() {
- immutableTaskGraphList.forEach(ImmutableTaskGraph::withConcurrentDevices);
- }
-
- void withoutConcurrentDevices() {
- immutableTaskGraphList.forEach(ImmutableTaskGraph::withoutConcurrentDevices);
- }
-
- void freeDeviceMemory() {
- immutableTaskGraphList.forEach(ImmutableTaskGraph::freeDeviceMemory);
- }
-
- void transferToHost(Object... objects) {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.transferToHost(objects));
- }
-
- void partialTransferToHost(DataRange dataRange) {
- // At this point we compute the offsets and the total size in bytes.
- dataRange.materialize();
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.transferToHost(dataRange.getArray(), dataRange.getOffset(), dataRange.getPartialSize()));
- }
-
- boolean isFinished() {
- boolean result = true;
- for (ImmutableTaskGraph immutableTaskGraph : immutableTaskGraphList) {
- result &= immutableTaskGraph.isFinished();
- }
- return result;
- }
-
- void resetDevice() {
- immutableTaskGraphList.forEach(ImmutableTaskGraph::resetDevice);
- }
-
- long getTotalTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getTotalTime).mapToLong(Long::longValue).sum();
- }
-
- long getCompileTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getCompileTime).mapToLong(Long::longValue).sum();
- }
-
- long getTornadoCompilerTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getTornadoCompilerTime).mapToLong(Long::longValue).sum();
- }
-
- long getDriverInstallTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getDriverInstallTime).mapToLong(Long::longValue).sum();
- }
-
- long getDataTransfersTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getDataTransfersTime).mapToLong(Long::longValue).sum();
- }
-
- long getDeviceWriteTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getDeviceWriteTime).mapToLong(Long::longValue).sum();
- }
-
- long getDeviceReadTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getDeviceReadTime).mapToLong(Long::longValue).sum();
- }
-
- long getDataTransferDispatchTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getDataTransferDispatchTime).mapToLong(Long::longValue).sum();
- }
-
- long getKernelDispatchTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getKernelDispatchTime).mapToLong(Long::longValue).sum();
- }
-
- long getDeviceKernelTime() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getDeviceKernelTime).mapToLong(Long::longValue).sum();
- }
-
- long getTotalBytesCopyIn() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getTotalBytesCopyIn).mapToLong(Long::longValue).sum();
- }
-
- long getTotalBytesCopyOut() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getTotalBytesCopyOut).mapToLong(Long::longValue).sum();
- }
-
- String getProfileLog() {
- return immutableTaskGraphList.stream().map(ImmutableTaskGraph::getProfileLog).collect(Collectors.joining());
- }
-
- void dumpProfiles() {
- immutableTaskGraphList.forEach(ImmutableTaskGraph::dumpProfiles);
- }
-
- void clearProfiles() {
- immutableTaskGraphList.forEach(ImmutableTaskGraph::clearProfiles);
- }
-
- void withDefaultScheduler() {
- immutableTaskGraphList.forEach(immutableTaskGraph -> immutableTaskGraph.withDefaultScheduler(true));
- }
-
- TornadoDevice getDevice(int immutableTaskGraphIndex) {
- if (immutableTaskGraphList.size() < immutableTaskGraphIndex) {
- throw new TornadoRuntimeException("TaskGraph index #" + immutableTaskGraphIndex + " does not exist in current executor");
- }
- return immutableTaskGraphList.get(immutableTaskGraphIndex).getDevice();
- }
-
- List