Skip to content

Commit

Permalink
Load bytedeco MKL in a blocking agent.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueberry committed Aug 23, 2020
1 parent 3446d7d commit 029f38d
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions src/clojure/uncomplicate/neanderthal/internal/host/mkl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,38 @@
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.

(ns uncomplicate.neanderthal.internal.host.mkl
(:require [uncomplicate.commons
[core :refer [with-release let-release info Releaseable release]]
[utils :refer [dragan-says-ex generate-seed direct-buffer]]]
[uncomplicate.fluokitten.core :refer [fmap!]]
[uncomplicate.neanderthal
[core :refer [dim]]
[math :refer [f=] :as math]
[block :refer [create-data-source initialize]]]
[uncomplicate.neanderthal.internal
[api :refer :all]
[navigation :refer [full-storage]]
[common :refer [check-stride check-eq-navigators real-accessor]]]
[uncomplicate.neanderthal.internal.host
[buffer-block :refer :all]
[cblas :refer :all]
[lapack :refer :all]])
(:import [java.nio ByteBuffer FloatBuffer DoubleBuffer LongBuffer IntBuffer ShortBuffer
ByteBuffer DirectByteBuffer DirectFloatBufferU DirectDoubleBufferU
DirectLongBufferU DirectIntBufferU DirectShortBufferU]
[uncomplicate.neanderthal.internal.api DataAccessor RealBufferAccessor
Block RealVector Region LayoutNavigator DenseStorage RealNativeMatrix]
[uncomplicate.neanderthal.internal.host.buffer_block IntegerBlockVector RealBlockVector
RealGEMatrix RealUploMatrix RealBandedMatrix RealPackedMatrix RealDiagonalMatrix]))
(try
(clojure.lang.RT/loadClassForName "org.bytedeco.mkl.global.mkl_rt")
(finally
(import [uncomplicate.neanderthal.internal.host CBLAS MKL LAPACK])))
(await (send-off (agent :mkl)
(fn [state]
(try
(clojure.lang.RT/loadClassForName "org.bytedeco.mkl.global.mkl_rt")
(finally :success)))))
(finally
(ns uncomplicate.neanderthal.internal.host.mkl
(:require [uncomplicate.commons
[core :refer [with-release let-release info Releaseable release]]
[utils :refer [dragan-says-ex generate-seed direct-buffer]]]
[uncomplicate.fluokitten.core :refer [fmap!]]
[uncomplicate.neanderthal
[core :refer [dim]]
[math :refer [f=] :as math]
[block :refer [create-data-source initialize]]]
[uncomplicate.neanderthal.internal
[api :refer :all]
[navigation :refer [full-storage]]
[common :refer [check-stride check-eq-navigators real-accessor]]]
[uncomplicate.neanderthal.internal.host
[buffer-block :refer :all]
[cblas :refer :all]
[lapack :refer :all]])
(:import [java.nio ByteBuffer FloatBuffer DoubleBuffer LongBuffer IntBuffer ShortBuffer
ByteBuffer DirectByteBuffer DirectFloatBufferU DirectDoubleBufferU
DirectLongBufferU DirectIntBufferU DirectShortBufferU]
[uncomplicate.neanderthal.internal.api DataAccessor RealBufferAccessor
Block RealVector Region LayoutNavigator DenseStorage RealNativeMatrix]
[uncomplicate.neanderthal.internal.host.buffer_block IntegerBlockVector RealBlockVector
RealGEMatrix RealUploMatrix RealBandedMatrix RealPackedMatrix RealDiagonalMatrix]
[uncomplicate.neanderthal.internal.host CBLAS MKL LAPACK]))))

(defn ^:private not-available [kind]
(throw (UnsupportedOperationException. "Operation not available for %s matrix")))
Expand Down

0 comments on commit 029f38d

Please sign in to comment.