Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro test1 (name)
- `(defkernel ,name (void ((a float*) (b float*) (c float*) (n int)))
- (let ((i (+ (* block-dim-x block-idx-x) thread-idx-x)))
- (if (< i n)
- (set (aref c i)
- (cos (* (aref a i) (aref b i))))))))
- (defmacro test2 (name)
- (with-gensyms (a b c n i)
- `(defkernel ,name (void ((,a float*) (,b float*) (,c float*) (,n int)))
- (let ((,i (+ (* block-dim-x block-idx-x) thread-idx-x)))
- (if (< ,i ,n)
- (set (aref ,c ,i)
- (cos (* (aref ,a ,i) (aref ,b ,i)))))))))
- (test1 totoro)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement