public final class ScriptGroup extends BaseObj
In addition to kernels, a script group may contain invocable functions as well. A script group may take inputs and generate outputs, which are consumed and produced by its member kernels. Inside a script group, outputs from one kernel can be passed to another kernel as inputs. The API disallows cyclic dependencies among kernels in a script group, effectively making it a directed acyclic graph (DAG) of kernels.
Grouping kernels together allows for more efficient execution. For example, runtime and compiler optimization can be applied to reduce computation and communication overhead, and to make better use of the CPU and the GPU.
Modifier and Type | Class and Description |
---|---|
static class |
ScriptGroup.Binding
Represents a binding of a value to a global variable in a
kernel or invocable function.
|
static class |
ScriptGroup.Builder
Deprecated.
Use
ScriptGroup.Builder2 instead. |
static class |
ScriptGroup.Builder2
The builder class for creating script groups
A script group is created using closures (see class
ScriptGroup.Closure ). |
static class |
ScriptGroup.Closure
An opaque class for closures
A closure represents a function call to a kernel or invocable function,
combined with arguments and values for global variables.
|
static class |
ScriptGroup.Future
An opaque class for futures
A future represents an output of a closure, either the return value of
the function, or the value of a global variable written by the function.
|
static class |
ScriptGroup.Input
An opaque class for script group inputs
Created by calling the
ScriptGroup.Builder2.addInput() method. |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy this ScriptGroup and all Closures in it
|
void |
execute()
Deprecated.
Use
execute(java.lang.Object...) instead. |
Object[] |
execute(Object... inputs)
Executes a script group
|
void |
setInput(Script.KernelID s,
Allocation a)
Deprecated.
Set arguments to
execute(Object...) instead. |
void |
setOutput(Script.KernelID s,
Allocation a)
Deprecated.
Use return value of
execute(Object...) instead. |
public Object[] execute(Object... inputs)
inputs
- Values for inputs to the script group, in the order as the
inputs are added via ScriptGroup.Builder2.addInput()
.ScriptGroup.Builder2.create(java.lang.String, android.renderscript.ScriptGroup.Future...)
.public void setInput(Script.KernelID s, Allocation a)
execute(Object...)
instead.s
- The ID of the kernel where the allocation should be
connected.a
- The allocation to connect.public void setOutput(Script.KernelID s, Allocation a)
execute(Object...)
instead.s
- The ID of the kernel where the allocation should be
connected.a
- The allocation to connect.public void execute()
execute(java.lang.Object...)
instead.