mkmf-cu 0.1.0 → 0.1.1.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +36 -0
- data/lib/mkmf-cu/opt.rb +4 -8
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fcdd23cfcda41123fb100187f4b85b56ea03667
|
4
|
+
data.tar.gz: d48972b1e184b1e7f405bc1ae45c931fa92728ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 136f6c60c8ac8dfddfdd19579fb56f454274d0c988fc13dbb55c69cfa2ebec949059e3636cb7b0937cd4c9214c3ce1fff761e08f28506dd00417cfca04c48d11
|
7
|
+
data.tar.gz: 3aadc286ee6d7283a4f281b9adfe4f941bc640d403eecae0941ab281805d1fe8130391ab657f427902fe9486d20a669b9cf8bbc7c8fb9bb12447cd06da55cc9c
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 ruby-accel
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# About mkmf-cu
|
2
|
+
|
3
|
+
mkmf-cu is a gem to write Ruby extensions in C/C++ with NVIDIA CUDA.
|
4
|
+
It consists of a simple wrapper command for nvcc and a monkey patch for mkmf.
|
5
|
+
|
6
|
+
## How to use it.
|
7
|
+
|
8
|
+
Instead of require "mkmf", just
|
9
|
+
```ruby
|
10
|
+
require "mkmf-cu"
|
11
|
+
```
|
12
|
+
|
13
|
+
## How does it work?
|
14
|
+
|
15
|
+
By requiring "mkmf-cu", compiler commands defined in mkmf
|
16
|
+
will be replaced with mkmf-cu-nvcc, a command included in this gem.
|
17
|
+
|
18
|
+
When mkmf-cu-nvcc is called with arguments for gcc or clang,
|
19
|
+
it convert them to ones suitable for nvcc and execute nvcc with them.
|
20
|
+
|
21
|
+
For example,
|
22
|
+
|
23
|
+
mkmf-cu-nvcc -I. -fno-common -pipe -Os -O2 -Wall -o culib.o -c culib.cu
|
24
|
+
|
25
|
+
will execute
|
26
|
+
|
27
|
+
nvcc -I. -O2 -o culib.o -c culib.cu --compiler-options -fno-common --compiler-options -Wall
|
28
|
+
|
29
|
+
## Example
|
30
|
+
|
31
|
+
* https://github.com/ruby-accel/ruby-cuda-example
|
32
|
+
|
33
|
+
## Notice
|
34
|
+
|
35
|
+
When the suffix of the name of a file containing CUDA code is not .cu,
|
36
|
+
you must add the option "-x cu" to $CFLAGS or $CXXFLAGS in extconf.rb.
|
data/lib/mkmf-cu/opt.rb
CHANGED
@@ -45,7 +45,7 @@ def parse_ill_short(argv, opt_h)
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def parse_ill_short_with_arg(argv, opt_h)
|
48
|
-
[/\A(\-stdlib)=(.*)/, /\A(\-Wl),(.*)/].each{|reg|
|
48
|
+
[/\A(\-stdlib)=(.*)/, /\A(\-std)=(.*)/, /\A(\-Wl),(.*)/].each{|reg|
|
49
49
|
argv.each{|e|
|
50
50
|
if reg =~ e
|
51
51
|
e[0..-1] = "-" + $1 + '=' + $2
|
@@ -61,7 +61,7 @@ def compiler_option(opt_h)
|
|
61
61
|
ret << " --compiler-options " + "#{op}#{e}"
|
62
62
|
}
|
63
63
|
}
|
64
|
-
["-stdlib"].each{|op|
|
64
|
+
["-stdlib", "-std"].each{|op|
|
65
65
|
opt_h[op].each{|e|
|
66
66
|
ret << " --compiler-options " + "#{op}=#{e}"
|
67
67
|
}
|
@@ -76,11 +76,9 @@ def linker_option(opt_h)
|
|
76
76
|
ret << " --linker-options " + op
|
77
77
|
}
|
78
78
|
}
|
79
|
-
|
80
79
|
opt_h["-Wl"].each{|e|
|
81
80
|
ret << " --linker-options " + e
|
82
81
|
}
|
83
|
-
|
84
82
|
return ret
|
85
83
|
end
|
86
84
|
|
@@ -95,10 +93,10 @@ end
|
|
95
93
|
def generate_compiling_command_line(opt_h)
|
96
94
|
s = ""
|
97
95
|
# options nvcc can uderstatnd
|
98
|
-
["-pg", "-g", "-G", "-x", "-I", "-D", "-o", "-c", "-O"].each{|op|
|
96
|
+
["-std", "-pg", "-g", "-G", "-x", "-I", "-D", "-o", "-c", "-O"].each{|op|
|
99
97
|
opt_h[op].each{|e|
|
100
98
|
case op
|
101
|
-
when "-o", "-c", "-x"
|
99
|
+
when "-o", "-c", "-x", "-std"
|
102
100
|
s << " #{op} #{e}"
|
103
101
|
else
|
104
102
|
s << " #{op}#{e}"
|
@@ -125,8 +123,6 @@ def generate_linking_command_line(argv, opt_h)
|
|
125
123
|
}
|
126
124
|
s << compiler_option(opt_h)
|
127
125
|
s << linker_option(opt_h)
|
128
|
-
|
129
126
|
s << compiler_bin(opt_h)
|
130
|
-
|
131
127
|
return s
|
132
128
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mkmf-cu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Tamura
|
@@ -10,7 +10,7 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Write Ruby
|
13
|
+
description: Write Ruby extension in C/C++ with NVIDIA CUDA. A simple wrapper command
|
14
14
|
for nvcc and a monkey patch for mkmf.
|
15
15
|
email: ''
|
16
16
|
executables:
|
@@ -18,6 +18,8 @@ executables:
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
+
- LICENSE
|
22
|
+
- README.md
|
21
23
|
- bin/mkmf-cu-nvcc
|
22
24
|
- lib/mkmf-cu.rb
|
23
25
|
- lib/mkmf-cu/opt.rb
|
@@ -36,13 +38,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
38
|
version: '0'
|
37
39
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
40
|
requirements:
|
39
|
-
- - "
|
41
|
+
- - ">"
|
40
42
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
43
|
+
version: 1.3.1
|
42
44
|
requirements: []
|
43
45
|
rubyforge_project:
|
44
46
|
rubygems_version: 2.5.1
|
45
47
|
signing_key:
|
46
48
|
specification_version: 4
|
47
|
-
summary: Write Ruby
|
49
|
+
summary: Write Ruby extension in C/C++ with NVIDIA CUDA.
|
48
50
|
test_files: []
|