anchor.diff:        (set (aref new-pos index) position)
         (set (aref vel index) velocity))))
   
  -(defun integrate-nbody-system (new-pos old-pos vel delta-time damping num-bodies p)
  -  (let ((grid-dim (list (ceiling (/ num-bodies p)) 1 1))
  +(defun integrate-nbody-system-gpu (new-pos old-pos vel delta-time damping num-bodies p)
  +  (let ((grid-dim  (list (ceiling (/ num-bodies p)) 1 1))
           (block-dim (list p 1 1)))
  -    (integrate-bodies new-pos old-pos vel delta-time damping num-bodies
  +    (integrate-bodies (raw-array new-pos) (raw-array old-pos) (raw-array vel)
  +                      delta-time damping num-bodies
                         :grid-dim grid-dim
                         :block-dim block-dim)))
   
  +(defun body-body-interaction-cpu (x1 y1 z1 x2 y2 z2)
  +  (declare (optimize (speed 3) (safety 0)))
  +  (declare (type single-float x1 y1 z1 x2 y2 z2))
  +  (let* ((rx                (- x2 x1))
  +         (ry                (- y2 y1))
  +         (rz                (- z2 z1))
  +         (softening-squared (* 0.1 0.1))
  +         (dist-sqr          (+ (* rx rx) (* ry ry) (* rz rz)
  +                               softening-squared))
  +         (inv-dist          (/ 1.0 (sqrt dist-sqr)))
  +         (inv-dist-cube     (* inv-dist inv-dist inv-dist))
  +         (w                 1.0)
  +         (s                 (* w inv-dist-cube)))
  +    (values (* rx s) (* ry s) (* rz s))))
  +
  +(defun integrate-bodies-cpu (new-pos old-pos vel delta-time damping total-num-bodies)
  +  (declare (optimize (speed 3) (safety 0)))
  +  (declare (type fixnum total-num-bodies)
  +           (type single-float delta-time damping)
  +           (type vec3-array new-pos old-pos vel))
  +  (dotimes (i total-num-bodies)
  +    (with-vec3-array-values ((x1 y1 z1) (old-pos i))
  +      (dotimes (j total-num-bodies)
  +        (with-vec3-array-values ((x2 y2 z2) (old-pos j))
  +          (when (/= i j)
  +            (multiple-value-bind (ax ay az) (body-body-interaction-cpu x1 y1 z1 x2 y2 z2)
  +              (declare (type single-float ax ay az))
  +              (let ((k (* delta-time damping)))
  +                (with-vec3-array-values ((vx vy vz) (vel i))
  +                  (set-vec3-array (vel i) (+ vx (* ax k))
  +                                          (+ vy (* ay k))
  +                                          (+ vz (* az k)))))))))
  +      (with-vec3-array-values ((vx vy vz) (vel i))
  +        (set-vec3-array (new-pos i) (+ x1 (* vx delta-time))
  +                                    (+ y1 (* vy delta-time))
  +                                    (+ z1 (* vz delta-time)))))))
  +
  +(defun integrate-nbody-system-cpu (new-pos old-pos vel delta-time damping num-bodies)
  +  (integrate-bodies-cpu (raw-array new-pos) (raw-array old-pos) (raw-array vel)
  +                        delta-time damping num-bodies))
  +
   
   ;;;
   ;;; cl-glut window subclass
   ;;;
   
  -(defclass nbody-window (glut:window) ()
  +(defclass nbody-window (glut:window)
  +  ((nbody-demo :initarg :nbody-demo)
  +   (counter    :initarg :counter))
     (:default-initargs :width 640 :height 480 :pos-x 100 :pos-y 100
                        :mode '(:double :rgb) :title "nbody"))
   
  
positive.code: 
  
  ;;;
  ;;; NBody
  ;;;
  
  (defun unlines (&rest string-list)
  
negative.code:         (syncthreads))
        (return acc))))
  
  (defkernel compute-body-accel-without-shared-memory (float3 ((body-pos float4) (positions float4*) (num-bodies cl-cuda:int)))
    (let ((acc (float3 0.0 0.0 0.0)))
      (do ((i 0 (+ i 1)))
          ((>= i num-bodies))
  