initialize_walkers   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/mpi/random-walk.xtm

Implementation

(bind-func initialize_walkers
  (lambda (num_walkers_per_proc:i32
      max_walk_size:i32
      region:DomainRegion*)
    (let ((wa (create_walker_array (* num_walkers_per_proc 4))) ;; is 4x oversized buffers enough?
          (walkers (tref wa 1)))
      (doloop (i num_walkers_per_proc)
        (tset! (walker_at_index wa i) 0 (tref region 0))
        (tset! (walker_at_index wa i) 1 (random max_walk_size)))
      (tset! wa 0 num_walkers_per_proc)
      wa)))


Back to Index

Similar Entries