numo-linalg 0.1.5 → 0.1.6

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: f1a7f32e07db68cc87340dc3245d9205026bd33c4ebc18b1cbef28f605f1a1d6
4
- data.tar.gz: 1cb21ea35b2dacb1fb02d44317fb3684d9827635e4191aa7ecffd069edd214b1
3
+ metadata.gz: 8315eaaebc86b1e549f1dd1132ba0e25e895c10f6a68b7b461c734bb3fd7612e
4
+ data.tar.gz: ead727d78cff037a15476917751d0373e08abe1cce5cb14931ea8a82628ab8a1
5
5
  SHA512:
6
- metadata.gz: c6125b1b665a2fbd87ecda093e1afea1ef85ca057e62921d95fa424dbe7e30d41d26c5c4caca57719d4c284ec33e179508b13d12c4de5e535c65c186eedc42eb
7
- data.tar.gz: 1d7b3ac0fa98d70bb772674b4491d4d0285ef3303668a59299075c7a1595ff1796df745b73c30f34e295260d0b79df0aaf395b2742a912a292c1a618d92f116b
6
+ metadata.gz: a228a21cc9e6cc3b44f7c11b66b1dcea76dbdc22e51b09e35ca62118a721dea4d4a6dcc729a0603f0aec64411d2c9c72d63ff922a2bb57ea0d93b5363bdab50b
7
+ data.tar.gz: d9651310d52d9f1c1e41caad01bb8f706fe1a631557eaed076cd355702a1ef1ea55e88fe9b2e29ba95476f55569410c5cc737230b67e0843b623844e61f3ece8
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Numo::Linalg : Linear Algebra library with BLAS/LAPACK binding to Numo::NArray
2
2
 
