cl-cuda
cl-cuda copied to clipboard
Working with a global context
Hi! New to both cuda and cl-cuda. I was looking for a way to avoid with-cuda
; what I'm puzzled with is that the following works at the REPL, but doesn't work with C-x C-e
in SLIME (at least not until it is run at least once at the REPL):
(init-cuda)
(setq *cuda-device* (get-cuda-device 0)
*cuda-context* (create-cuda-context *cuda-device*)
*nvcc-options*
(if (cl-cuda.api.context::arch-exists-p *nvcc-options*)
*nvcc-options*
(cl-cuda.api.context::append-arch *nvcc-options* 0)))
(alloc-memory-block 'float 1)
The last statement yields the following error:
CU-MEM-ALLOC failed with driver API error No. 201.
CUDA_ERROR_INVALID_CONTEXT
[Condition of type SIMPLE-ERROR]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {100F7C1DD3}>)
Backtrace:
0: (CL-CUDA.DRIVER-API::CHECK-CUDA-ERROR CL-CUDA.DRIVER-API:CU-MEM-ALLOC 201)
1: (ALLOC-DEVICE-MEMORY FLOAT 1)
2: (ALLOC-MEMORY-BLOCK FLOAT 1)
Any reason why this happens?