Fork me on GitHub
#uncomplicate
<
2021-07-16
>
viesti18:07:24

Hum, interesting, asking for a friend :), but seem to get svd to crash at times:

0% cat deps.edn
{:paths ["src"]
 :deps {uncomplicate/neanderthal {:mvn/version "0.41.0"
                                  :exclusions [org.jcuda/jcuda-natives
                                               org.jcuda/jcublas-natives]}}}
0% cat src/linalg/core.clj
(ns linalg.core
  (:require [uncomplicate.neanderthal
             [native :refer [dge dgb dgd]]
             [core :refer [mm nrm2]]
             [linalg :refer [svd svd!] :as la]]))

(def data [2004.2 0.26
           2004.5 0.26
           2004.8 0.33
           2005.0 0.35
           2005.2 0.36
           2005.5 0.37
           2005.8 0.38
           2006.0 0.39
           2006.2 0.43
           2006.5 0.44
           2006.8 0.45
           2007.0 0.48
           2007.2 0.51
           2007.5 0.51
           2007.8 0.53
           2008.0 0.55
           2008.2 0.58
           2008.5 0.59
           2008.8 0.61
           2009 0.64
           2009.2 0.66
           2009.5 0.68
           2009.8 0.69
           2010.0 0.72
           2010.2 0.76
           2010.5 0.76
           2010.8 0.78
           2011.0 0.81
           2011.2 0.81
           2011.5 0.85
           2011.8 0.87
           2012 0.87
           2012.2 0.9
           2012.5 0.91
           2012.8 0.96
           2013.0 0.97
           2013.2 0.99
           2013.5 0.99
           2013.8 1.03
           2014.0 1.08])

(let [X_hat (map (fn [[x _]] [1 x]) (partition 2 data))
      _y (map (fn [[_x y]] y) (partition 2 data))
      rows (count X_hat)
      cols 2
      source (into [] cat X_hat)
      A  (dge rows cols source {:layout :row})]
  (dotimes [i 10]
    (println "try" i)
    (svd A true true)))
0% clj -J--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED
Clojure 1.10.3
user=> (require 'linalg.core :reload)
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See  for further details.
try 0
try 1
java(89448,0x70000e37f000) malloc: *** error for object 0x3fc432f2ddcd91cb: pointer being freed was not allocated
java(89448,0x70000e37f000) malloc: *** set a breakpoint in malloc_error_break to debug

rlwrap: warning: clojure crashed, killed by SIGABRT.
rlwrap itself has not crashed, but for transparency,
it will now kill itself (without dumping core) with the same signal

warnings can be silenced by the --no-warnings (-n) option
0% java -version
openjdk version "15.0.1" 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9)
OpenJDK 64-Bit Server VM (build 15.0.1+9, mixed mode, sharing)
0% l /opt/intel/oneapi/mkl
total 0
lrwxr-xr-x   1 root  wheel     8B Jul 16 08:53 latest -> 2021.3.0
drwxr-xr-x  12 root  wheel   384B Jul 16 08:54 2021.3.0