class ScriptGroup : BaseObj

A group of kernels that are executed together with one execution call as if they were a single kernel

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.

Summary

Nested classes

Represents a binding of a value to a global variable in a kernel or invocable function.

Helper class to build a ScriptGroup.

The builder class for creating script groups

An opaque class for closures

An opaque class for futures

An opaque class for script group inputs

Public methods
Unit

destroy()

Destroy this ScriptGroup and all Closures in it

Unit

execute()

Execute the ScriptGroup.

Array<Any!>!

execute(vararg inputs: Any!)

Executes a script group

Unit

Sets an input of the ScriptGroup.

Unit

Sets an output of the ScriptGroup.

Inherited functions

From class BaseObj

Boolean equals(other: Any?)

Compare the current BaseObj with another BaseObj for equality.

Unit finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

String! getName()
Int hashCode()

Calculates the hash code value for a BaseObj.

Unit setName(name: String!)

setName assigns a name to an object. This object can later be looked up by this name.

Public methods

destroy

fun destroy(): Unit

Deprecated: Deprecated in Java.

Destroy this ScriptGroup and all Closures in it

execute

fun execute(): Unit

Deprecated: Use #execute instead.

Execute the ScriptGroup. This will run all the kernels in the ScriptGroup. No internal connection results will be visible after execution of the ScriptGroup.

execute

fun execute(vararg inputs: Any!): Array<Any!>!

Deprecated: Deprecated in Java.

Executes a script group

Parameters
inputs Any!: Values for inputs to the script group, in the order as the inputs are added via Builder2.addInput.
Return
Array<Any!>! Outputs of the script group as an array of objects, in the order as futures are passed to Builder2.create.

setInput

fun setInput(
    s: Script.KernelID!,
    a: Allocation!
): Unit

Deprecated: Set arguments to execute(Object...) instead.

Sets an input of the ScriptGroup. This specifies an Allocation to be used for kernels that require an input Allocation provided from outside of the ScriptGroup.

Parameters
s Script.KernelID!: The ID of the kernel where the allocation should be connected.
a Allocation!: The allocation to connect.

setOutput

fun setOutput(
    s: Script.KernelID!,
    a: Allocation!
): Unit

Deprecated: Use return value of execute(Object...) instead.

Sets an output of the ScriptGroup. This specifies an Allocation to be used for the kernels that require an output Allocation visible after the ScriptGroup is executed.

Parameters
s Script.KernelID!: The ID of the kernel where the allocation should be connected.
a Allocation!: The allocation to connect.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-26 UTC.