anchor.diff:           (time 0)
            (flo 0))
       (with-cuda-context (dev-id)
  -      (with-cuda-memory-blocks ((f (* nx ny 4))
  -                                (fn (* nx ny 4)))
  +      (with-memory-blocks ((f 'float (* nx ny))
  +                           (fn 'float (* nx ny)))
           (initialize-device-memory nx ny dx dy f)
           (start-timer)
           (dotimes (i 20000)
             (when (= (mod i 100) 0)
               (print-time i time))
  -          (when (= (mod i nout) 0)
  -            (output-pnm dir i nout nx ny f))
  +          ;(when (= (mod i nout) 0)
  +          ;  (output-pnm dir i nout nx ny f))
             (incf flo (diffusion2d nx ny f fn kappa dt dx dy))
             (incf time dt)
             (swap f fn))
           (print-time 20000 time)
  -        (output-pnm dir 20000 nout nx ny f)
  +        ;(output-pnm dir 20000 nout nx ny f)
           (print-elapsed-time)
           (print-performance flo)
           (stop-timer))))
  
positive.code:                           (* c1 (+ fcn fcs))
                            (* c2 fcc))))))
  
  (defun initialize-device-memory (nx ny dx dy fd)
    (cffi:with-foreign-object (fh :float (* nx ny))
      (let ((alpha 30.0))
        (dotimes (jy ny)
          (dotimes (jx nx)
            (let ((j (index nx jx jy))
                  (x (- (* dx (+ (float jx 1.0) 0.5)) 0.5))
                  (y (- (* dy (+ (float jy 1.0) 0.5)) 0.5)))
              (setf (cffi:mem-aref fh :float j)
                    (exp (* (- alpha)
                            (+ (* x x) (* y y)))))))))
      (cu-memcpy-host-to-device (cffi:mem-ref fd 'cu-device-ptr) fh (* nx ny 4))))
  
  (defvar +block-dim-x+ 256)
  (defvar +block-dim-y+ 1)
  
negative.code:   (the fixnum (+ (the fixnum (* nx jy)) jx)))
  
  (defun image-value (f i j nx fmax fmin)
    (let ((fc (mem-aref f (index nx i j))))
      (truncate (* 256.0
                   (/ (- fc fmin) (- fmax fmin))))))
  
  