Closed anquegi closed 8 years ago
Hi thanks for this nice library, I load it but trying the example in REPL
CL-USER> (in-package :cl-user) (defpackage cl-cuda-examples.vector-add (:use :cl :cl-cuda) (:export :main)) (in-package :cl-cuda-examples.vector-add) #<PACKAGE "CL-CUDA-EXAMPLES.VECTOR-ADD"> VECTOR-ADD> (defun random-init (data n) (dotimes (i n) (setf (memory-block-aref data i) (random 1.0)))) WARNING: redefining CL-CUDA-EXAMPLES.VECTOR-ADD::RANDOM-INIT in DEFUN RANDOM-INIT VECTOR-ADD> (defun verify-result (as bs cs n) (dotimes (i n) (let ((a (memory-block-aref as i)) (b (memory-block-aref bs i)) (c (memory-block-aref cs i))) (let ((sum (+ a b))) (when (> (abs (- c sum)) 1.0) (error (format nil "verification fault, i:~A a:~A b:~A c:~A" i a b c)))))) (format t "verification succeed.~%")) WARNING: redefining CL-CUDA-EXAMPLES.VECTOR-ADD::VERIFY-RESULT in DEFUN VERIFY-RESULT VECTOR-ADD> (defkernel vec-add-kernel (void ((a float*) (b float*) (c float*) (n int))) (let ((i (+ (* block-dim-x block-idx-x) thread-idx-x))) (if (< i n) (set (aref c i) (+ (aref a i) (aref b i)))))) WARNING: redefining CL-CUDA-EXAMPLES.VECTOR-ADD::VEC-ADD-KERNEL in DEFUN VEC-ADD-KERNEL VECTOR-ADD> (defun main () (let* ((dev-id 0) (n 1024) (threads-per-block 256) (blocks-per-grid (/ n threads-per-block))) (with-cuda (dev-id) (with-memory-blocks ((a 'float n) (b 'float n) (c 'float n)) (random-init a n) (random-init b n) (sync-memory-block a :host-to-device) (sync-memory-block b :host-to-device) (vec-add-kernel a b c n :grid-dim (list blocks-per-grid 1 1) :block-dim (list threads-per-block 1 1)) (sync-memory-block c :device-to-host) (verify-result a b c n))))) WARNING: redefining CL-CUDA-EXAMPLES.VECTOR-ADD:MAIN in DEFUN MAIN VECTOR-ADD> (main)
I always get:
CU-INIT failed with driver API error No. 3. CUDA_ERROR_NOT_INITIALIZED [Condition of type SIMPLE-ERROR] Restarts: 0: [*ABORT] Return to SLIME's top level. 1: [ABORT] abort thread (#<THREAD "new-repl-thread" RUNNING {10079B1C43}>) Backtrace: 0: (CL-CUDA.DRIVER-API::CHECK-CUDA-ERROR CL-CUDA.DRIVER-API:CU-INIT 3) 1: (MAIN) 2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (MAIN) #<NULL-LEXENV>) 3: (EVAL (MAIN)) 4: (SWANK::%EVAL-REGION "(main) ..) 5: ((LAMBDA NIL :IN SWANK::%LISTENER-EVAL)) 6: (SWANK-REPL::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {1008A7784B}>) 7: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {1008A7782B}>) 8: (SWANK::%LISTENER-EVAL "(main) ..) 9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK-REPL:LISTENER-EVAL "(main) ..) 10: (EVAL (SWANK-REPL:LISTENER-EVAL "(main) ..) 11: (SWANK:EVAL-FOR-EMACS (SWANK-REPL:LISTENER-EVAL "(main) ..) 12: (SWANK::PROCESS-REQUESTS NIL) 13: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS)) 14: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS)) 15: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {10079B802B}>) 16: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/Users/toni/.roswell/lisp/quicklisp/dists/quicklisp/software/slime-v2.18/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL.. 17: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {1004E35F33}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {1004F0F153}>) (*TRACE-OUTPUT* . #2#) (*ERR.. 18: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1004209373}> NIL) 19: ((FLET #:WITHOUT-INTERRUPTS-BODY-1171 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE)) 20: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE)) 21: ((FLET #:WITHOUT-INTERRUPTS-BODY-359 :IN SB-THREAD::CALL-WITH-MUTEX)) 22: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {820BCEB}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD ".. 23: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "new-repl-thread" RUNNING {10079B1C43}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::SPAWN-REPL-THREAD) {10079B1BEB}> (#<SB-THREAD:THREAD.. 24: ("foreign function: call_into_lisp") 25: ("foreign function: new_thread_trampoline") 26: ("foreign function: _pthread_body") 27: ("foreign function: _pthread_body") 28: ("foreign function: thread_start")
forget it, my apologizes i have no nvidia on my mac, but i installed the drivers for CUDA without any error, but the I verify that i do not have NVIDIA
Hi thanks for this nice library, I load it but trying the example in REPL
I always get: