From d5f61e3233f7708e0461dfdc3b6133730399cec9 Mon Sep 17 00:00:00 2001 From: Masayuki Takagi Date: Sat, 23 Jul 2016 18:14:29 +1000 Subject: [PATCH 1/4] Working around for Windows. --- cl-cuda.asd | 2 +- src/api/nvcc.lisp | 3 ++- src/driver-api/library.lisp | 1 + src/lang/built-in.lisp | 8 ++++---- t/api/defkernel.lisp | 4 ++++ t/lang/compiler/compile-expression.lisp | 2 +- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cl-cuda.asd b/cl-cuda.asd index 661d421..ad76906 100644 --- a/cl-cuda.asd +++ b/cl-cuda.asd @@ -46,7 +46,7 @@ :version "0.1" :author "Masayuki Takagi" :license "LLGPL" - :depends-on (:cffi :alexandria :external-program :osicat + :depends-on (:cffi :alexandria :external-program #|:osicat|# :cl-pattern :split-sequence :cl-reexport :cl-ppcre) :components ((:module "src" :serial t diff --git a/src/api/nvcc.lisp b/src/api/nvcc.lisp index dadb56f..9b8bf9b 100644 --- a/src/api/nvcc.lisp +++ b/src/api/nvcc.lisp @@ -23,7 +23,8 @@ *tmp-path*) (defun get-cu-path () - (let ((name (format nil "cl-cuda.~A" (osicat-posix:mktemp)))) + (let ((name "cl-cuda.tmp")) +;; (let ((name (format nil "cl-cuda.~A" (osicat-posix:mktemp)))) (make-pathname :name name :type "cu" :defaults (get-tmp-path)))) (defun get-ptx-path (cu-path) diff --git a/src/driver-api/library.lisp b/src/driver-api/library.lisp index 8062a22..816cc5e 100644 --- a/src/driver-api/library.lisp +++ b/src/driver-api/library.lisp @@ -12,6 +12,7 @@ ;;; (cffi:define-foreign-library libcuda + (:windows "nvcuda.dll") (:darwin (:framework "CUDA")) (:unix (:or "libcuda.so" "libcuda64.so"))) diff --git a/src/lang/built-in.lisp b/src/lang/built-in.lisp index 6fe3901..2b4a2a4 100644 --- a/src/lang/built-in.lisp +++ b/src/lang/built-in.lisp @@ -143,10 +143,10 @@ ((double) double* nil "&") ((curand-state-xorwow) curand-state-xorwow* nil "&")) ;; built-in vector constructor - float3 (((float float float) float3 nil "__make_float3")) - float4 (((float float float float) float4 nil "__make_float4")) - double3 (((double double double) double3 nil "__make_double3")) - double4 (((double double double double) double4 nil "__make_double4")) + float3 (((float float float) float3 nil "make_float3")) + float4 (((float float float float) float4 nil "make_float4")) + double3 (((double double double) double3 nil "make_double3")) + double4 (((double double double double) double4 nil "make_double4")) ;; Synchronization functions syncthreads ((() void nil "__syncthreads")) ;; type casting intrinsics diff --git a/t/api/defkernel.lisp b/t/api/defkernel.lisp index d17dee8..b10d74f 100644 --- a/t/api/defkernel.lisp +++ b/t/api/defkernel.lisp @@ -285,17 +285,21 @@ ;;; Initializers ;;; +#+nil (defglobal c (float3 3.0 2.0 1.0)) +#+nil (defkernel initializer (float3 ()) (let ((x 1.0)) (return (float3 x 2.0 3.0)))) +#+nil (defkernel use-initializer (void ((x float3*) (y float3*))) (set (aref x 0) (initializer)) (set (aref y 0) c) (return)) +#+nil (subtest "Initializers" (with-cuda (0) diff --git a/t/lang/compiler/compile-expression.lisp b/t/lang/compiler/compile-expression.lisp index 921a354..6ac6cb9 100644 --- a/t/lang/compiler/compile-expression.lisp +++ b/t/lang/compiler/compile-expression.lisp @@ -190,7 +190,7 @@ "basic case 3") (is (compile-function '(+ (float3 1.0 1.0 1.0) (float3 2.0 2.0 2.0)) var-env func-env) - "float3_add( __make_float3( 1.0f, 1.0f, 1.0f ), __make_float3( 2.0f, 2.0f, 2.0f ) )" + "float3_add( make_float3( 1.0f, 1.0f, 1.0f ), make_float3( 2.0f, 2.0f, 2.0f ) )" "basic case 4")) (let ((var-env (empty-variable-environment)) From 4780320c10190f80c3ee1e9e9d682159d191b315 Mon Sep 17 00:00:00 2001 From: Shigeru Fujiwara Date: Tue, 24 Sep 2019 03:19:33 +0900 Subject: [PATCH 2/4] Update nvcc.lisp some fix for Windows --- src/api/nvcc.lisp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/nvcc.lisp b/src/api/nvcc.lisp index 9b8bf9b..d768892 100644 --- a/src/api/nvcc.lisp +++ b/src/api/nvcc.lisp @@ -17,7 +17,9 @@ ;;; Helper ;;; -(defvar *tmp-path* (make-pathname :directory "tmp")) +(defvar *tmp-path* + #-windows (make-pathname :directory "tmp") + #+windows (uiop:getenv-pathname "TEMP" :want-directory t)) (defun get-tmp-path () *tmp-path*) @@ -41,7 +43,9 @@ (list "-I" (namestring include-path) "-ptx" "-o" (namestring ptx-path) - (namestring cu-path))))) + (namestring cu-path) + #+windows "-Xcompiler" + #+windows "/source-charset:utf-8")))) ;;; From 65a006a85f1b4c12404d7617a3a79605d025a37a Mon Sep 17 00:00:00 2001 From: Shigeru Fujiwara Date: Sat, 5 Oct 2019 17:22:36 +0900 Subject: [PATCH 3/4] Create README_Windows.markdown added README for Windows --- README_Windows.markdown | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 README_Windows.markdown diff --git a/README_Windows.markdown b/README_Windows.markdown new file mode 100644 index 0000000..1b8f056 --- /dev/null +++ b/README_Windows.markdown @@ -0,0 +1,43 @@ +# Prerequisites + +- NVIDIA CUDA-enabled GPU +- MinGW GCC +- Visual Studio (C/C++ development) +- CUDA Toolkit, CUDA Drivers and CUDA SDK need to be installed +- freeglut + +## Environment variables + +### C_INCLUDE_PATH + +set CUDA include path. +(ex: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include) + +### PATH + +add following directory paths: + +- MinGW bin directory +- MSVC bin directory (contains cl.exe) +- freeglut dll directory + +# Installation + +You can install cl-cuda via quicklisp. + + > (ql:quickload :cl-cuda) + +## Verification environments (Windows) + +#### Environment +* Windows 10 Pro (Version 1903 OS Build 18362.356) +* GeForce GTX 1080 +* Visual Studio Community 2019 +* CUDA 10.1 +* gcc (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0 +* freeglut 3.0.0 for MinGW +* SBCL 1.4.14 (installed via roswell 19.08.11.101(0d8e06d)) +* 2 tests failed, all examples work + +[testing script and result](https://gist.github.com/sgr/242b70859c9afb39ab83a1a7d5feeea6) + From 7b196bd180b4b7fdc8eceff9af0124db7e06efa0 Mon Sep 17 00:00:00 2001 From: Shigeru Fujiwara Date: Sat, 5 Oct 2019 17:36:59 +0900 Subject: [PATCH 4/4] Update nvcc.lisp made not to change behavior on non-windows environment. --- src/api/nvcc.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/nvcc.lisp b/src/api/nvcc.lisp index d768892..d085357 100644 --- a/src/api/nvcc.lisp +++ b/src/api/nvcc.lisp @@ -25,8 +25,8 @@ *tmp-path*) (defun get-cu-path () - (let ((name "cl-cuda.tmp")) -;; (let ((name (format nil "cl-cuda.~A" (osicat-posix:mktemp)))) + (let ((name #-windows (format nil "cl-cuda.~A" (osicat-posix:mktemp)) + #+windows "cl-cuda.tmp")) (make-pathname :name name :type "cu" :defaults (get-tmp-path)))) (defun get-ptx-path (cu-path)