takagi/cl-cuda

Simple Example not working

JacobGood1 opened this issue · 7 comments

After trying the code on the main page...

(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)))))

I got this error

nvcc exits with code: 127
/usr/bin/env: nvcc: No such file or directory
[Condition of type SIMPLE-ERROR]

Please confirm that you installed CUDA SDK and path to nvcc compiler is set to environment variable.

If you have already done, please let me know.

On 2015/06/07, at 5:48, JacobGood1 notifications@github.com wrote:

After trying the code on the main page...

(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)))))

I got this error

nvcc exits with code: 127
/usr/bin/env: nvcc: No such file or directory
[Condition of type SIMPLE-ERROR]


Reply to this email directly or view it on GitHub.

Yes, I believe that I have done those things correctly... here is some more information

Invoking CU-INIT succeded.
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-ALLOC succeded.

All of these succeed but it blows up at random-init saying...

The function COMMON-LISP-USER::RANDOM-INIT is undefined.

When I take out random init it blows up at add kernel with the previous message. Thanks for the help

Ok. RANDOM-INIT function is defined in examples/vector-add.lisp. You can use nvcc-binary special variable to tell cl-cuda where nvcc is. Please check them out and if you would have the troubles yet, let me know again.

On 2015/06/07, at 12:09, JacobGood1 notifications@github.com wrote:

Yes, I believe that I have done those things correctly... here is some more information

Invoking CU-INIT succeded.
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-ALLOC succeded.

All of these succeed but it blows up at random-init saying...

The function COMMON-LISP-USER::RANDOM-INIT is undefined.

When I take out random init it blows up at add kernel with the previous message. Thanks for the help


Reply to this email directly or view it on GitHub.

Everything works now thanks!

Good.

I can confirm the issue, as well as the solution by adding

(setf nvcc-binary "/usr/local/cuda-8.0/bin/nvcc")

to the example code.

@Disclosure
I guess putting /usr/local/cuda-8.0/bin in PATH environment variable is a better way to solve this