Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors running tests on Windows #77

Closed
serialhex opened this issue Jul 19, 2016 · 9 comments
Closed

Errors running tests on Windows #77

serialhex opened this issue Jul 19, 2016 · 9 comments

Comments

@serialhex
Copy link

Hi there, I've been trying to get cl-cuda working on my system, but it doesn't seem to work quite right. It took a bit, setting environment variables so that headers and libs would be picked up, but now that I've got it mostly working I get this when I run the tests:

CL-USER 13 > (ql:quickload :cl-cuda-test)
To load "cl-cuda-test":
  Load 1 ASDF system:
    cl-cuda-test
; Loading "cl-cuda-test"
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
....................................
mtest cuInit
Invoking CU-INIT succeded.
mtest cuDeviceGet
Invoking CU-DEVICE-GET succeded.
CUDA device handle: 0
mtest cuDeviceGetCount
Invoking CU-DEVICE-GET-COUNT succeded.
CUDA device count: 1
mtest cuDeviceComputeCapability
Invoking CU-DEVICE-GET succeded.
Invoking CU-DEVICE-COMPUTE-CAPABILITY succeded.
CUDA device compute capability: 3.0
mtest cuDeviceGetName
Invoking CU-DEVICE-GET succeded.
Invoking CU-DEVICE-GET-NAME succeded.
CUDA device name: Quadro K2000
mtest cuCtxCreate/cuCtxDestroy
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-CTX-DESTROY succeded.
mtest cuMemAlloc/cuMemFree
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-FREE succeded.
Invoking CU-CTX-DESTROY succeded.
mtest cuMemAlloc/cuMemFree using WITH-CU-CONTEXT macro
Invoking CU-INIT succeded.
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-FREE succeded.
Invoking CU-CTX-DESTROY succeded.
mtest cuMemcpyHtoD/cuMemcpyDtoH
Invoking CU-INIT succeded.
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-MEM-ALLOC succeded.

Error: CU-MEMCPY-HOST-TO-DEVICE failed with driver API error No. 1.
CUDA_ERROR_INVALID_VALUE
   1 (continue) Try loading C:\Users\538353-08\AppData\Local\cache\common-lisp\lw-6.1.1-win-x86\d\programmin\quicklisp\local-projects\cl-cuda\t\driver-api\driver-api.ofasl again.
   2 Give up loading C:\Users\538353-08\AppData\Local\cache\common-lisp\lw-6.1.1-win-x86\d\programmin\quicklisp\local-projects\cl-cuda\t\driver-api\driver-api.ofasl.
   3 Try loading another file instead of C:\Users\538353-08\AppData\Local\cache\common-lisp\lw-6.1.1-win-x86\d\programmin\quicklisp\local-projects\cl-cuda\t\driver-api\driver-api.ofasl.
   4 Recompile driver-api and try loading it again
   5 Retry loading FASL for
   #<ASDF/LISP-ACTION:CL-SOURCE-FILE "cl-cuda-test" "t" "driver-api" "driver-api">.
   6 Continue, treating .loading FASL for
   #<ASDF/LISP-ACTION:CL-SOURCE-FILE "cl-cuda-test" "t" "driver-api" "driver-api">
     as having been successful.
   7 Retry ASDF operation.
   8 Retry ASDF operation after resetting the configuration.
   9 (abort) Give up on "cl-cuda-test"
  10 Return to level 0.
  11 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-CUDA-TEST.DRIVER-API 14 : 1 >

Even when I try the vector-add example i get something similar:

CL-CUDA-EXAMPLES.VECTOR-ADD 29 > (main)
Invoking CU-INIT succeded.
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-DEVICE-COMPUTE-CAPABILITY succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-ALLOC succeded.

Error: CU-MEMCPY-HOST-TO-DEVICE failed with driver API error No. 1.
CUDA_ERROR_INVALID_VALUE
  1 (abort) Return to level 0.
  2 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-CUDA-EXAMPLES.VECTOR-ADD 30 : 1 >

I am able to write kernels & have them run on my local GPU in C, but not Lisp. Any help is appreciated! Thank you!!

@takagi
Copy link
Owner

takagi commented Jul 19, 2016

I've never seen this kind of error. At least cl-cuda has a fact that works on Windows as #70. Questions I have are:

a) Is this dependent of CL implementation or broader problem?
b) What actually happens?

For a), which CL implementation do you use, CCL? Would you try it with SBCL?

For b), would you get what values cuMemcpyHtoD_v2 actually takes? For example, the following might work to find them.

In cl-cuda/src/api/memory.lisp:

  (defun memcpy-host-to-device (device-ptr host-ptr type n)
    (let ((size (cffi-type-size type)))
+     (print device-ptr)
+     (print host-ptr)
      (cu-memcpy-host-to-device device-ptr host-ptr (* n size))))

@serialhex
Copy link
Author

What I get is:

CL-CUDA-EXAMPLES.VECTOR-ADD 6 > (main)
Invoking CU-INIT succeded.
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-DEVICE-COMPUTE-CAPABILITY succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-ALLOC succeded.

452050419712 
#<Pointer to type :BYTE = #x003FDA88> 
Error: CU-MEMCPY-HOST-TO-DEVICE failed with driver API error No. 1.
CUDA_ERROR_INVALID_VALUE
  1 (abort) Return to level 0.
  2 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

