```common lisp
#|
  This file is a part of cl-cuda project.
  Copyright (c) 2012 Masayuki Takagi (kamonama@gmail.com)
|#

(in-package :cl-user)
(defpackage cl-cuda-examples.defglobal
  (:use :cl :cl-cuda)
  (:export :main))
(in-package :cl-cuda-examples.defglobal)

(setf cl-cuda:*show-messages* nil)


;;
;; Globals

(defglobal foo int)

(defglobal bar int)


;;
;; Kernel function

(defkernel add-globals (void ((out int*)))
  (set (aref out 0) (+ foo bar)))


;;
;; Main

(defun main ()
  (let ((dev-id 0))
    (with-cuda (dev-id)
      ;; First, set values to globals.
      (setf (global-ref 'foo) 1)
      (setf (global-ref 'bar) 2)
      ;; Second, launch kernel function and get sum of globals.
      (with-memory-blocks ((out 'int 1))
        ;; Launch ADD-GLOBALS kernel function.
        (add-globals out :grid-dim '(1 1 1) :block-dim '(1 1 1))
        ;; Synchronize memory block.
        (sync-memory-block out :device-to-host)
        ;; Output result.
        (format t "Got ~A from adding two globals.~%"
                (memory-block-aref out 0))))))
```

Add qualifiers to DEFGLOBAL example.
user
```common lisp
#|
  This file is a part of cl-cuda project.
  Copyright (c) 2012 Masayuki Takagi (kamonama@gmail.com)
|#

(in-package :cl-user)
(defpackage cl-cuda-examples.defglobal
  (:use :cl :cl-cuda)
  (:export :main))
(in-package :cl-cuda-examples.defglobal)

(setf cl-cuda:*show-messages* nil)


;;
;; Globals

(defglobal foo int)

(defglobal bar int 0 :constant)


;;
;; Kernel function

(defkernel add-globals (void ((out int*)))
  (set (aref out 0) (+ foo bar)))


;;
;; Main

(defun main ()
  (let ((dev-id 0))
    (with-cuda (dev-id)
      ;; First, set values to globals.
      (setf (global-ref 'foo) 1)
      (setf (global-ref 'bar) 2)
      ;; Second, launch kernel function and get sum of globals.
      (with-memory-blocks ((out 'int 1))
        ;; Launch ADD-GLOBALS kernel function.
        (add-globals out :grid-dim '(1 1 1) :block-dim '(1 1 1))
        ;; Synchronize memory block.
        (sync-memory-block out :device-to-host)
        ;; Output result.
        (format t "Got ~A from adding two globals.~%"
                (memory-block-aref out 0))))))
```
assistant