/[gcl]/gcl/pargcl/doc/MANUAL
ViewVC logotype

Diff of /gcl/pargcl/doc/MANUAL

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by gene, Sat Nov 5 09:46:04 2005 UTC revision 1.5 by gene, Sun Nov 6 09:35:25 2005 UTC
# Line 25  Most people will want to begin with the Line 25  Most people will want to begin with the
25  Note that (help 'COMMAND) works for most commands.  Note that (help 'COMMAND) works for most commands.
26  There are example parallel programs in pargcl/examples/.  There are example parallel programs in pargcl/examples/.
27  Here is a sample usage of some simple commands:  Here is a sample usage of some simple commands:
28      (send-receive-message '(1+ 5)) ; send message, recv answer (default: slave 1)
29    (send-message '(+ 3 4) 2)  ; send to slave 2 for evaluation    (send-message '(+ 3 4) 2)  ; send to slave 2 for evaluation
30    (send-message "(+ 5 6)" 1) ; send to slave 1 for evaluation    (send-message "(+ 5 6)" 1) ; send to slave 1 for evaluation
31    (send-message "(+ 7 8)" 1) ; send to slave 1 for evaluation    (send-message "(+ 7 8)" 1) ; send to slave 1 for evaluation
# Line 37  Here is a sample usage of some simple co Line 38  Here is a sample usage of some simple co
38    (par-eval '(defun myfnc (x) (sqrt x)))    (par-eval '(defun myfnc (x) (sqrt x)))
39    (send-message '(dotimes (i 1000000000) (myfnc i)) 1)    (send-message '(dotimes (i 1000000000) (myfnc i)) 1)
40    (par-reset) ; useful if slave not responding.    (par-reset) ; useful if slave not responding.
41    (par-load "/home/joe/myfile.lsp") ; Load file on all processors    (par-load "/home/joe/myfile.lsp") ; Load same file in all processes
42    (defun par-mapcar (fnc list &aux (i -1) result)    (defun par-mapcar (fnc list &aux (i -1) result)
43      (par-funcall #'par-mapcar-helper fnc list))      (par-funcall #'par-mapcar-helper fnc list))
44    (defun par-mapcar-helper (fnc list &aux (i -1) result)    (defun par-mapcar-helper (fnc list &aux (i -1) result)
# Line 52  Here is a sample usage of some simple co Line 53  Here is a sample usage of some simple co
53        :trace t)        :trace t)
54      (if (master-p) (coerce result 'list) nil)      (if (master-p) (coerce result 'list) nil)
55    )    )
56    ;; Note 'sqrt below.  #'sqrt couldn't be passed across network.    (par-mapcar #'sqrt '(1 2 3 4 5 6 7 8 9 10))
   (par-mapcar 'sqrt '(1 2 3 4 5 6 7 8 9 10))  
57    (help '*master-slave-time*)    (help '*master-slave-time*)
58    *master-slave-time*    *master-slave-time*
59    (send-receive-message '*master-slave-time*) ; time spent on slave 1    (send-receive-message '*master-slave-time*) ; time spent on slave 1
60    
61    ;; The definition of par-mapcar above demonstrates an easy way to
62    ;;  generate master-worker parallelism.
63          ;; In :generate-task-input, Variable i is the next task input;
64          ;;   this is generated on master
65          ;; In :do-task, task is to call fnc on (nth i list);
66          ;;   Note that the argument "list" is shared on all processes
67          ;;   The task is then executed on the next available slave
68          ;; In :check-task-result, the master, gets a pair: (i, task-out),
69          ;;   where task-out is (funcall fnc (nth i list))
70          ;;   Here, we return 'NO-ACTION, but more general patterns are also
71          ;;   possible.  See "Overview" in
72          ;;   http://www.ccs.neu.edu/home/gene/topc.html  for other patterns.
73    
74    ;;;;USAGE:
75  ;;;; A remote process is set up for each one specified in your procgroup file.  ;;;; A remote process is set up for each one specified in your procgroup file.
76  ;;;; Available commands:  ;;;; Available commands:
77  ;;;; (send-message <lisp-expr> <optional dest = 1>)  ;;;; (send-message <lisp-expr> <optional dest = 1>)

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26