I kinda find it odd also, as I see there's been a good bit of development for Windows, and I was looking for a while trying to get it running properly. As for my system, I'm running LispWorks 6, 32bit (on a 64bit machine, licensing costs $$$ -_- ) I've tried with both sbcl and ccl, and they all have problems relating to compiling or loading osicat, 32 & 64 bit versions of ccl, and 64bit sbcl; different but similar errors.I compiled / groveled with MinGW's gcc, but I'm not sure what else to try.

p.s. I noticed that in issue #70 you asked to put (:windows "nvcuda.dll") in library.lisp but it's not in the source I pulled from GitHub, you might want to add that as ti was required for me to get this far. Thank you!

@takagi
Copy link
Owner

takagi commented Jul 20, 2016

I've tried with both sbcl and ccl, and they all have problems relating to compiling or loading osicat, 32 & 64 bit versions of ccl, and 64bit sbcl; different but similar errors.

#70 has patches to fix problems on Windows including this, but they are not merged to master because some of them require mid-sized code changes. I will make windows branch for working around, would you wait it for a moment?

@serialhex
Copy link
Author

No problem, I've got some time before I really start wanting to do everything CUDA-related in Lisp. Right now I'm still in the prototype stage of my projects, so doing some of the CUDA-specific stuff is a pain, but not horrible.

Thanks again!

@takagi
Copy link
Owner

takagi commented Jul 21, 2016

Okay. Thanks for your interest in cl-cuda.

@takagi
Copy link
Owner

takagi commented Jul 23, 2016

I made a working around branch for windows.

https://github.com/takagi/cl-cuda/tree/windows

Would you try it when it's convenient for you, at least osicat related problems should not occur?

@serialhex
Copy link
Author

I apologize for the delay in getting back to you. Haven't been feeling well, and this no exploratory coding. Anyway, attempting to (ql:quickload :cl-cuda-test) on Lispworks & CCL 32-bit gives me the Error: CU-MEMCPY-HOST-TO-DEVICE failed with driver API error No. 1. CUDA_ERROR_INVALID_VALUE error. SBCL & CCL 64 give me a different error w/ gcc, but that's because I need to try 64bit gcc! So i'm off to install 64-bit MinGW or figure out how to get cffi to use the Windows compiler & will report back the results!

Take care.

@serialhex
Copy link
Author

Okay. After some testing, I'm able to get CCL 64-bit to work. SBCL doesn't seem to work, as it looks like cffi wants to use gcc, and that doesn't play nicely with nvcc. nvcc crashes every time. (Also, it doesn't seem to make the temporary directory properly but just making "C:\tmp" myself fixes that issue.)

Trying 32-bit anything doesn't work with the same error. My guess is that it simply won't work and there isn't any sense in trying. I could be wrong on that point, so don't quote me.

To be absolutely clear, here is how I got things to work for me:

  • 64-bit Clozure CL
  • Visual Studio 2013 with C:\Program Files\Visual Studio 2013\VC\bin (or wherever it's installed) in my PATH (ATM VS 2015 isn't supported by CUDA)
  • Latest Nvidia drivers & CUDA stuff
  • CL-CUDA Windows Branch

If someone uses the above they shouldn't have (many) problems. Let me know if there is anything else you would like me to try. For now I'm closing this, as it all looks good!

@franksmuc
Copy link

I hoped to get cl-cuda running on my 32 bit Lispworks 6.0.1 on Windows 10 with Cygwin compilers

(ql:quickload "cl-cuda-test")

�[37mtest cuInit�[0m
Invoking CU-INIT succeded.
�[37mtest cuDeviceGet�[0m
Invoking CU-DEVICE-GET succeded.
CUDA device handle: 0
�[37mtest cuDeviceGetCount�[0m
Invoking CU-DEVICE-GET-COUNT succeded.
CUDA device count: 1
�[37mtest cuDeviceComputeCapability�[0m
Invoking CU-DEVICE-GET succeded.
Invoking CU-DEVICE-COMPUTE-CAPABILITY succeded.
CUDA device compute capability: 5.0
�[37mtest cuDeviceGetName�[0m
Invoking CU-DEVICE-GET succeded.
Invoking CU-DEVICE-GET-NAME succeded.
CUDA device name: GeForce GTX 860M
�[37mtest cuCtxCreate/cuCtxDestroy�[0m
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-CTX-DESTROY succeded.
�[37mtest cuMemAlloc/cuMemFree�[0m
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-FREE succeded.
Invoking CU-CTX-DESTROY succeded.
�[37mtest cuMemAlloc/cuMemFree using WITH-CU-CONTEXT macro�[0m
Invoking CU-INIT succeded.
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-MEM-ALLOC succeded.
Invoking CU-MEM-FREE succeded.
Invoking CU-CTX-DESTROY succeded.
�[37mtest cuMemcpyHtoD/cuMemcpyDtoH�[0m
Invoking CU-INIT succeded.
Invoking CU-DEVICE-GET succeded.
Invoking CU-CTX-CREATE succeded.
Invoking CU-MEM-ALLOC succeded.

Error: CU-MEMCPY-HOST-TO-DEVICE failed with driver API error No. 1.
CUDA_ERROR_INVALID_VALUE

I guess this shows that NVCUDA.DLL is somehow connected but it's before nvcc comes into play.

This issue #77 had the same problem before. It seemed to be solved.
The solution was to switch to 64-bit CCL and Visual Studio.
However, I would like (or need) to stay with LispWorks and avoid CCL and Visual Studio.

What can I do ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants