Coverage report: /home/ellis/comp/core/ffi/cuda/cuda.lisp
Kind | Covered | All | % |
expression | 0 | 37 | 0.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; cuda.lisp --- CUDA API
9
(defvar *cuda-context*)
11
(defun device-compute-capability (dev-id)
12
(with-alien ((maj int)
14
(cu-device-compute-capability (addr maj) (addr min) dev-id)
17
(defun get-nvcc-arch (dev-id)
18
(multiple-value-bind (maj min) (device-compute-capability dev-id)
19
(format nil "-arch=sm_~D~D" maj min)))
21
(defun get-cuda-device (dev-id)
22
(with-alien ((dev cu-device))
23
(cu-device-get (addr dev) dev-id)
26
(defun create-cuda-context (dev)
27
(with-alien ((ctx cu-context))
28
(cu-ctx-create (addr ctx) 0 dev)
31
(defmacro with-cuda (dev-id &body body)
34
(let* ((*cuda-device* (get-cuda-device ,dev-id))
35
(*cuda-context* (create-cuda-context *cuda-device*)))
36
(unwind-protect (progn ,@body)
37
(cu-ctx-destroy *cuda-context*)))))
39
(defvar *cuda-stream* nil)