numo-tiny_linalg 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd5b3d90b9c0bc323420f2eed5363490ec7c2ec4a3b0950573f54f234d534eaf
4
- data.tar.gz: cd0a71621d1e3e935faba0a40036b3950c0f6ac32a74cdaad46b0e313b5dfa2f
3
+ metadata.gz: a1bff84bdd946b37325d2561e03141fec2ac75ac363e2ac640fc5d10d7f41950
4
+ data.tar.gz: 141adbf0789217c8d77c934e545ab8fae9a4c5178a94d6f4716f4a62c3106118
5
5
  SHA512:
6
- metadata.gz: f904406ce9c883d59d93afc061bfc65c96073dc9660cb65e6eefa97e2be32cc8c79ac26970a8b181cd3acbdbd412cf97c08153017956c4cc4f2b29bf28bcda46
7
- data.tar.gz: 8f3ee9b0e0e9c3789f61148db03d43c245dab66fc4cb428488cbe668dad00b0d7fb73ef825e5dc0c5772ba817d41bb90d5fce843ece1f1adf6fe81857b9917ff
6
+ metadata.gz: 973e0075155ea849a9a7cc681d3e59242d19e6d649c8210329fdc21dae2aa07ac79495c4a32c56c580d819e37504f7064716f261aaa3d76c1ab2f5b42d414dfd
7
+ data.tar.gz: f2a9f4d7575e89f6a740955f74e13692fbd04844072ef0b7c519ce2ac4ce21bf3bdd32f72434c0dc0c1c6b358a0cbe279f101afdff139702b3574e9ab1d014c0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [[0.3.1](https://github.com/yoshoku/numo-tiny_linalg/compare/v0.3.0...v0.3.1)] - 2023-08-15
4
+ - Support automatic build of OpenBLAS on Windows.
5
+ - The author does not have a Windows PC. It will probably work.
6
+ - Add OPENBLAS_VERSION constant to TinyLinalg.
7
+
3
8
  ## [[0.3.0](https://github.com/yoshoku/numo-tiny_linalg/compare/v0.2.0...v0.3.0)] - 2023-08-13
4
9
  - Add cholesky and cho_solve module functions to TinyLinalg.
5
10
 
@@ -18,7 +18,9 @@ end
18
18
 
19
19
  abort 'numo/narray.h is not found' unless have_header('numo/narray.h')
20
20
 
21
- if RUBY_PLATFORM.match?(/mswin|cygwin|mingw/)
21
+ on_windows = RUBY_PLATFORM.match?(/mswin|cygwin|mingw/)
22
+
23
+ if on_windows
22
24
  $LOAD_PATH.each do |lp|
23
25
  if File.exist?(File.join(lp, 'numo/libnarray.a'))
24
26
  $LDFLAGS = "-L#{lp}/numo #{$LDFLAGS}"
@@ -31,13 +33,6 @@ end
31
33
  abort 'libstdc++ is not found.' unless have_library('stdc++')
32
34
  $CXXFLAGS << ' -std=c++11'
33
35
 
34
- # NOTE: Accelerate framework does not support LAPACKE.
35
- # use_accelerate = false
36
- # if RUBY_PLATFORM.include?('darwin') && have_framework('Accelerate')
37
- # $CFLAGS << ' -DTINYLINALG_USE_ACCELERATE'
38
- # use_accelerate = true
39
- # end
40
-
41
36
  build_openblas = false
42
37
  unless find_library('openblas', 'LAPACKE_dsyevr')
43
38
  build_openblas = true unless have_library('openblas')
@@ -51,6 +46,7 @@ if build_openblas
51
46
  warn 'BLAS and LAPACKE APIs are not found. Downloading and Building OpenBLAS...'
52
47
 
53
48
  VENDOR_DIR = File.expand_path("#{__dir__}/../../../vendor")
49
+ TINYLINALG_DIR = File.expand_path("#{__dir__}/../../../lib/numo/tiny_linalg")
54
50
  OPENBLAS_VER = '0.3.23'
55
51
  OPENBLAS_KEY = '115634b39007de71eb7e75cf7591dfb2'
56
52
  OPENBLAS_URI = "https://github.com/xianyi/OpenBLAS/archive/v#{OPENBLAS_VER}.tar.gz"
@@ -82,18 +78,19 @@ if build_openblas
82
78
  File.open("#{VENDOR_DIR}/tmp/openblas.log", 'a') { |f| f.puts(insstdout) }
83
79
  abort("Failed to install OpenBLAS. Check the openblas.log file for more details: #{VENDOR_DIR}/tmp/openblas.log") unless insstatus.success?
84
80
 
81
+ FileUtils.cp("#{VENDOR_DIR}/lib/libopenblas.a", TINYLINALG_DIR) if on_windows
82
+
85
83
  FileUtils.touch("#{VENDOR_DIR}/installed_#{OPENBLAS_VER}")
86
84
  end
87
85
  end
88
86
 
89
- abort('libopenblas is not found.') unless find_library('openblas', nil, "#{VENDOR_DIR}/lib")
87
+ libopenblas_dir = on_windows ? TINYLINALG_DIR : "#{VENDOR_DIR}/lib"
88
+ abort('libopenblas is not found.') unless find_library('openblas', nil, libopenblas_dir)
90
89
  abort('openblas_config.h is not found.') unless find_header('openblas_config.h', nil, "#{VENDOR_DIR}/include")
91
90
  abort('cblas.h is not found.') unless find_header('cblas.h', nil, "#{VENDOR_DIR}/include")
92
91
  abort('lapacke.h is not found.') unless find_header('lapacke.h', nil, "#{VENDOR_DIR}/include")
93
92
  end
94
93
 
95
- $CFLAGS << ' -DNUMO_TINY_LINALG_USE_OPENBLAS'
96
-
97
94
  if RUBY_PLATFORM.include?('darwin') && Gem::Version.new('3.1.0') <= Gem::Version.new(RUBY_VERSION) &&
98
95
  try_link('int main(void){return 0;}', '-Wl,-undefined,dynamic_lookup')
99
96
  $LDFLAGS << ' -Wl,-undefined,dynamic_lookup'
@@ -248,6 +248,9 @@ extern "C" void Init_tiny_linalg(void) {
248
248
  */
249
249
  rb_mTinyLinalgLapack = rb_define_module_under(rb_mTinyLinalg, "Lapack");
250
250
 
251
+ /* The version of OpenBLAS used in background library. */
252
+ rb_define_const(rb_mTinyLinalg, "OPENBLAS_VERSION", rb_str_new_cstr(OPENBLAS_VERSION));
253
+
251
254
  /**
252
255
  * Returns BLAS char ([sdcz]) defined by data-type of arguments.
253
256
  *
@@ -33,6 +33,7 @@
33
33
 
34
34
  #include <cblas.h>
35
35
  #include <lapacke.h>
36
+ #include <openblas_config.h>
36
37
 
37
38
  #include <string>
38
39
 
@@ -5,6 +5,6 @@ module Numo
5
5
  # Numo::TinyLinalg is a subset library from Numo::Linalg consisting only of methods used in Machine Learning algorithms.
6
6
  module TinyLinalg
7
7
  # The version of Numo::TinyLinalg you install.
8
- VERSION = '0.3.0'
8
+ VERSION = '0.3.1'
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-tiny_linalg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-13 00:00:00.000000000 Z
11
+ date: 2023-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray