anchor.diff:          (delta-time 0.016)
           (damping 1.0)
           (p 256))
  -    (with-cuda-context (dev-id)
  -      (with-memory-blocks ((new-pos 'float4 num-bodies)
  -                           (old-pos 'float4 num-bodies)
  -                           (vel 'float4 num-bodies))
  -        (reset old-pos vel cluster-scale velocity-scale num-bodies)
  -        (memcpy-host-to-device old-pos vel)
  -        (let ((window (make-instance 'nbody-window)))
  -          (setf (slot-value window 'new-pos) new-pos)
  -          (setf (slot-value window 'old-pos) old-pos)
  -          (setf (slot-value window 'vel) vel)
  -          (setf (slot-value window 'delta-time) delta-time)
  -          (setf (slot-value window 'damping) damping)
  -          (setf (slot-value window 'num-bodies) num-bodies)
  -          (setf (slot-value window 'p) p)
  -          (glut:display-window window))))))
  +      (with-cuda-context (dev-id)
  +        (cffi:with-foreign-objects ((start-event 'cu-event)
  +                                    (stop-event 'cu-event))
  +          (cu-event-create start-event cu-event-default)
  +          (cu-event-create stop-event cu-event-default)
  +          (with-memory-blocks ((new-pos 'float4 num-bodies)
  +                               (old-pos 'float4 num-bodies)
  +                               (vel 'float4 num-bodies))
  +            (reset old-pos vel cluster-scale velocity-scale num-bodies)
  +            (memcpy-host-to-device old-pos vel)
  +            (let ((window (make-instance 'nbody-window)))
  +              (setf (slot-value window 'new-pos) new-pos)
  +              (setf (slot-value window 'old-pos) old-pos)
  +              (setf (slot-value window 'vel) vel)
  +              (setf (slot-value window 'delta-time) delta-time)
  +              (setf (slot-value window 'damping) damping)
  +              (setf (slot-value window 'num-bodies) num-bodies)
  +              (setf (slot-value window 'p) p)
  +              (setf (slot-value window 'start-event) start-event)
  +              (setf (slot-value window 'stop-event) stop-event)
  +              (cu-event-record (cffi:mem-ref start-event 'cu-event)
  +                               (cffi:null-pointer))
  +              (glut:display-window window)))))))
  
positive.code:       (let ((p (mem-aref old-pos i)))
          (gl:vertex (float4-x p) (float4-y p) (float4-z p)))))
    (gl:end)
    (glut:swap-buffers))
  
  (defmethod glut:reshape ((w nbody-window) width height)
    (gl:matrix-mode :projection)
  
negative.code:    (delta-time :initform 0)
     (damping :initform 0)
     (num-bodies :initform 0)
     (p :initform 0)
     (start-event :initform nil)
     (stop-event :initform nil))
    (:default-initargs :width 640 :height 480 :pos-x 100 :pos-y 100
                       :mode '(:double :rgb) :title "nbody"))
  
  