github ↗
docs menu

Module Submission.Run

Runs.

#type submission := t
#type t

The type for runs: the storage of one submission's launch and fill blocks, outside the OCaml heap, for one submit at a time. Submission.take hands them out.

#val submission : t -> submission

submission r is the submission whose blocks r holds.

#val release : t -> unit

release r frees r, which the calling thread has taken, keeping its bytes, so that a take may return it. It does nothing if the thread has not taken r.

Blocks

A launch's block holds its grid (its count of groups), the threads of each group, its shared memory and its parameters. A fill's holds its parameters. A run never grows. A setter stores only into a run the calling thread has taken, and raises Invalid_argument, storing nothing, otherwise. It raises in particular while a submit of the run is under way, such as a signal handler's store during the submit's wait. A store reads the run's state once and takes no lock, and no setter allocates. A setter raises Invalid_argument for a block of another submission.

#val groups : t -> block -> int -> int -> int -> unit

groups r b x y z sets the grid of b to x by y by z groups.

Raises Invalid_argument if one is negative or above 2{^32} - 1.

#val threads : t -> block -> int -> int -> int -> unit

threads r b x y z sets each group of b to x by y by z threads.

Raises Invalid_argument if one is negative or above 2{^32} - 1, or if x * y * z exceeds the most threads a group of b's function may have, where its driver knows it (Image.threads).

#val shared : t -> block -> int -> unit

shared r b n sets the dynamic shared memory of each group of b to n bytes.

Raises Invalid_argument if n is negative or above 2{^32} - 1.

Parameters

int32 r b i v stores v at byte i of b's parameters, in the host's byte order, and the others store likewise for their sizes: int32 the 32 low bits of v, int64 v, float32 v rounded to single precision, float64 v. At a buffer ref's at, the 8 bytes are the offset into its buffer (ref). At an entry ref's, each submit writes the function's value (Submission.entry).

Each raises Invalid_argument if i is negative or the bytes it stores end past b's parameters.

#val int32 : t -> block -> int -> int -> unit
#val int64 : t -> block -> int -> int64 -> unit
#val float32 : t -> block -> int -> float -> unit
#val float64 : t -> block -> int -> float -> unit