Giter Club home page Giter Club logo

Comments (5)

LudoTheHUN avatar LudoTheHUN commented on June 14, 2024

One minor point, with the extra project.clj settings, as the repl starts up, I see
Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 22).

from clojurecl.

blueberry avatar blueberry commented on June 14, 2024

Can you please run info function on the platform and on that device and verify that they support OpenCL version 1.2? clReleaseDevice was introduced in OpenCL 1.2, so the crash may be caused by calling the non-existing function. Also, please try with-release on some other type of object - if it works, I am pretty sure the problem is a pre-1.2 platform driver.

Please post the outputs of those two info calls. Obviously, since I do not have nvidia platform available to me, I can not try it myself, but I'll try to identify the problem and at least find whether it is in ClojureCL or not, so we can find a solution.

from clojurecl.

LudoTheHUN avatar LudoTheHUN commented on June 14, 2024

(info (first (platforms))) gave me

#uncomplicate.clojurecl.info.PlatformInfo{:profile "FULL_PROFILE", :version "OpenCL 1.1 CUDA 7.0.41", :name "NVIDIA CUDA", :vendor "NVIDIA Corporation", :extensions #{"cl_khr_gl_sharing" "cl_nv_copy_opts" "cl_khr_icd" "cl_nv_pragma_unroll" "cl_khr_byte_addressable_store" "cl_nv_device_attribute_query" "cl_nv_compiler_options"}, :icd-suffix-khr "NV"}

So I'm not even on opencl 1.2.

Devices give a larger result confirming the same (pasted below).

I isolated the jvm crash to just with-release on dev

So this works:

(def dev (first (devices (first (platforms)))))

(let [work-sizes (work-size [1])
       host-msg (direct-buffer 16)
       program-source
       "__kernel void hello_kernel(__global char16 *msg) {\n    *msg = (char16)('H', 'e', 'l', 'l', 'o', ' ',
   'k', 'e', 'r', 'n', 'e', 'l', '!', '!', '!', '\\0');\n}\n"
       ]
 (with-release
  [
   ;;dev (first (devices (first (platforms))))
   ctx (context [dev])
   cqueue (command-queue ctx dev)
   cl-msg (cl-buffer ctx 16 :write-only)
   prog (build-program! (program-with-source ctx [program-source]))
   hello-kernel (kernel prog "hello_kernel")
   ]
  (set-args! hello-kernel cl-msg)
  (enq-nd! cqueue  hello-kernel work-sizes)
  (enq-read! cqueue cl-msg host-msg)
  (apply str (map char
                         (wrap-byte-seq int8 (byte-seq host-msg))))))

-->> "Hello kernel!!!"
(info dev)
#uncomplicate.clojurecl.info.DeviceInfo{:address-bits 32, :available true, :built-in-kernels #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :compiler-available true, :double-fp-config #{:round-to-nearest :round-to-inf :inf-nan :round-to-zero :fma :denorm}, :endian-little true, :error-correction-support false, :execution-capabilities #{:kernel}, :extensions #{"" "cl_khr_gl_sharing" "cl_khr_local_int32_extended_atomics" "cl_khr_global_int32_base_atomics" "cl_khr_fp64" "cl_nv_copy_opts" "cl_khr_icd" "cl_khr_global_int32_extended_atomics" "cl_nv_pragma_unroll" "cl_khr_byte_addressable_store" "cl_nv_device_attribute_query" "cl_khr_local_int32_base_atomics" "cl_nv_compiler_options"}, :global-mem-cache-size 114688, :global-mem-cache-type :read-write, :global-mem-cacheline-size 128, :global-mem-size 3220504576, :global-variable-preferred-total-size #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :image2d-max-height 32768, :image2d-max-width 32768, :image3d-max-depth 4096, :image3d-max-height 4096, :image3d-max-width 4096, :image-base-address-alignment #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :image-max-array-size 2048, :image-max-buffer-size 134217728, :image-pitch-alignment #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :image-support true, :linker-available #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :local-mem-size 49151, :local-mem-type :local, :max-clock-frequency 980, :max-compute-units 7, :max-constant-args 9, :max-constant-buffer-size 65536, :max-global-variable-size #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :max-mem-aloc-size 805126144, :max-on-device-events #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :max-on-device-queues #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :max-parameter-size 4352, :max-pipe-args #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :max-read-image-args 256, :max-read-write-image-args #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :max-samplers 32, :max-work-group-size 1024, :max-work-item-dimensions 3, :max-work-item-sizes (1024 1024 64), :max-write-image-args 16, :mem-base-addr-align 4096, :name "GeForce GTX 660 Ti", :native-vector-width-char 1, :native-vector-width-short 1, :native-vector-width-int 1, :native-vector-width-long 1, :native-vector-width-double 1, :native-vector-width-float 1, :native-vector-width-half 0, :opencl-c-version {:version 1.1, :vendor-specific-info nil}, :parent-device #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :partition-affinity-domain #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :partition-max-sub-devices #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :partition-properties #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :partition-type #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :pipe-max-active-reservations #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :pipe-max-packet-size #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :platform #<cl_platform_id cl_platform_id[0x7f78000d0060]>, :preferred-global-atomic-alignment #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :preferred-interop-user-sync #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :preferred-local-atomic-alignment #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :preferred-platform-atomic-alignment #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :preferred-vector-width-char 1, :preferred-vector-width-short 1, :preferred-vector-width-int 1, :preferred-vector-width-long 1, :preferred-vector-width-double 1, :preferred-vector-width-float 1, :preferred-vector-width-half 0, :printf-buffer-size #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :profile "FULL_PROFILE", :profiling-timer-resolution 1000, :queue-on-device-max-size #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :queue-on-device-preferred-size #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :queue-on-device-properties #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :queue-on-host-properties #{:out-of-order-exec-mode :profiling}, :reference-count #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :single-fp-config #{:round-to-nearest :round-to-inf :inf-nan :round-to-zero :fma :denorm}, :spir-versions #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :svm-capabilities #<ExceptionInfo clojure.lang.ExceptionInfo: OpenCL error: CL_INVALID_VALUE. {:name "CL_INVALID_VALUE", :code -30, :type :opencl-error, :details nil}>, :device-type :gpu, :vendor "NVIDIA Corporation", :vendor-id 4318, :device-version "OpenCL 1.1 CUDA", :driver-version "346.72"}

Thank you for this library, it will make openCL so much more approachable.

from clojurecl.

blueberry avatar blueberry commented on June 14, 2024

OK, so it works as expected. I'll close the issue. The point for posterity is that, if you use an older version of the OpenCL platform, you should use only the functionality supported by that particular version of the standard. Follow the links from clojurecl API to khronos's website, but change the version in the link to the one you use.

from clojurecl.

pdiffley avatar pdiffley commented on June 14, 2024

For easy access, the link to the api docs is here: http://clojurecl.uncomplicate.org/codox/uncomplicate.clojurecl.core.html

Each function doc also links to the khronos page.

Thanks to blueberry for clarifying this for me!

from clojurecl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.