BOAST 1.0.5 → 1.0.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 +4 -4
- data/BOAST.gemspec +2 -1
- data/lib/BOAST/Language/Algorithm.rb +3 -0
- data/lib/BOAST/Language/Procedure.rb +6 -0
- data/lib/BOAST/Language/Variable.rb +56 -0
- data/lib/BOAST/Runtime/CKernel.rb +1 -1
- data/lib/BOAST/Runtime/CRuntime.rb +1 -0
- data/lib/BOAST/Runtime/CompiledRuntime.rb +27 -0
- data/lib/BOAST/Runtime/Config.rb +1 -0
- data/lib/BOAST/Runtime/MAQAO.rb +28 -0
- data/lib/BOAST/Runtime/MPPARuntime.rb +12 -0
- data/lib/BOAST.rb +1 -0
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c85b9d3cf15ddaa43c8772daa563fc77ffa0e2d8
|
4
|
+
data.tar.gz: 2c3f92c1b64383ef09e28333f882bbeb2f717ee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c48d0c7349a97e7d2ffb7a632e21d01e7af48d69009dbf635d95ba81d22aa76b24321b2d9bf0da83da77d114ccf11dae5272084334bd3aa76a633d339b37fe60
|
7
|
+
data.tar.gz: 12fa72007ca814bff99b9a0e3593113fde333f66a6194b7b853164c8e3e7fa47f9705095e75c37303ee9f60dbaf16eb74a1649be3e46c5889cc9007b5a7f8f1b
|
data/BOAST.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'BOAST'
|
3
|
-
s.version = "1.0.
|
3
|
+
s.version = "1.0.6"
|
4
4
|
s.author = "Brice Videau"
|
5
5
|
s.email = "brice.videau@imag.fr"
|
6
6
|
s.homepage = "https://github.com/Nanosim-LIG/boast"
|
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.license = 'BSD'
|
12
12
|
s.required_ruby_version = '>= 1.9.3'
|
13
13
|
s.add_dependency 'narray', '~> 0.6.0', '>=0.6.0.8'
|
14
|
+
s.add_dependency 'narray_ffi', '~> 1.2', '>=1.2.0'
|
14
15
|
s.add_dependency 'opencl_ruby_ffi', '~> 1.0', '>=1.0.0'
|
15
16
|
s.add_dependency 'systemu', '~> 2', '>=2.2.0'
|
16
17
|
s.add_dependency 'os', '~> 0.9', '>=0.9.6'
|
@@ -14,6 +14,7 @@ module BOAST
|
|
14
14
|
|
15
15
|
private_state_accessor :output, :lang, :architecture
|
16
16
|
private_state_accessor :default_int_size, :default_real_size
|
17
|
+
private_state_accessor :default_align
|
17
18
|
private_state_accessor :array_start
|
18
19
|
private_state_accessor :indent_level, :indent_increment
|
19
20
|
|
@@ -49,6 +50,7 @@ module BOAST
|
|
49
50
|
|
50
51
|
state_accessor :output, :lang, :architecture
|
51
52
|
state_accessor :default_int_size, :default_real_size
|
53
|
+
state_accessor :default_align
|
52
54
|
state_accessor :array_start
|
53
55
|
state_accessor :indent_level, :indent_increment
|
54
56
|
|
@@ -85,6 +87,7 @@ module BOAST
|
|
85
87
|
@@default_int_size = 4
|
86
88
|
@@default_int_signed = true
|
87
89
|
@@default_real_size = 8
|
90
|
+
@@default_align = 1
|
88
91
|
@@indent_level = 0
|
89
92
|
@@indent_increment = 2
|
90
93
|
@@array_start = 1
|
@@ -207,6 +207,11 @@ module BOAST
|
|
207
207
|
constants.each { |c|
|
208
208
|
c.decl
|
209
209
|
}
|
210
|
+
if lang == C then
|
211
|
+
parameters.each { |p|
|
212
|
+
p.align
|
213
|
+
}
|
214
|
+
end
|
210
215
|
return self
|
211
216
|
end
|
212
217
|
|
@@ -221,6 +226,7 @@ module BOAST
|
|
221
226
|
}
|
222
227
|
parameters.each { |p|
|
223
228
|
p.decl
|
229
|
+
p.align
|
224
230
|
}
|
225
231
|
return self
|
226
232
|
end
|
@@ -137,6 +137,7 @@ module BOAST
|
|
137
137
|
attr_reader :texture
|
138
138
|
attr_reader :sampler
|
139
139
|
attr_reader :restrict
|
140
|
+
attr_reader :align
|
140
141
|
attr_accessor :replace_constant
|
141
142
|
attr_accessor :force_replace_constant
|
142
143
|
|
@@ -176,6 +177,10 @@ module BOAST
|
|
176
177
|
!!@scalar_output
|
177
178
|
end
|
178
179
|
|
180
|
+
def align?
|
181
|
+
!!@align
|
182
|
+
end
|
183
|
+
|
179
184
|
def initialize(name,type,hash={})
|
180
185
|
@name = name.to_s
|
181
186
|
@direction = hash[:direction] ? hash[:direction] : hash[:dir]
|
@@ -185,6 +190,7 @@ module BOAST
|
|
185
190
|
@texture = hash[:texture]
|
186
191
|
@allocate = hash[:allocate]
|
187
192
|
@restrict = hash[:restrict]
|
193
|
+
@align = hash[:align]
|
188
194
|
@force_replace_constant = false
|
189
195
|
if not hash[:replace_constant].nil? then
|
190
196
|
@replace_constant = hash[:replace_constant]
|
@@ -352,6 +358,11 @@ module BOAST
|
|
352
358
|
s +=")]"
|
353
359
|
end
|
354
360
|
end
|
361
|
+
if dimension? and (align? or default_align > 1) and (constant? or allocate?) then
|
362
|
+
a = ( align? ? align : 1 )
|
363
|
+
a = ( a >= default_align ? a : default_align )
|
364
|
+
s+= " __attribute((aligned(#{a})))"
|
365
|
+
end
|
355
366
|
s += " = #{@constant}" if constant?
|
356
367
|
return s
|
357
368
|
end
|
@@ -388,6 +399,42 @@ module BOAST
|
|
388
399
|
return self
|
389
400
|
end
|
390
401
|
|
402
|
+
def align_c_s(a)
|
403
|
+
return "__assume_aligned(#{@name}, #{a})"
|
404
|
+
end
|
405
|
+
|
406
|
+
def align_c(a)
|
407
|
+
s = ""
|
408
|
+
s += indent
|
409
|
+
s += align_c_s(a)
|
410
|
+
s += finalize
|
411
|
+
output.print s
|
412
|
+
return self
|
413
|
+
end
|
414
|
+
|
415
|
+
def align_fortran_s(a)
|
416
|
+
return "!DIR$ ASSUME_ALIGNED #{@name}: #{a}"
|
417
|
+
end
|
418
|
+
|
419
|
+
def align_fortran(a)
|
420
|
+
s = ""
|
421
|
+
s += indent
|
422
|
+
s += align_fortran_s(a)
|
423
|
+
s += finalize
|
424
|
+
output.print s
|
425
|
+
return self
|
426
|
+
end
|
427
|
+
|
428
|
+
def align
|
429
|
+
if dimension? then
|
430
|
+
if align? or default_align > 1 then
|
431
|
+
a = ( align? ? align : 1 )
|
432
|
+
a = ( a >= default_align ? a : default_align )
|
433
|
+
return align_c(a) if lang == C
|
434
|
+
return align_fortran(a) if lang == FORTRAN
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
391
438
|
|
392
439
|
def decl_fortran
|
393
440
|
s = ""
|
@@ -414,6 +461,15 @@ module BOAST
|
|
414
461
|
end
|
415
462
|
s += finalize
|
416
463
|
output.print s
|
464
|
+
if dimension? and (align? or default_align > 1) and (constant? or allocate?) then
|
465
|
+
a = ( align? ? align : 1 )
|
466
|
+
a = ( a >= default_align ? a : default_align )
|
467
|
+
s = ""
|
468
|
+
s += indent
|
469
|
+
s += "!DIR$ ATTRIBUTES ALIGN: #{a}:: #{name}"
|
470
|
+
s += finalize
|
471
|
+
output.print s
|
472
|
+
end
|
417
473
|
return self
|
418
474
|
end
|
419
475
|
|
@@ -5,6 +5,7 @@ module BOAST
|
|
5
5
|
|
6
6
|
def fill_library_header
|
7
7
|
get_output.puts "#include <inttypes.h>"
|
8
|
+
get_output.puts "#define __assume_aligned(lvalueptr, align) lvalueptr = __builtin_assume_aligned (lvalueptr, align)" if @compiler_options[:CC].match("gcc")
|
8
9
|
end
|
9
10
|
|
10
11
|
def fill_library_source
|
@@ -31,6 +31,9 @@ end
|
|
31
31
|
module BOAST
|
32
32
|
|
33
33
|
module CompiledRuntime
|
34
|
+
attr_accessor :binary
|
35
|
+
attr_accessor :source
|
36
|
+
|
34
37
|
@@extensions = {
|
35
38
|
C => ".c",
|
36
39
|
CUDA => ".cu",
|
@@ -100,6 +103,13 @@ module BOAST
|
|
100
103
|
f.close
|
101
104
|
end
|
102
105
|
|
106
|
+
def save_source
|
107
|
+
f = File::open(library_source,"r")
|
108
|
+
@source = StringIO::new
|
109
|
+
@source.write( f.read )
|
110
|
+
f.close
|
111
|
+
end
|
112
|
+
|
103
113
|
def create_targets( linker, ldshared, ldflags, kernel_files)
|
104
114
|
file target => target_depends do
|
105
115
|
#puts "#{linker} #{ldshared} -o #{target} #{target_depends.join(" ")} #{(kernel_files.collect {|f| f.path}).join(" ")} #{ldflags}"
|
@@ -373,6 +383,7 @@ EOF
|
|
373
383
|
compiler_options = BOAST::get_compiler_options
|
374
384
|
compiler_options.update(options)
|
375
385
|
linker, ldshared, ldflags = setup_compilers(compiler_options)
|
386
|
+
@compiler_options = compiler_options
|
376
387
|
|
377
388
|
@marker = Tempfile::new([@procedure.name,""])
|
378
389
|
|
@@ -380,6 +391,8 @@ EOF
|
|
380
391
|
|
381
392
|
create_sources
|
382
393
|
|
394
|
+
save_source
|
395
|
+
|
383
396
|
create_targets(linker, ldshared, ldflags, kernel_files)
|
384
397
|
|
385
398
|
save_binary
|
@@ -393,6 +406,20 @@ EOF
|
|
393
406
|
return self
|
394
407
|
end
|
395
408
|
|
409
|
+
def dump_binary
|
410
|
+
f = File::open(library_object,"wb")
|
411
|
+
@binary.rewind
|
412
|
+
f.write( @binary.read )
|
413
|
+
f.close
|
414
|
+
end
|
415
|
+
|
416
|
+
def dump_source
|
417
|
+
f = File::open(library_source,"wb")
|
418
|
+
@source.rewind
|
419
|
+
f.write( @source.read )
|
420
|
+
f.close
|
421
|
+
end
|
422
|
+
|
396
423
|
end
|
397
424
|
|
398
425
|
end
|
data/lib/BOAST/Runtime/Config.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
module BOAST
|
2
|
+
|
3
|
+
module CompiledRuntime
|
4
|
+
def maqao_analysis(options={})
|
5
|
+
compiler_options = BOAST::get_compiler_options
|
6
|
+
compiler_options.update(options)
|
7
|
+
|
8
|
+
f1 = File::open(library_object,"wb")
|
9
|
+
@binary.rewind
|
10
|
+
f1.write( @binary.read )
|
11
|
+
f1.close
|
12
|
+
|
13
|
+
f2 = File::open(library_source,"wb")
|
14
|
+
@source.rewind
|
15
|
+
f2.write( @source.read )
|
16
|
+
f2.close
|
17
|
+
|
18
|
+
if verbose? then
|
19
|
+
puts "#{compiler_options[:MAQAO]} cqa #{f1.path} --fct=#{@procedure.name}"
|
20
|
+
end
|
21
|
+
result = `#{compiler_options[:MAQAO]} cqa #{f1.path} --fct=#{@procedure.name}`
|
22
|
+
File::unlink(library_object)
|
23
|
+
File::unlink(library_source)
|
24
|
+
return result
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -120,8 +120,20 @@ EOF
|
|
120
120
|
attr_accessor :code_comp
|
121
121
|
attr_accessor :procedure_comp
|
122
122
|
attr_accessor :binary_comp
|
123
|
+
attr_accessor :source_comp
|
123
124
|
attr_accessor :multibinary
|
124
125
|
|
126
|
+
def save_source
|
127
|
+
f = File::open(io_source, "r")
|
128
|
+
@source = StringIO::new
|
129
|
+
@source.write( f.read )
|
130
|
+
f.close
|
131
|
+
f = File::open(comp_source, "r")
|
132
|
+
@source_comp = StringIO::new
|
133
|
+
@source_comp.write( f.read )
|
134
|
+
f.close
|
135
|
+
end
|
136
|
+
|
125
137
|
def save_binary
|
126
138
|
f = File::open(io_object,"rb")
|
127
139
|
@binary = StringIO::new
|
data/lib/BOAST.rb
CHANGED
@@ -24,6 +24,7 @@ require 'BOAST/Runtime/Probe.rb'
|
|
24
24
|
require 'BOAST/Runtime/Compilers.rb'
|
25
25
|
require 'BOAST/Runtime/OpenCLRuntime.rb'
|
26
26
|
require 'BOAST/Runtime/CompiledRuntime.rb'
|
27
|
+
require 'BOAST/Runtime/MAQAO.rb'
|
27
28
|
require 'BOAST/Runtime/CRuntime.rb'
|
28
29
|
require 'BOAST/Runtime/CUDARuntime.rb'
|
29
30
|
require 'BOAST/Runtime/FORTRANRuntime.rb'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: BOAST
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice Videau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: narray
|
@@ -30,6 +30,26 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.6.0.8
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: narray_ffi
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.2'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.2.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.2'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.2.0
|
33
53
|
- !ruby/object:Gem::Dependency
|
34
54
|
name: opencl_ruby_ffi
|
35
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,6 +208,7 @@ files:
|
|
188
208
|
- lib/BOAST/Runtime/Config.rb
|
189
209
|
- lib/BOAST/Runtime/FFIRuntime.rb
|
190
210
|
- lib/BOAST/Runtime/FORTRANRuntime.rb
|
211
|
+
- lib/BOAST/Runtime/MAQAO.rb
|
191
212
|
- lib/BOAST/Runtime/MPPARuntime.rb
|
192
213
|
- lib/BOAST/Runtime/NonRegression.rb
|
193
214
|
- lib/BOAST/Runtime/OpenCLRuntime.rb
|