BOAST 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12d3019064fc0609d6be8218867a2e5f96d36be8
4
- data.tar.gz: 7c461ebad9ad23314f8fc531d89a680008422828
3
+ metadata.gz: 53cb9d1326b52f2ff8125f0e5a3e3c7423f4ccc1
4
+ data.tar.gz: 4f945e013c4b177f9a86363ad0896e84a7bc5dc4
5
5
  SHA512:
6
- metadata.gz: c92be2673de5ac581c069c91641beb11327bbf64c406b1af262c78c942763395c3f28b256b6cc395fdee83841e8e90688d4eff114fb22238cb8d451b47c08385
7
- data.tar.gz: 496596256bb9a9ab2f29257001327a40a49484c2c8bc0d965f6d4c66a1634c2b95ca2c5bff6b121b4f2cb705a0a77f291cb0489d11b30fafdbae7886a10584ad
6
+ metadata.gz: f5f93853b1709fbddce9fa34316a05e8314c9f3716ac3adb6da40dc64b36be806af8ce3542ad565e80aeb0edb5205312a80b19af110ee4156ffd337c15f6f9f9
7
+ data.tar.gz: ead3cd7fcebd87cfd9e088003b3155e44e807be24f4706f92ce7519a7717f8681877db8da6a90c09c0cd60a48a99bdd4c75c83ba2daa0dbe2fe43915cb363012
data/BOAST.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'BOAST'
3
- s.version = "2.0.1"
3
+ s.version = "2.0.2"
4
4
  s.author = "Brice Videau"
5
5
  s.email = "brice.videau@imag.fr"
6
6
  s.homepage = "https://github.com/Nanosim-LIG/boast"
@@ -2,6 +2,12 @@ module BOAST
2
2
 
3
3
  module_function
4
4
 
5
+ class Empty
6
+ def self.empty_binding
7
+ return binding
8
+ end
9
+ end
10
+
5
11
  # @!parse module Functors; functorize Expression; end
6
12
  class Expression
7
13
  include PrivateStateAccessor
@@ -48,13 +48,13 @@ module BOAST
48
48
  def to_s_fortran
49
49
  s = ""
50
50
  s += @prefix if @prefix
51
- s += "#{func_name}(#{@args.join(", ")})"
51
+ s += "#{func_name}(#{@args.collect(&:to_s).join(", ")})"
52
52
  end
53
53
 
54
54
  def to_s_c
55
55
  s = ""
56
56
  s += @prefix if @prefix
57
- s += "#{func_name}(#{@args.join(", ")})"
57
+ s += "#{func_name}(#{@args.collect(&:to_s).join(", ")})"
58
58
  end
59
59
 
60
60
  private :to_s_fortran, :to_s_c
@@ -69,7 +69,7 @@ module BOAST
69
69
  dim = dims[indx]
70
70
  s = "#{indxs[indx]}"
71
71
  s += " - (#{dim.start})" unless 0.equal?(dim.start)
72
- ind = eval(s)
72
+ ind = Empty.empty_binding.eval(s)
73
73
  ind = ind.to_i
74
74
  const = const[ind]
75
75
  }
@@ -32,7 +32,7 @@ EOF
32
32
  EOF
33
33
  when :option_list
34
34
  s += <<EOF
35
- return " (\#{[c].flatten.join(", ")})"
35
+ return " (\#{[c].flatten.collect(&:to_s).join(", ")})"
36
36
  EOF
37
37
  when :simple
38
38
  s += <<EOF
@@ -40,13 +40,13 @@ EOF
40
40
  EOF
41
41
  when :list
42
42
  s += <<EOF
43
- return " #{name}(\#{[c].flatten.join(", ")})"
43
+ return " #{name}(\#{[c].flatten.collect(&:to_s).join(", ")})"
44
44
  EOF
45
45
  when :multilist
46
46
  s += <<EOF
47
47
  s = ""
48
48
  c.each { |id, list|
49
- s += " #{name}(\#{id}: \#{[list].flatten.join(", ")})"
49
+ s += " #{name}(\#{id}: \#{[list].flatten.collect(&:to_s).join(", ")})"
50
50
  }
51
51
  return s
52
52
  EOF
@@ -159,12 +159,12 @@ module BOAST
159
159
  return copy(name+"."+m.to_s, :vector_length => m.to_s[1..-1].length) if lang == CL
160
160
  return copy("#{name}(#{existing_set.index(required_set[0])+1})", :vector_length => 1) if lang == FORTRAN
161
161
  return copy("#{name}[#{existing_set.index(required_set[0])}]", :vector_length => 1) if lang == C
162
- super
162
+ return super
163
163
  else
164
- super
164
+ return super
165
165
  end
166
166
  else
167
- super
167
+ return super
168
168
  end
169
169
  end
170
170
 
@@ -393,9 +393,7 @@ module BOAST
393
393
  s += " #{@name}"
394
394
  if dimension? and use_vla? and lang != FORTRAN then
395
395
  s += "["
396
- s += @dimension.reverse.collect { |d|
397
- d.to_s
398
- }.join("][")
396
+ s += @dimension.reverse.collect(&:to_s).join("][")
399
397
  s += "]"
400
398
  end
401
399
  return s
@@ -501,9 +499,7 @@ module BOAST
501
499
  if __vla_array? then
502
500
  s += " #{@name}["
503
501
  s += "__restrict__ " if __restrict?
504
- s += @dimension.reverse.collect { |d|
505
- d.to_s
506
- }.join("][")
502
+ s += @dimension.reverse.collect(&:to_s).join("][")
507
503
  s += "]"
508
504
  else
509
505
  s += " *" if __pointer?(device)
@@ -520,7 +516,7 @@ module BOAST
520
516
  end
521
517
  if __dimension?(device) then
522
518
  s +="[("
523
- s += @dimension.collect{ |d| d.to_s }.reverse.join(")*(")
519
+ s += @dimension.collect(&:to_s).reverse.join(")*(")
524
520
  s +=")]"
525
521
  end
526
522
  end
@@ -579,7 +575,7 @@ module BOAST
579
575
  end
580
576
 
581
577
  def alloc_c( dims, align = get_address_size)
582
- ds = dims.collect { |d| d.to_s }.reverse.join(")*(")
578
+ ds = dims.collect(&:to_s).reverse.join(")*(")
583
579
  if align > (OS.bits/8) then
584
580
  # check alignment is a power of 2
585
581
  raise "Invalid alignment #{align}!" if align & (align - 1) != 0
@@ -25,6 +25,9 @@ module BOAST
25
25
  next
26
26
  end
27
27
  if param.dimension then
28
+ outputs[indx].each { |elem|
29
+ raise "Error! #{elem}" if elem.nan?
30
+ }
28
31
  diff = (outputs[indx] - ref_outputs[indx]).abs
29
32
  if epsilon then
30
33
  diff.each { |elem|
@@ -33,6 +36,7 @@ module BOAST
33
36
  end
34
37
  res[param.name] = diff.max
35
38
  else
39
+ raise "Error: #{param.name} is NaN!" if outputs[indx].nan?
36
40
  raise "Error: #{param.name} different from ref: #{outputs[indx]} != #{ref_outputs[indx]} !" if epsilon and (outputs[indx] - ref_outputs[indx]).abs > epsilon
37
41
  res[param.name] = (outputs[indx] - ref_outputs[indx]).abs
38
42
  end
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: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Videau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-07 00:00:00.000000000 Z
11
+ date: 2017-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: narray