3
3
  [![Binder](http://mybinder.org/badge.svg)](http://mybinder.org/repo/ruby-numo/numo-linalg)
4
- [![Build Status](https://travis-ci.org/ruby-numo/numo-linalg.svg?branch=master)](https://travis-ci.org/ruby-numo/numo-linalg)
4
+ [![Build Status](https://github.com/ruby-numo/numo-linalg/workflows/build/badge.svg)](https://github.com/ruby-numo/numo-linalg/actions)
5
5
 
6
6
  [GitHub](https://github.com/ruby-numo/numo-linalg) |
7
7
  [RubyGems](https://rubygems.org/gems/numo-linalg)
@@ -11,7 +11,7 @@ Under development!
11
11
  ## Introduction
12
12
 
13
13
  This is a binding of BLAS/LAPACK for Numo::NArray using dynamic linking loader.
14
- This desgin allows you to change backend libraries without re-compiling.
14
+ This design allows you to change backend libraries without re-compiling.
15
15
 
16
16
  ### [Numo::Linalg API](http://ruby-numo.github.io/numo-linalg/yard/Numo/Linalg.html)
17
17
 
data/Rakefile CHANGED
@@ -16,3 +16,20 @@ end
16
16
  task :cleandoc do
17
17
  sh "rm -r yard .yardoc"
18
18
  end
19
+
20
+ require 'rake/extensiontask'
21
+ Rake::ExtensionTask.new 'numo/linalg/blas'
22
+ Rake::ExtensionTask.new 'numo/linalg/lapack'
23
+
24
+ CLOBBER.include('lib/numo/linalg/site_conf.rb')
25
+ task :compile do
26
+ site_conf = Dir['./tmp/**/numo/linalg/blas/**/lib/site_conf.rb'].first
27
+ cp site_conf, 'lib/numo/linalg'
28
+ end
29
+
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |t|
32
+ t.rspec_opts = '--color --format documentation --require spec_helper'
33
+ end
34
+
35
+ task :default => [:clobber, :compile, :spec]
@@ -1,5 +1,5 @@
1
- COGEN=ruby gen/cogen.rb -l
2
- GENDEPS=gen/*.rb tmpl/*.c
1
+ COGEN=<%= "ruby #{__dir__}/gen/cogen.rb -l" %>
2
+ GENDEPS=<%= "#{__dir__}/gen/*.rb #{__dir__}/tmpl/*.c" %>
3
3
 
4
4
  <%
5
5
  srcs = %w[s d c z].map{|c| [c, "blas_#{c}.c"]}
@@ -36,5 +36,5 @@ elsif have_header("windows.h")
36
36
  end
37
37
 
38
38
  create_site_conf
39
- create_depend
39
+ create_depend(__dir__)
40
40
  create_makefile('numo/linalg/blas')
@@ -1,5 +1,5 @@
1
- COGEN=ruby gen/cogen.rb -l
2
- GENDEPS=gen/*.rb tmpl/*.c
1
+ COGEN=<%= "ruby #{__dir__}/gen/cogen.rb -l" %>
2
+ GENDEPS=<%= "#{__dir__}/gen/*.rb #{__dir__}/tmpl/*.c" %>
3
3
 
4
4
  <%
5
5
  srcs = %w[s d c z].map{|c| [c, "lapack_#{c}.c"]}
@@ -36,5 +36,5 @@ elsif have_header("windows.h")
36
36
  exit(1) unless have_func("LoadLibrary")
37
37
  end
38
38
 
39
- create_depend
39
+ create_depend(__dir__)
40
40
  create_makefile('numo/linalg/lapack')
@@ -69,12 +69,12 @@ def find_libnarray_a
69
69
  end
70
70
  end
71
71
 
72
- def create_depend
72
+ def create_depend(base_dir)
73
73
  require 'erb'
74
74
  message "creating depend\n"
75
- dep_path = File.join(Dir.pwd, "depend")
75
+ dep_path = "#{base_dir}/depend"
76
76
  File.open(dep_path, "w") do |dep|
77
- dep_erb_path = File.join(Dir.pwd, "depend.erb")
77
+ dep_erb_path = "#{base_dir}/depend.erb"
78
78
  File.open(dep_erb_path, "r") do |dep_erb|
79
79
  erb = ERB.new(dep_erb.read)
80
80
  erb.filename = dep_erb_path
@@ -26,10 +26,16 @@ module Numo
26
26
  lapacke_dirs = ['/opt/lapack/lib', '/opt/lapack/lib64', '/opt/local/lib/lapack',
27
27
  '/usr/local/opt/lapack/lib']
28
28
  opt_dirs = ['/opt/local/lib', '/opt/local/lib64', '/opt/lib', '/opt/lib64']
29
- base_dirs = ['/usr/local/lib', '/usr/local/lib64', '/usr/lib', '/usr/lib64',
30
- "/usr/lib/#{RbConfig::CONFIG['host_cpu']}-#{RbConfig::CONFIG['host_os']}"]
29
+ base_dirs = ['/usr/local/lib', '/usr/local/lib64', '/usr/lib', '/usr/lib64']
30
+ base_dirs.concat(Dir["/usr/lib/#{RbConfig::CONFIG['host_cpu']}-*"])
31
31
  base_dirs.unshift(*ENV['LD_LIBRARY_PATH'].split(':')) unless ENV['LD_LIBRARY_PATH'].nil?
32
32
 
33
+ select_dirs(base_dirs)
34
+ select_dirs(opt_dirs)
35
+ select_dirs(lapacke_dirs)
36
+ select_dirs(atlas_dirs)
37
+ select_dirs(mkl_dirs)
38
+
33
39
  mkl_libs = find_mkl_libs([*base_dirs, *opt_dirs, *mkl_dirs])
34
40
  openblas_libs = find_openblas_libs([*base_dirs, *opt_dirs, *openblas_dirs])
35
41
  atlas_libs = find_atlas_libs([*base_dirs, *opt_dirs, *atlas_dirs, *lapacke_dirs])
@@ -68,11 +74,18 @@ module Numo
68
74
  end
69
75
  end
70
76
 
77
+ def select_dirs(dirs)
78
+ dirs.select!{|d| Dir.exist?(d)}
79
+ end
80
+
71
81
  def find_libs(lib_names, lib_dirs)
72
82
  lib_ext = detect_library_extension
73
83
  lib_arr = lib_names.map do |l|
74
- [l.to_sym, lib_dirs.map { |d| "#{d}/lib#{l}.#{lib_ext}" }
75
- .keep_if { |f| File.exist?(f) }.first]
84
+ x = nil
85
+ lib_dirs.each do |d|
86
+ break if x = Dir.glob("#{d}/lib#{l}{,64}.#{lib_ext}{,.*}").last
87
+ end
88
+ [l.to_sym, x]
76
89
  end
77
90
  Hash[*lib_arr.flatten]
78
91
  end
@@ -1,5 +1,5 @@
1
1
  module Numo
2
2
  module Linalg
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
data/numo-linalg.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rake-compiler"
25
26
  spec.add_development_dependency "rspec"
26
27
  spec.add_runtime_dependency "numo-narray", ">= 0.9.1.4"
27
28
  end
@@ -7,21 +7,4 @@ RSpec.describe Numo::Linalg::Autoloader do
7
7
  expect { described_class.load_library }.to_not raise_error
8
8
  expect(described_class.libs).to_not be_nil
9
9
  end
10
-
11
- describe 'private method' do
12
- let(:autoloader) do
13
- class DummyLoader
14
- include Numo::Linalg::Autoloader
15
- end
16
- DummyLoader.new
17
- end
18
-
19
- it 'finds BLAS/LAPACK libraries' do
20
- lapack_libs = autoloader.send(:find_lapack_libs, ['/usr/lib', '/usr/local/lib', '/usr/local/opt/lapack/lib'])
21
- expect(lapack_libs[:blas]).to_not be_nil
22
- expect(lapack_libs[:cblas]).to_not be_nil
23
- expect(lapack_libs[:lapack]).to_not be_nil
24
- expect(lapack_libs[:lapacke]).to_not be_nil
25
- end
26
- end
27
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-linalg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro TANAKA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-12-30 00:00:00.000000000 Z
12
+ date: 2021-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake-compiler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: rspec
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -214,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
228
  - !ruby/object:Gem::Version
215
229
  version: '0'
216
230
  requirements: []
217
- rubygems_version: 3.1.2
231
+ rubygems_version: 3.2.3
218
232
  signing_key:
219
233
  specification_version: 4
220
234
  summary: Ruby/Numo Linear Algebra library with BLAS/LAPACK