numo-openblas 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/.travis.yml +16 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +27 -0
- data/README.md +52 -0
- data/Rakefile +6 -0
- data/lib/numo/openblas.rb +30 -0
- data/lib/numo/openblas/version.rb +12 -0
- data/lib/rubygems_plugin.rb +65 -0
- data/numo-openblas.gemspec +35 -0
- data/vendor/tmp/.gitkeep +0 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 69ec5184f3c04827324d0fd0d5af5e9b92dd61b7710df099df26379525a48f09
|
4
|
+
data.tar.gz: 41fcc9d0a64991fe1e43d43467c6a98138fd3fa195428e2fb1663ffa571fccca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 86d775545a967607cfce5c4e824a220224822a05fd2a5796eaa9e9a380b8c909829cf8b2d5e394349b6ff65a75d34729393bab8b25949afe2b9090c415373969
|
7
|
+
data.tar.gz: 158f89106e2611e1fdc29ce9c97f1b235c966eac637523230dca4a14db449febd18b32a7c42416cce973a1c34328b098b9e004f8670001489c8acfe7d0860e3f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at yoshoku@outlook.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (c) 2020 Atsushi Tatsuma
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
* Neither the name of the copyright holder nor the names of its
|
15
|
+
contributors may be used to endorse or promote products derived from
|
16
|
+
this software without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Numo::OpenBLAS
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/yoshoku/numo-openblas.svg?branch=master)](https://travis-ci.org/yoshoku/numo-openblas)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/numo-openblas.svg)](https://badge.fury.io/rb/numo-openblas)
|
5
|
+
[![BSD 3-Clause License](https://img.shields.io/badge/License-BSD%203--Clause-orange.svg)](https://github.com/yoshoku/suika/blob/master/LICENSE.txt)
|
6
|
+
|
7
|
+
Numo::OpenBLAS downloads and builds [OpenBLAS](https://www.openblas.net/) during installation and
|
8
|
+
uses that as a background library for [Numo::Linalg](https://github.com/ruby-numo/numo-linalg).
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'numo-openblas'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle install
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install numo-openblas
|
25
|
+
|
26
|
+
Note: Numo::OpenBLAS downloads and builds OpenBLAS during installation.
|
27
|
+
In many cases, building OpenBLAS takes a lot of time.
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
Numo::OpenBLAS loads Numo::NArray and Numo::Linalg using OpenBLAS as a background library.
|
32
|
+
You can use Numo::NArray and Numo::Linalg just by loading Numo::OpenBLAS.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require 'numo/openblas'
|
36
|
+
|
37
|
+
x = Numo::DFloat.new(5, 2).rand
|
38
|
+
c = x.transpose.dot(x)
|
39
|
+
eig_val, eig_vec = Numo::Linalg.eigh(c)
|
40
|
+
```
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/numo-openblas. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/yoshoku/numo-openblas/blob/master/CODE_OF_CONDUCT.md).
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause).
|
49
|
+
|
50
|
+
## Code of Conduct
|
51
|
+
|
52
|
+
Everyone interacting in the Numo::Openblas project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/yoshoku/numo-openblas/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
require 'numo/narray'
|
4
|
+
require 'numo/linalg/linalg'
|
5
|
+
require 'numo/openblas/version'
|
6
|
+
|
7
|
+
module Numo
|
8
|
+
module Linalg
|
9
|
+
module Loader
|
10
|
+
module_function
|
11
|
+
|
12
|
+
def load_openblas
|
13
|
+
dlext = case RbConfig::CONFIG['host_os']
|
14
|
+
when /mswin|msys|mingw|cygwin/
|
15
|
+
'dll'
|
16
|
+
when /darwin|mac os/
|
17
|
+
'dylib'
|
18
|
+
else
|
19
|
+
'so'
|
20
|
+
end
|
21
|
+
openblas_path = File.expand_path(__dir__ + "/../../vendor/lib/libopenblas.#{dlext}")
|
22
|
+
Numo::Linalg::Blas.dlopen(openblas_path)
|
23
|
+
Numo::Linalg::Lapack.dlopen(openblas_path)
|
24
|
+
@@libs = [openblas_path]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Numo::Linalg::Loader.load_openblas
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Numo
|
4
|
+
# Numo::OpenBLAS loads Numo::NArray and Linalg with OpenBLAS used as backend library.
|
5
|
+
module OpenBLAS
|
6
|
+
# The version of Numo::OpenBLAS you install.
|
7
|
+
VERSION = '0.1.1'
|
8
|
+
|
9
|
+
# The version OpenBLAS that Numo::OpenBLAS build and use.
|
10
|
+
OPENBLAS_VERSION = '0.3.10'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubygems/package'
|
5
|
+
|
6
|
+
require 'digest/sha1'
|
7
|
+
require 'etc'
|
8
|
+
require 'fileutils'
|
9
|
+
require 'open-uri'
|
10
|
+
require 'open3'
|
11
|
+
|
12
|
+
Gem.post_install do
|
13
|
+
openblas_ver = '0.3.10'
|
14
|
+
openblas_key = 'cbe3fdd0e6ee235debc611d76976dac62f3ddc1c'
|
15
|
+
openblas_uri = "https://github.com/xianyi/OpenBLAS/archive/v#{openblas_ver}.tar.gz"
|
16
|
+
openblas_dir = File.expand_path(__dir__ + '/../vendor')
|
17
|
+
|
18
|
+
next true if File.exist?("#{openblas_dir}/installed_#{openblas_ver}")
|
19
|
+
|
20
|
+
puts "Downloading OpenBLAS #{openblas_ver}."
|
21
|
+
URI.open(openblas_uri) do |rf|
|
22
|
+
File.open("#{openblas_dir}/tmp/openblas.tgz", 'wb') { |sf| sf.write(rf.read) }
|
23
|
+
end
|
24
|
+
|
25
|
+
next false if openblas_key != Digest::SHA1.file("#{openblas_dir}/tmp/openblas.tgz").to_s
|
26
|
+
|
27
|
+
puts 'Unpacking OpenBLAS tar.gz file.'
|
28
|
+
Gem::Package::TarReader.new(Zlib::GzipReader.open("#{openblas_dir}/tmp/openblas.tgz")) do |tar|
|
29
|
+
tar.each do |entry|
|
30
|
+
next unless entry.file?
|
31
|
+
|
32
|
+
filename = "#{openblas_dir}/tmp/#{entry.full_name}"
|
33
|
+
next if filename == File.dirname(filename)
|
34
|
+
|
35
|
+
FileUtils.mkdir_p("#{openblas_dir}/tmp/#{File.dirname(entry.full_name)}")
|
36
|
+
File.open(filename, 'wb') { |f| f.write(entry.read) }
|
37
|
+
File.chmod(entry.header.mode, filename)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Dir.chdir("#{openblas_dir}/tmp/OpenBLAS-#{openblas_ver}") do
|
42
|
+
puts 'Building OpenBLAS. This could take a while...'
|
43
|
+
mkstdout, _mkstderr, mkstatus = Open3.capture3("make -j#{Etc.nprocessors}")
|
44
|
+
File.open("#{openblas_dir}/tmp/openblas.log", 'w') { |f| f.puts(mkstdout) }
|
45
|
+
unless mkstatus.success?
|
46
|
+
puts 'Failed to build OpenBLAS.'
|
47
|
+
puts 'Check the make-openblas.log file for more details:'
|
48
|
+
puts "#{openblas_dir}/tmp/openblas.log"
|
49
|
+
break false
|
50
|
+
end
|
51
|
+
|
52
|
+
puts 'Installing OpenBLAS.'
|
53
|
+
insstdout, _insstderr, insstatus = Open3.capture3("make install PREFIX=#{openblas_dir}")
|
54
|
+
File.open("#{openblas_dir}/tmp/openblas.log", 'a') { |f| f.puts(insstdout) }
|
55
|
+
unless insstatus.success?
|
56
|
+
puts 'Failed to install OpenBLAS.'
|
57
|
+
puts 'Check the make-openblas.log file for more details:'
|
58
|
+
puts "#{openblas_dir}/tmp/openblas.log"
|
59
|
+
break false
|
60
|
+
end
|
61
|
+
|
62
|
+
FileUtils.touch("#{openblas_dir}/installed_#{openblas_ver}")
|
63
|
+
true
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative 'lib/numo/openblas/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'numo-openblas'
|
5
|
+
spec.version = Numo::OpenBLAS::VERSION
|
6
|
+
spec.authors = ['yoshoku']
|
7
|
+
spec.email = ['yoshoku@outlook.com']
|
8
|
+
|
9
|
+
spec.summary = <<~MSG
|
10
|
+
Numo::OpenBLAS downloads and builds OpenBLAS during installation and
|
11
|
+
uses that as a background library for Numo::Linalg.
|
12
|
+
MSG
|
13
|
+
spec.description = <<~MSG
|
14
|
+
Numo::OpenBLAS downloads and builds OpenBLAS during installation and
|
15
|
+
uses that as a background library for Numo::Linalg.
|
16
|
+
MSG
|
17
|
+
spec.homepage = 'https://github.com/yoshoku/numo-openblas'
|
18
|
+
spec.license = 'BSD-3-Clause'
|
19
|
+
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/yoshoku/numo-openblas'
|
22
|
+
spec.metadata['changelog_uri'] = 'https://github.com/yoshoku/numo-openblas/blob/master/CHANGELOG.md'
|
23
|
+
spec.metadata['documentation_uri'] = 'https://github.com/yoshoku/numo-openblas/blob/master/README.md'
|
24
|
+
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
28
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
29
|
+
end
|
30
|
+
spec.bindir = 'exe'
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ['lib']
|
33
|
+
|
34
|
+
spec.add_runtime_dependency 'numo-linalg', '>= 0.1.4'
|
35
|
+
end
|
data/vendor/tmp/.gitkeep
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: numo-openblas
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- yoshoku
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: numo-linalg
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.4
|
27
|
+
description: |
|
28
|
+
Numo::OpenBLAS downloads and builds OpenBLAS during installation and
|
29
|
+
uses that as a background library for Numo::Linalg.
|
30
|
+
email:
|
31
|
+
- yoshoku@outlook.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- ".gitignore"
|
37
|
+
- ".rspec"
|
38
|
+
- ".travis.yml"
|
39
|
+
- CHANGELOG.md
|
40
|
+
- CODE_OF_CONDUCT.md
|
41
|
+
- Gemfile
|
42
|
+
- LICENSE.txt
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- lib/numo/openblas.rb
|
46
|
+
- lib/numo/openblas/version.rb
|
47
|
+
- lib/rubygems_plugin.rb
|
48
|
+
- numo-openblas.gemspec
|
49
|
+
- vendor/tmp/.gitkeep
|
50
|
+
homepage: https://github.com/yoshoku/numo-openblas
|
51
|
+
licenses:
|
52
|
+
- BSD-3-Clause
|
53
|
+
metadata:
|
54
|
+
homepage_uri: https://github.com/yoshoku/numo-openblas
|
55
|
+
source_code_uri: https://github.com/yoshoku/numo-openblas
|
56
|
+
changelog_uri: https://github.com/yoshoku/numo-openblas/blob/master/CHANGELOG.md
|
57
|
+
documentation_uri: https://github.com/yoshoku/numo-openblas/blob/master/README.md
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubygems_version: 3.1.2
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: Numo::OpenBLAS downloads and builds OpenBLAS during installation and uses
|
77
|
+
that as a background library for Numo::Linalg.
|
78
|
+
test_files: []
|