Common Lisp Package: LPARALLEL.DEFPUN

Fine-grained parallelism.

README:

FUNCTION

Private

OPTIMIZER-DATA (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

OPTIMIZER-FLAG (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

SYMBOLICATE/PACKAGE (PACKAGE &REST STRING-DESIGNATORS)

Concatenate `string-designators' then intern the result into `package'.

TASK-COUNTER-COUNT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TASK-COUNTER-LOCK (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

UNWRAP-RESULT (RESULT)

In `receive-result', this is called on the stored task result. The user receives the return value of this function.

WRAP-ERROR (CONDITION)

Wrap an error. A non-error condition may also be wrapped, though it will still be signaled with `error'.

Undocumented

%KERNEL-WORKER-COUNT

%MAKE-FUTURE (FN)

CALL-WITH-TASK-HANDLER

COPY-TASK-COUNTER (INSTANCE)

DELETE-REGISTERED-NAMES (NAMES)

DELETE-STALE-REGISTRATIONS

FORCE

FORCE/FAST

FULFILLEDP

HAS-LAMBDA-LIST-KEYWORD-P (LIST)

MAKE-FUTURE

MAKE-SPIN-LOCK

MAKE-TASK

MAKE-TASK-COUNTER

PAIRP (FORM)

REGISTER-FN (NAME)

REGISTER-NAME (NAME)

REGISTERED-FN-P (NAME)

REGISTERED-MACROLETS (KERNEL)

STEAL-WORK

SUBMIT-RAW-TASK (TASK KERNEL)

SETFTASK-COUNTER-COUNT (NEW-VALUE INSTANCE)

SETFTASK-COUNTER-LOCK (NEW-VALUE INSTANCE)

TASK-COUNTER-P (OBJECT)

UNCHECKED-NAME (NAME)

UPDATE-TASK-COUNT

UPDATE-TASK-COUNT/-1

UPDATE-TASK-COUNT/NO-LOCK

UPDATE-TASK-COUNT/NO-LOCK/-1

VALID-REGISTERED-FN-P (NAME)

VALID-REGISTERED-NAME-P (NAME)

MACRO

Public

DECLAIM-DEFPUN (&REST NAMES)

See `defpun'.

DEFPUN (NAME PARAMS &BODY BODY)

`defpun' defines a function which is specially geared for fine-grained parallelism. If you have many small tasks which bog down the system, `defpun' may help. The syntax of `defpun' matches that of `defun'. The difference is that `plet' and `plet-if' take on new meaning inside `defpun'. The symbols in the binding positions of `plet' and `plet-if' should be viewed as lazily evaluated immutable references. Inside a `defpun' form the name of the function being defined is a macrolet, as are the names of other functions which were defined by `defpun'. Thus using #' on them is an error. Calls to functions defined by `defpun' entail more overhead when the caller lies outside a `defpun' form. A `defpun' function must exist before it is referenced inside another `defpun' function. If this is not possible--for example if func1 and func2 reference each other--then use `declaim-defpun' to specify intent: (declaim-defpun func1 func2)

DEFPUN* (NAME PARAMS &BODY BODY)

Like `defpun' except that it defines a function which is optimized for N-1 worker threads where N is the number of cores. A function defined with `defpun*' differs from its unstarred counterpart in two ways: it has less overhead, and the thread which calls it always participates in the computation. In contrast, the caller of a function defined by `defpun' participates in the computation only when the caller is in a worker thread.

DEFPUN/TYPE (NAME PARAMS ARG-TYPES RETURN-TYPE &BODY BODY)

Typed version of `defpun'. `arg-types' is an unevaluated list of argument types. `return-type' is an unevaluated form of the return type, possibly indicating multiple values as in (values fixnum float). (As a technical point, if `return-type' contains no lambda list keywords then the return type given to ftype will be additionally constrained to match the number of return values specified.)

DEFPUN/TYPE* (NAME PARAMS ARG-TYPES RETURN-TYPE &BODY BODY)

Typed version of `defpun*'. Also see `defpun/type'.

PLET (BINDINGS &BODY BODY)

The syntax of `plet' matches that of `let'. plet ({var-no-init | (var [init-form])}*) form* For each (var init-form) pair, a future is created which executes `init-form'. Inside `body', `var' is a symbol macro which expands to a `force' form for the corresponding future. Each `var-no-init' is bound to nil and each `var' without `init-form' is bound to nil (no future is created). `plet' is subject to optimization inside `defpun'.

PLET-IF (PREDICATE BINDINGS &BODY BODY)

The syntax of `plet-if' matches that of `let' except for the addition of the `predicate' form. If `predicate' evaluates to true, the behavior is the same as `plet'. If `predicate' evaluates to false, the behavior is the same as `let'. `plet-if' is subject to optimization inside `defpun'.

Private

Undocumented

%%PLET/FAST (KERNEL FUTURE/FAST UPDATE-TASK-COUNT/NO-LOCK PREDICATE FUTURE-COUNT BINDINGS BODY)

%PLET/FAST (KERNEL FUTURE/FAST UPDATE-TASK-COUNT/NO-LOCK PREDICATE BINDINGS BODY)

ACCEPT-TASK-P (KERNEL)

CALL-IMPL-IN-WORKER (KERNEL)

DEFINE-DEFPUN (DEFPUN DOC DEFUN PLET/FAST PLET-IF/FAST CALL-IMPL &REST TYPES)

DEFINE-FUTURE/FAST (NAME UPDATE-TASK-COUNT)

DEFINE-PLET-IF/FAST (NAME FUTURE/FAST UPDATE-TASK-COUNT/NO-LOCK)

DEFINE-PLET/FAST (NAME FUTURE/FAST UPDATE-TASK-COUNT/NO-LOCK)

DEFINE-UPDATE-TASK-COUNT (NAME OP)

DEFINE-UPDATE-TASK-COUNT/NO-LOCK (NAME OP)

DEFUN/WRAPPER (WRAPPER-NAME IMPL-NAME PARAMS &BODY BODY)

FUTURE (KERNEL &BODY BODY)

FUTURE-FN (FUTURE)

FUTURE-LET (&KEY KERNEL FUTURE FORCE BINDINGS PRE-BODY BODY)

FUTURE/FAST (KERNEL &BODY BODY)

FUTURE/FAST/-1 (KERNEL &BODY BODY)

MAKE-TASK-FN (&BODY BODY)

PLET-IF/FAST (KERNEL PREDICATE BINDINGS &BODY BODY)

PLET-IF/FAST/-1 (KERNEL PREDICATE BINDINGS &BODY BODY)

PLET/FAST (KERNEL BINDINGS &BODY BODY)

PLET/FAST/-1 (KERNEL BINDINGS &BODY BODY)

RESULT (FUTURE)

TASK-COUNTER (KERNEL)

WITH-LOCK-PREDICATE/WAIT* (&KEY LOCK PREDICATE1 PREDICATE2 SUCCEED/LOCK SUCCEED/NO-LOCK FAIL)

WITH-OPTIMIZER-SLOTS (SLOTS INSTANCE &BODY BODY)

WITH-PARSED-LET-ARGS ((PAIRS NON-PAIRS SYMS) BINDINGS &BODY BODY)

WITH-SPIN-LOCK-HELD (((ACCESS CONTAINER)) &BODY BODY)

WITH-TASK-COUNTER-SLOTS (SLOTS TASK-COUNTER &BODY BODY)

VARIABLE

Private

*KERNEL*

The current kernel, or nil.

*MAKE-OPTIMIZER-DATA*

A function that creates the optimizer-data instance.

*WORKER*

The worker instance if inside a worker thread, otherwise nil.

Undocumented

*REGISTERED-NAMES*

CLASS

Private

KERNEL

The kernel encompasses the scheduling and execution of parallel tasks using a pool of worker threads. All parallelism in lparallel is done on top of the kernel.

Undocumented

TASK-COUNTER (KERNEL)

CONSTANT

Private

Undocumented

+CHECKED-KEY+

+NO-RESULT+

+UNCHECKED-KEY+