Skip to content

Instantly share code, notes, and snippets.

@dkvasnicka
Last active December 19, 2015 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkvasnicka/5908493 to your computer and use it in GitHub Desktop.
Save dkvasnicka/5908493 to your computer and use it in GitHub Desktop.
Dot product. Run using https://github.com/eholk/harlan
(module
(extern nanotime () -> u64)
(define (main)
(let ((v1 (iota 1000)) (v2 (iota 1000)))
(let ((start (nanotime))
(result
(reduce +
(kernel ((x v1) (y v2))
(* x y)))))
(print (/ (- (nanotime) start) 1000))
(print " | ")
(print result)))
(return 0)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment