-
Notifications
You must be signed in to change notification settings - Fork 24
/
cl-cuda.asd
98 lines (92 loc) · 4.28 KB
/
cl-cuda.asd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#|
This file is a part of cl-cuda project.
Copyright (c) 2012 Masayuki Takagi ([email protected])
|#
(defpackage :cl-cuda-asd
(:use :cl :asdf :uiop))
(in-package :cl-cuda-asd)
(load-system "cffi-grovel")
;;; These are the remnants of the previous solution for only groveling
;;; files when the cuda sdk is found. Unfortunately, since no output
;;; files were produced, all compononents that depended on the grovel
;;; file were always recompiled. So, this half solution is left around
;;; only to maintain backward compatibility with other systems that
;;; may use CUDA-GROVEL-FILE.
(defclass cuda-grovel-file (cffi-grovel:grovel-file) ())
(defmethod asdf:perform :around ((o operation) (c cuda-grovel-file))
;; Compile a grovel file only when CUDA SDK is found.
(let ((sdk-not-found (symbol-value (intern "*SDK-NOT-FOUND*"
"CL-CUDA.DRIVER-API"))))
(if sdk-not-found
(asdf::mark-operation-done o c)
(call-next-method))))
;;; What we do instead is to test for the cuda sdk here, and use
;;; IF-FEATURE in the asdf system.
(cffi:define-foreign-library libcuda
(:darwin (:framework "CUDA"))
(:unix (:or "libcuda.so" "libcuda64.so")))
(unless (member :cuda-sdk *features*)
(handler-case (progn
(cffi:use-foreign-library libcuda)
(pushnew :cuda-sdk *features*))
(cffi:load-foreign-library-error (e)
(princ e *error-output*)
(terpri *error-output*))))
;;;
;;; Cl-cuda system definition
;;;
(defsystem "cl-cuda"
:version "0.1"
:author "Masayuki Takagi"
:license "MIT"
:depends-on ("cffi" "alexandria" "external-program" "osicat"
"cl-pattern" "split-sequence" "cl-reexport" "cl-ppcre")
:components ((:module "src"
:serial t
:components
((:module "driver-api"
:serial t
:components
((:file "package")
(:file "get-error-string")
(:file "cffi-grovel")
(:file "sdk-not-found")
(:file "library")
(:file "type")
(cffi-grovel:grovel-file
"type-grovel"
:if-feature :cuda-sdk)
(:file "enum")
(:file "function")))
(:module "lang"
:serial t
:components
((:file "util")
(:file "data")
(:file "type")
(:file "syntax")
(:file "environment")
(:file "built-in")
(:file "kernel")
(:file "compiler/compile-data")
(:file "compiler/compile-type")
(:file "compiler/type-of-expression")
(:file "compiler/compile-expression")
(:file "compiler/compile-statement")
(:file "compiler/compile-kernel")
(:file "lang")))
(:module "api"
:serial t
:components
((:file "nvcc")
(:file "kernel-manager")
(:file "memory")
(:file "context")
(:file "defkernel")
(:file "macro")
(:file "timer")
(:file "api")))
(:file "cl-cuda"))))
:description "Cl-cuda is a library to use NVIDIA CUDA in Common Lisp programs."
:long-description #.(read-file-string (subpathname *load-pathname* "README.markdown"))
:in-order-to ((test-op (test-op "cl-cuda-test"))))