pmap_test2   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/core/xthread.xtm

Implementation

(bind-func pmap_test2
  (lambda (arr:i64* size:i64 num_procs:i64)
    (let ((subs (/ size num_procs)))
      (foldl (lambda (a:i64 b) (+ a b)) 0
             (pmap (lambda (xs:i64*) (vsum xs subs))
                   (map (lambda (idx) (pref-ptr arr idx))
                        (range 0 size subs)))))))


Back to Index

Similar Entries