Advertisement
Guest User

Untitled

a guest
May 3rd, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. (defmacro test1 (name)
  2. `(defkernel ,name (void ((a float*) (b float*) (c float*) (n int)))
  3. (let ((i (+ (* block-dim-x block-idx-x) thread-idx-x)))
  4. (if (< i n)
  5. (set (aref c i)
  6. (cos (* (aref a i) (aref b i))))))))
  7.  
  8. (defmacro test2 (name)
  9. (with-gensyms (a b c n i)
  10. `(defkernel ,name (void ((,a float*) (,b float*) (,c float*) (,n int)))
  11. (let ((,i (+ (* block-dim-x block-idx-x) thread-idx-x)))
  12. (if (< ,i ,n)
  13. (set (aref ,c ,i)
  14. (cos (* (aref ,a ,i) (aref ,b ,i)))))))))
  15.  
  16. (test1 totoro)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement