anchor.diff:    (let ((n (truncate (/ i nout))))
       (concatenate 'string dir (format nil "~4,'0D.pgm" n))))
   
  -(defun output-pnm (dir i nout nx ny fd)
  -  (cffi:with-foreign-object (fh :float (* nx ny))
  -    (cu-memcpy-device-to-host fh (cffi:mem-ref fd 'cu-device-ptr) (* nx ny 4))
  -    (let ((image (make-instance 'imago:grayscale-image
  -                                :width nx :height ny)))
  -      (dotimes (i nx)
  -        (dotimes (j ny)
  -          (setf (imago:image-pixel image i j) (image-value fh i j nx 1.0 0.0))))
  -      (imago:write-pnm image (file-name dir i nout) :ASCII)))
  +(defun output-pnm (dir i nout nx ny f)
  +  (let ((image (make-instance 'imago:grayscale-image
  +                              :width nx :height ny)))
  +    (dotimes (i nx)
  +      (dotimes (j ny)
  +        (setf (imago:image-pixel image i j) (image-value f i j nx 1.0 0.0))))
  +    (imago:write-pnm image (file-name dir i nout) :ASCII))
     (values))
   
   
  
positive.code:   (the fixnum (+ (the fixnum (* nx jy)) jx)))
  
  (defun image-value (f i j nx fmax fmin)
    (let ((fc (cffi:mem-aref f :float (index nx i j))))
      (truncate (* 256.0
                   (/ (- fc fmin) (- fmax fmin))))))
  
  
negative.code:          (time 0)
           (flo 0))
      (with-cuda-context (dev-id)
        (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))
            (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)
          (print-elapsed-time)
          (print-performance flo)
          (stop-timer))))
  