Common Lisp Package: LPARALLEL.PTREE

A ptree is a computation represented by a tree together with functionality to execute the tree in parallel.

README:

FUNCTION

Public

CALL-PTREE (ID PTREE)

Return the computation result of the node with identifier `id' in `ptree'. If the node is uncomputed, compute the result. If the node is already computed, return the computed result.

CHECK-PTREE (PTREE)

Verify that all nodes have been defined with an associated function. If not, `ptree-undefined-function-error' is signaled.

CLEAR-PTREE (PTREE)

Clear all node results in `ptree', restoring the tree to its uncomputed state.

CLEAR-PTREE-ERRORS (PTREE)

Clear all error results in `ptree', allowing the computation to resume from its latest pre-error state.

MAKE-PTREE

Create a ptree instance.

PTREE-COMPUTED-P (ID PTREE)

Return true if the node with identifier `id' in `ptree' has finished computing, otherwise return false.

PTREE-FN (ID ARGS FUNCTION PTREE)

Define a ptree node with identifier `id', which is some unique object suitable for `eql' comparison such as symbol. The ids of its child nodes are elements of the list `args'. `function' is the function associated with this node. The arguments passed to `function' are the respective results of the child node computations. `ptree' is the ptree instance in which the node is being defined.

Private

%%%%.NODE.CHILDREN (INSTANCE)

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

%%%%.NODE.CHILDREN-DONE-P (INSTANCE)

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

%%%%.NODE.FUNCTION (INSTANCE)

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

%%%%.NODE.ID (INSTANCE)

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

%%%%.NODE.LOCK-LEVEL (INSTANCE)

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

%%%%.NODE.PARENTS (INSTANCE)

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

%%%%.NODE.RESULT (INSTANCE)

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

%%%%.PTREE.LOCK (INSTANCE)

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

%%%%.PTREE.NODES (INSTANCE)

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

%%%%.PTREE.PENDING (INSTANCE)

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

%%%%.PTREE.QUEUE (INSTANCE)

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

ID (INSTANCE)

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

LOCK (INSTANCE)

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

LOCK-LEVEL (INSTANCE)

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

NODES (INSTANCE)

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

RESULT (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

SETF%%%%.NODE.CHILDREN (NEW-VALUE INSTANCE)

SETF%%%%.NODE.CHILDREN-DONE-P (NEW-VALUE INSTANCE)

SETF%%%%.NODE.FUNCTION (NEW-VALUE INSTANCE)

SETF%%%%.NODE.ID (NEW-VALUE INSTANCE)

SETF%%%%.NODE.LOCK-LEVEL (NEW-VALUE INSTANCE)

SETF%%%%.NODE.PARENTS (NEW-VALUE INSTANCE)

SETF%%%%.NODE.RESULT (NEW-VALUE INSTANCE)

SETF%%%%.PTREE.LOCK (NEW-VALUE INSTANCE)

SETF%%%%.PTREE.NODES (NEW-VALUE INSTANCE)

SETF%%%%.PTREE.PENDING (NEW-VALUE INSTANCE)

SETF%%%%.PTREE.QUEUE (NEW-VALUE INSTANCE)

CHECK-NODE (NODE)

CHILDREN-DONE-P

CLEAR-NODE (NODE)

CLEAR-NODE-ERROR (NODE)

COMPUTE-NODE (NODE)

COMPUTE-PTREE (ROOT PTREE KERNEL)

COMPUTEDP

COPY-NODE (INSTANCE)

COPY-PTREE (INSTANCE)

EACH-NODE (PTREE FN)

FIND-NODE

FREEP

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

LOCK-NODE

MAKE-NODE-INSTANCE (&KEY ((ID DUM65) (ERROR slot ~a in ~a not initialized 'ID 'NODE)) ((FUNCTION DUM66) NIL) ((CHILDREN DUM67) NIL) ((PARENTS DUM68) NIL) ((LOCK-LEVEL DUM69) 0) ((CHILDREN-DONE-P DUM70) NIL) ((RESULT DUM71) +NO-RESULT+))

MAKE-NODE-TASK (QUEUE NODE)

MAKE-PTREE-INSTANCE (&KEY ((NODES DUM408) (MAKE-HASH-TABLE TEST #'EQL)) ((QUEUE DUM409) (MAKE-QUEUE)) ((PENDING DUM410) 0) ((LOCK DUM411) (MAKE-LOCK)))

MAKE-TASK

NODE-P (OBJECT)

PROPAGATE-ERROR

PTREE-P (OBJECT)

SUBMIT-NODE (NODE QUEUE KERNEL)

SUBMIT-RAW-TASK (TASK KERNEL)

UNLOCK-NODE

WAIT-FOR-COMPUTE (PTREE)

MACRO

Public

PTREE (DEFS &BODY BODY)

Create a ptree using `flet' syntax. ptree ((node-name child-names function-body)*) form* Each `node-name' form corresponds to the definition of a ptree node. `node-name' is the name of the node being defined (a symbol). `child-names' is a list of the names of child nodes (symbols). The function associated with the node being defined is `(lambda ,child-names ,@function-body) `child-names' cannot contain lambda list keywords. For each `node-name', a symbol macro is defined which expands to a `call-ptree' form for that node.

Private

Undocumented

MAKE-TASK-FN (&BODY BODY)

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

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

WITH-TASK-CONTEXT (&BODY BODY)

GENERIC-FUNCTION

Private

Undocumented

PTREE-ERROR-ID (CONDITION)

PTREE-ERROR-KEYWORD (CONDITION)

PTREE-ERROR-REFS (CONDITION)

VARIABLE

Public

*PTREE-NODE-KERNEL*

When non-nil, `*kernel*' is bound to this value during the call of a node function.

CLASS

Public

PTREE (DEFS &BODY BODY)

A ptree is a computation represented by a tree together with functionality to execute the tree in parallel.

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.

WRAPPED-ERROR

This is a container for transferring an error that occurs inside `call-with-task-handler' to the calling thread.

Undocumented

NODE

CONDITION

Public

PTREE-LAMBDA-LIST-KEYWORD-ERROR

Lambda list keywords found in function definition.

PTREE-REDEFINITION-ERROR

Attempted to redefine a node's function.

PTREE-UNDEFINED-FUNCTION-ERROR

Attempted to execute a node which had no function.

Private

Undocumented

PTREE-ERROR

CONSTANT

Private

Undocumented

+NO-RESULT+