sailfish.kernel.library

Defines a Library utility class to encapulsate CPU/GPU compiled kernels.

CPU modules are built with the cffi module. Build products including the .so file itself are placed in this module’s __pycache__ directory, and stored for reuse based on the SHA value of the source code and #define macros. GPU modules are JIT-compiled with cupy. No caching is presently done for the GPU modules.

Functions

arglen_error(sym, a, b)

dtype_error(sym, n, a, b)

layout_error(sym, n)

to_ctypes(args, spec)

Coerce a sequence of values to their appropriate ctype.

type_error(sym, n, a, b)

validate_constraints(args, spec, symbol)

Validate kernel argument constraints for a symbol.

validate_types(args, spec, symbol, xp)

Classes

Kernel(lib, symbol)

An object that uses __getitem__ syntax to return a KernelInvocation instance.

KernelInvocation(kernel, shape)

A kernel whose execution shape is specified and is ready to be invoked.

Library([code, mode, name, debug, define_macros])

Builds and maintains (in memory) a CPU or GPU dynamically compiled module.