BOAST 2.0.2 → 2.1.0

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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/BOAST.gemspec +4 -3
  3. data/lib/BOAST.rb +1 -0
  4. data/lib/BOAST/Language/Arithmetic.rb +5 -1
  5. data/lib/BOAST/Language/BOAST_OpenCL.rb +6 -6
  6. data/lib/BOAST/Language/Case.rb +11 -11
  7. data/lib/BOAST/Language/Comment.rb +2 -2
  8. data/lib/BOAST/Language/Config.rb +5 -5
  9. data/lib/BOAST/Language/DataTypes.rb +31 -29
  10. data/lib/BOAST/Language/Expression.rb +16 -16
  11. data/lib/BOAST/Language/For.rb +6 -6
  12. data/lib/BOAST/Language/FuncCall.rb +7 -7
  13. data/lib/BOAST/Language/HighLevelOperators.rb +6 -6
  14. data/lib/BOAST/Language/If.rb +7 -7
  15. data/lib/BOAST/Language/Index.rb +31 -31
  16. data/lib/BOAST/Language/Intrinsics.rb +27 -27
  17. data/lib/BOAST/Language/OpenMP.rb +19 -19
  18. data/lib/BOAST/Language/Operators.rb +62 -50
  19. data/lib/BOAST/Language/Pragma.rb +4 -4
  20. data/lib/BOAST/Language/Procedure.rb +47 -47
  21. data/lib/BOAST/Language/Slice.rb +14 -14
  22. data/lib/BOAST/Language/State.rb +1 -1
  23. data/lib/BOAST/Language/Transitions.rb +1 -1
  24. data/lib/BOAST/Language/Variable.rb +83 -90
  25. data/lib/BOAST/Language/While.rb +4 -4
  26. data/lib/BOAST/Optimization/Optimization.rb +61 -37
  27. data/lib/BOAST/Runtime/AffinityProbe.rb +99 -15
  28. data/lib/BOAST/Runtime/CRuntime.rb +18 -6
  29. data/lib/BOAST/Runtime/CUDARuntime.rb +11 -7
  30. data/lib/BOAST/Runtime/CoExecute.rb +77 -0
  31. data/lib/BOAST/Runtime/CompiledRuntime.rb +274 -110
  32. data/lib/BOAST/Runtime/Compilers.rb +15 -15
  33. data/lib/BOAST/Runtime/Config.rb +3 -0
  34. data/lib/BOAST/Runtime/EnergyProbe.rb +86 -71
  35. data/lib/BOAST/Runtime/FFIRuntime.rb +1 -1
  36. data/lib/BOAST/Runtime/FORTRANRuntime.rb +15 -5
  37. data/lib/BOAST/Runtime/MPPARuntime.rb +30 -19
  38. data/lib/BOAST/Runtime/OpenCLRuntime.rb +2 -2
  39. data/lib/BOAST/Runtime/Probe.rb +122 -41
  40. metadata +29 -8
@@ -11,7 +11,7 @@ module BOAST
11
11
 
12
12
  def get_openmp_flags(compiler)
13
13
  openmp_flags = BOAST::get_openmp_flags[compiler]
14
- if not openmp_flags then
14
+ unless openmp_flags then
15
15
  keys = BOAST::get_openmp_flags.keys
16
16
  keys.each { |k|
17
17
  openmp_flags = BOAST::get_openmp_flags[k] if compiler.match(k)
@@ -33,7 +33,7 @@ module BOAST
33
33
  begin
34
34
  spec = Gem::Specification::find_by_name('narray')
35
35
  narray_path = spec.require_path
36
- if narray_path == "." then
36
+ unless File.exist?(narray_path+"/narray.h") then
37
37
  narray_path = spec.full_gem_path
38
38
  end
39
39
  rescue Gem::LoadError => e
@@ -42,7 +42,7 @@ module BOAST
42
42
  if spec then
43
43
  require 'narray'
44
44
  narray_path = Gem.loaded_specs['narray'].require_path
45
- if narray_path == "." then
45
+ unless File.exist?(narray_path+"/narray.h") then
46
46
  narray_path = Gem.loaded_specs['narray'].full_gem_path
47
47
  end
48
48
  end
@@ -64,7 +64,7 @@ module BOAST
64
64
  objext = RbConfig::CONFIG["OBJEXT"]
65
65
  if (options[:openmp] or options[:OPENMP]) and @lang == C and not disable_openmp then
66
66
  openmp_cflags = get_openmp_flags(c_compiler)
67
- raise "unkwown openmp flags for: #{c_compiler}" if not openmp_cflags
67
+ raise "unkwown openmp flags for: #{c_compiler}" unless openmp_cflags
68
68
  cflags += " #{openmp_cflags}"
69
69
  end
70
70
 
@@ -81,13 +81,13 @@ module BOAST
81
81
  end
82
82
 
83
83
  rule ".#{objext}io" => ".cio" do |t|
84
- c_call_string = "#{c_mppa_compiler} -mcore=k1io -mos=rtems"
84
+ c_call_string = "#{c_mppa_compiler} -mcore=k1bio -mos=rtems"
85
85
  c_call_string += " -mboard=developer -x c -c -o #{t.name} #{t.source}"
86
86
  runner.call(t, c_call_string)
87
87
  end
88
88
 
89
89
  rule ".#{objext}comp" => ".ccomp" do |t|
90
- c_call_string = "#{c_mppa_compiler} -mcore=k1dp -mos=nodeos"
90
+ c_call_string = "#{c_mppa_compiler} -mcore=k1bdp -mos=nodeos"
91
91
  c_call_string += " -mboard=developer -x c -c -o #{t.name} #{t.source}"
92
92
  runner.call(t, c_call_string)
93
93
  end
@@ -99,7 +99,7 @@ module BOAST
99
99
  cxxflags += " -fPIC #{includes}"
100
100
  if (options[:openmp] or options[:OPENMP]) and @lang == C and not disable_openmp then
101
101
  openmp_cxxflags = get_openmp_flags(cxx_compiler)
102
- raise "unkwown openmp flags for: #{cxx_compiler}" if not openmp_cxxflags
102
+ raise "unkwown openmp flags for: #{cxx_compiler}" unless openmp_cxxflags
103
103
  cxxflags += " #{openmp_cxxflags}"
104
104
  end
105
105
 
@@ -124,7 +124,7 @@ module BOAST
124
124
  fcflags += " -fno-second-underscore" if f_compiler == 'g95'
125
125
  if (options[:openmp] or options[:OPENMP]) and @lang == FORTRAN and not disable_openmp then
126
126
  openmp_fcflags = get_openmp_flags(f_compiler)
127
- raise "unkwown openmp flags for: #{f_compiler}" if not openmp_fcflags
127
+ raise "unkwown openmp flags for: #{f_compiler}" unless openmp_fcflags
128
128
  fcflags += " #{openmp_fcflags}"
129
129
  end
130
130
 
@@ -161,12 +161,12 @@ module BOAST
161
161
  linker = "k1-gcc"
162
162
 
163
163
  rule ".bincomp" => ".#{objext}comp" do |t|
164
- linker_string = "#{linker} -o #{t.name} #{t.source} -mcore=k1dp #{board} -mos=nodeos #{ldflags}"
164
+ linker_string = "#{linker} -o #{t.name} #{t.source} -mcore=k1bdp #{board} -mos=nodeos #{ldflags}"
165
165
  runner.call(t, linker_string)
166
166
  end
167
167
 
168
168
  rule ".binio" => ".#{objext}io" do |t|
169
- linker_string = "#{linker} -o #{t.name} #{t.source} -mcore=k1io #{board} -mos=rtems #{ldflags}"
169
+ linker_string = "#{linker} -o #{t.name} #{t.source} -mcore=k1bio #{board} -mos=rtems #{ldflags}"
170
170
  runner.call(t, linker_string)
171
171
  end
172
172
 
@@ -188,12 +188,12 @@ module BOAST
188
188
  ldflags += " -L/usr/local/k1tools/lib64 -lmppaipc -lpcie -lz -lelf -lmppa_multiloader" if @architecture == MPPA
189
189
  ldflags += " -lmppamon -lmppabm -lm -lmppalock" if @architecture == MPPA
190
190
  c_compiler = options[:CC]
191
- c_compiler = "cc" if not c_compiler
191
+ c_compiler = "cc" unless c_compiler
192
192
  linker = options[:LD]
193
- linker = c_compiler if not linker
193
+ linker = c_compiler unless linker
194
194
  if (options[:openmp] or options[:OPENMP]) and not disable_openmp then
195
195
  openmp_ldflags = get_openmp_flags(linker)
196
- raise "unknown openmp flags for: #{linker}" if not openmp_ldflags
196
+ raise "unknown openmp flags for: #{linker}" unless openmp_ldflags
197
197
  ldflags += " #{openmp_ldflags}"
198
198
  end
199
199
 
@@ -211,7 +211,7 @@ module BOAST
211
211
  def setup_compilers(probes, options = {})
212
212
  Rake::Task::clear
213
213
  verbose = options[:VERBOSE]
214
- verbose = get_verbose if not verbose
214
+ verbose = get_verbose unless verbose
215
215
  Rake::verbose(verbose)
216
216
  Rake::FileUtilsExt.verbose_flag=verbose
217
217
 
@@ -223,7 +223,7 @@ module BOAST
223
223
  sh call_string
224
224
  else
225
225
  status, _, stderr = systemu call_string
226
- if not status.success? then
226
+ unless status.success? then
227
227
  puts stderr
228
228
  fail "#{t.source}: compilation failed"
229
229
  end
@@ -50,6 +50,7 @@ module BOAST
50
50
  private_boolean_state_accessor :executable
51
51
  private_boolean_state_accessor :keep_temp
52
52
  private_state_accessor :fortran_line_length
53
+ private_state_accessor :synchro
53
54
  end
54
55
 
55
56
  boolean_state_accessor :verbose
@@ -59,6 +60,7 @@ module BOAST
59
60
  boolean_state_accessor :executable
60
61
  boolean_state_accessor :keep_temp
61
62
  state_accessor :fortran_line_length
63
+ state_accessor :synchro
62
64
  default_state_getter :verbose, false
63
65
  default_state_getter :debug_source, false
64
66
  default_state_getter :debug_kernel_source, false
@@ -66,6 +68,7 @@ module BOAST
66
68
  default_state_getter :executable, false
67
69
  default_state_getter :keep_temp, false
68
70
  default_state_getter :fortran_line_length, 72
71
+ default_state_getter :synchro, "MUTEX"
69
72
 
70
73
  module_function
71
74
 
@@ -6,32 +6,28 @@ module BOAST
6
6
  get_output.puts "#include <stdio.h>"
7
7
  get_output.puts "#include <stdint.h>"
8
8
  end
9
- def decl
10
- get_output.puts "char **_boast_energy_files = 0;"
11
- get_output.puts "char **_boast_energy_names = 0;"
12
- get_output.puts "uint64_t *_boast_energy_0 = 0;"
13
- get_output.puts "uint64_t *_boast_energy_1 = 0;"
14
- get_output.puts "int _boast_energy_nsensors = 0;"
15
- end
16
- def configure
9
+ def preamble
17
10
  get_output.print <<EOF
18
- {
11
+ struct _boast_powercap_param_struct {
12
+ char **files;
13
+ char **names;
14
+ uint64_t *energy_0;
15
+ uint64_t *energy_1;
16
+ int nsensors;
17
+ };
18
+
19
+ static int _boast_powercap_init(uint64_t **energy_0, uint64_t **energy_1, char ***files, char ***names);
20
+ static int _boast_powercap_init(uint64_t **energy_0, uint64_t **energy_1, char ***files, char ***names) {
21
+ int nsensors = 0;
19
22
  char buf[128];
20
23
  char path[128];
21
24
  char *s;
22
25
  FILE *f;
23
26
  int nproc;
24
27
  int i;
25
- if( _boast_energy_nsensors ){
26
- free(_boast_energy_files);
27
- for(i=0; i < _boast_energy_nsensors; ++i)
28
- free(_boast_energy_names[i]);
29
- free(_boast_energy_names);
30
- _boast_energy_nsensors = 0;
31
- }
32
- _boast_energy_files = malloc(1);
33
- _boast_energy_names = malloc(1);
34
28
 
29
+ *files = malloc(1);
30
+ *names = malloc(1);
35
31
  for(nproc = 0; ; ++nproc){
36
32
  sprintf(path,"/sys/devices/virtual/powercap/intel-rapl/intel-rapl:%d",nproc);
37
33
  sprintf(buf,"%s/energy_uj",path);
@@ -39,90 +35,105 @@ module BOAST
39
35
  if(!f)
40
36
  break;
41
37
  i = 0;
42
- do{
43
- int _boast_fread_ret;
38
+ do {
39
+ int fread_ret;
44
40
  fclose(f);
45
- ++_boast_energy_nsensors;
46
- _boast_energy_files = realloc(_boast_energy_files, _boast_energy_nsensors * sizeof(*_boast_energy_files));
47
- _boast_energy_names = realloc(_boast_energy_names, _boast_energy_nsensors * sizeof(*_boast_energy_names));
48
- _boast_energy_files[_boast_energy_nsensors-1] = malloc(128);
49
- _boast_energy_names[_boast_energy_nsensors-1] = malloc( 16);
50
- s = _boast_energy_names[_boast_energy_nsensors-1];
51
- sprintf(_boast_energy_files[_boast_energy_nsensors-1],"%s",buf);
41
+ ++nsensors;
42
+ *files = realloc(*files, nsensors * sizeof(**files));
43
+ *names = realloc(*names, nsensors * sizeof(**names));
44
+ (*files)[nsensors-1] = malloc(128);
45
+ (*names)[nsensors-1] = malloc( 16);
46
+ s = (*names)[nsensors-1];
47
+ sprintf((*files)[nsensors-1],"%s",buf);
52
48
  sprintf(buf, "%s/name", path);
53
49
  f = fopen(buf, "r");
54
- _boast_fread_ret = fread(buf, 1, sizeof(buf), f);
50
+ fread_ret = fread(buf, 1, sizeof(buf), f);
55
51
  fclose(f);
56
- if(_boast_fread_ret == 0)
52
+ if(fread_ret == 0)
57
53
  rb_raise(rb_eArgError, "Energy probe read error!");
58
54
  /* last character read is a line break */
59
- buf[_boast_fread_ret-1] = 0;
55
+ buf[fread_ret-1] = 0;
60
56
  sprintf(s, "%d.%s", nproc, buf);
61
57
 
62
58
  sprintf(path,"/sys/devices/virtual/powercap/intel-rapl/intel-rapl:%d/intel-rapl:%d:%d",nproc,nproc,i++);
63
59
  sprintf(buf,"%s/energy_uj",path);
64
60
  f = fopen(buf, "rt");
65
- }while(f);
61
+ } while(f);
66
62
  }
67
- if( ! _boast_energy_nsensors ){
68
- free( _boast_energy_files );
69
- free( _boast_energy_names );
70
- }else{
71
- _boast_energy_0 = malloc(_boast_energy_nsensors * sizeof(*_boast_energy_0));
72
- _boast_energy_1 = malloc(_boast_energy_nsensors * sizeof(*_boast_energy_1));
63
+ if( ! nsensors ) {
64
+ free( *files );
65
+ free( *names );
66
+ } else {
67
+ *energy_0 = malloc(nsensors * sizeof(**energy_0));
68
+ *energy_1 = malloc(nsensors * sizeof(**energy_1));
73
69
  }
70
+ return nsensors;
74
71
  }
75
- EOF
76
- end
77
- def start
78
- get_output.print <<EOF
79
- {
72
+
73
+ static void _boast_powercap_read(int nsensors, char **files, uint64_t *energy);
74
+ static void _boast_powercap_read(int nsensors, char **files, uint64_t *energy) {
80
75
  char buf[32];
81
76
  FILE *f;
82
77
  int i;
83
- for(i = 0; i < _boast_energy_nsensors; ++i){
84
- int _boast_fread_ret;
85
- f = fopen(_boast_energy_files[i], "r");
86
- _boast_fread_ret = fread(buf, 1, sizeof(buf), f);
78
+ for(i = 0; i < nsensors; ++i){
79
+ int fread_ret;
80
+ f = fopen(files[i], "r");
81
+ fread_ret = fread(buf, 1, sizeof(buf), f);
87
82
  fclose(f);
88
- if(_boast_fread_ret == 0)
83
+ if(fread_ret == 0) {
89
84
  rb_raise(rb_eArgError, "Energy probe read error!");
90
- _boast_energy_0[i] = atoll(buf);
85
+ }
86
+ energy[i] = atoll(buf);
91
87
  }
92
88
  }
89
+
90
+ static void _boast_powercap_store_and_clean( int nsensors, uint64_t *energy_0, uint64_t *energy_1, char **files, char **names, VALUE _boast_stats);
91
+ static void _boast_powercap_store_and_clean( int nsensors, uint64_t *energy_0, uint64_t *energy_1, char **files, char **names, VALUE _boast_stats) {
92
+ VALUE results;
93
+ int i;
94
+ if( nsensors ) {
95
+ results = rb_hash_new();
96
+ for(i=0; i < nsensors; ++i){
97
+ rb_hash_aset(results, ID2SYM(rb_intern(names[i])), rb_float_new((energy_1[i] - energy_0[i]) * 1e-6));
98
+ }
99
+ rb_hash_aset(_boast_stats, ID2SYM(rb_intern("energy")), results);
100
+
101
+ free(energy_0);
102
+ free(energy_1);
103
+ for(i=0; i < nsensors; ++i){
104
+ free(files[i]);
105
+ free(names[i]);
106
+ }
107
+ free(files);
108
+ free(names);
109
+ }
110
+ }
111
+
112
+ EOF
113
+ end
114
+ def decl
115
+ get_output.puts " struct _boast_powercap_param_struct _boast_powercap_params = {0,0,0,0,0};"
116
+ end
117
+ def configure
118
+ get_output.print <<EOF
119
+ _boast_powercap_params.nsensors = _boast_powercap_init(&_boast_powercap_params.energy_0, &_boast_powercap_params.energy_1, &_boast_powercap_params.files, &_boast_powercap_params.names);
120
+ EOF
121
+ end
122
+ def start
123
+ get_output.print <<EOF
124
+ _boast_powercap_read(_boast_powercap_params.nsensors, _boast_powercap_params.files, _boast_powercap_params.energy_0);
93
125
  EOF
94
126
  end
95
127
  def stop
96
128
  get_output.print <<EOF
97
- {
98
- char buf[32];
99
- FILE *f;
100
- int i;
101
- for(i = 0; i < _boast_energy_nsensors; ++i){
102
- int _boast_fread_ret;
103
- f = fopen(_boast_energy_files[i], "r");
104
- _boast_fread_ret = fread(buf, 1, sizeof(buf), f);
105
- fclose(f);
106
- if(_boast_fread_ret == 0)
107
- rb_raise(rb_eArgError, "Energy probe read error!");
108
- _boast_energy_1[i] = atoll(buf);
109
- }
110
- }
129
+ _boast_powercap_read(_boast_powercap_params.nsensors, _boast_powercap_params.files, _boast_powercap_params.energy_1);
111
130
  EOF
112
131
  end
113
132
  def compute
114
133
  end
115
134
  def store
116
135
  get_output.print <<EOF
117
- {
118
- VALUE results;
119
- int i;
120
- results = rb_hash_new();
121
- for(i=0; i < _boast_energy_nsensors; ++i){
122
- rb_hash_aset(results, ID2SYM(rb_intern(_boast_energy_names[i])), rb_float_new((_boast_energy_1[i] - _boast_energy_0[i]) * 1e-6));
123
- }
124
- rb_hash_aset(_boast_stats, ID2SYM(rb_intern("energy")), results);
125
- }
136
+ _boast_powercap_store_and_clean( _boast_powercap_params.nsensors, _boast_powercap_params.energy_0, _boast_powercap_params.energy_1, _boast_powercap_params.files, _boast_powercap_params.names, _boast_stats);
126
137
  EOF
127
138
  end
128
139
  def is_available?
@@ -136,6 +147,8 @@ EOF
136
147
  def header
137
148
  get_output.puts "#include <redfst.h>"
138
149
  end
150
+ def preamble
151
+ end
139
152
  def decl
140
153
  get_output.puts "redfst_dev_t *_boast_energy=0;"
141
154
  end
@@ -202,6 +215,8 @@ EOF
202
215
  def header
203
216
  get_output.puts "#include <eml.h>"
204
217
  end
218
+ def preamble
219
+ end
205
220
  def decl
206
221
  get_output.puts "emlData_t **_boast_energy=0;";
207
222
  get_output.puts "size_t _boast_energy_count=0;";
@@ -111,7 +111,7 @@ EOF
111
111
  ev_set.destroy
112
112
  end
113
113
  end
114
- results = { :start => start, :stop => stop, :duration => stop - start, :return => ret }
114
+ results = { :start => start, :end => stop, :duration => stop - start, :return => ret }
115
115
  results[:PAPI] = Hash[[options[:PAPI]].flatten.zip(counters)] if ev_set
116
116
  if r_args.length > 0 then
117
117
  ref_return = {}
@@ -44,16 +44,26 @@ module BOAST
44
44
  end
45
45
  end
46
46
 
47
+ def create_procedure_indirect_call_parameters
48
+ return @procedure.parameters.collect { |param|
49
+ par = "#{param_struct.struct_reference(param_struct.type.members[param.name.to_s])}".gsub("_boast_params.","_boast_params->")
50
+ if param.dimension then
51
+ "#{par}"
52
+ else
53
+ "&#{par}"
54
+ end
55
+ }
56
+ end
57
+
47
58
  def create_procedure_call_parameters
48
- params = []
49
- @procedure.parameters.each { |param|
59
+ return @procedure.parameters.collect { |param|
60
+ par = param_struct.struct_reference(param_struct.type.members[param.name.to_s])
50
61
  if param.dimension then
51
- params.push( param.name )
62
+ "#{par}"
52
63
  else
53
- params.push( "&"+param.name )
64
+ "&#{par}"
54
65
  end
55
66
  }
56
- return params
57
67
  end
58
68
 
59
69
  end
@@ -11,6 +11,9 @@ module BOAST
11
11
  get_output.puts "#include <mppa_mon.h>"
12
12
  end
13
13
 
14
+ def preamble
15
+ end
16
+
14
17
  def decl
15
18
  get_output.print <<EOF
16
19
  float _mppa_avg_pwr;
@@ -47,6 +50,11 @@ EOF
47
50
  _mppa_duration = _mppa_report->total_time;
48
51
  mppa_mon_measure_free_report(_mppa_report);
49
52
  mppa_mon_close(_mppa_ctx);
53
+ EOF
54
+ end
55
+
56
+ def store
57
+ get_output.print <<EOF
50
58
  rb_hash_aset(_boast_stats,ID2SYM(rb_intern("mppa_avg_pwr")),rb_float_new(_mppa_avg_pwr));
51
59
  rb_hash_aset(_boast_stats,ID2SYM(rb_intern("mppa_energy")),rb_float_new(_mppa_energy));
52
60
  rb_hash_aset(_boast_stats,ID2SYM(rb_intern("mppa_duration")), rb_float_new(_mppa_duration));
@@ -111,7 +119,7 @@ EOF
111
119
  end
112
120
 
113
121
  def set_io
114
- set_output(@code_io)
122
+ set_output(@code)
115
123
  end
116
124
 
117
125
  def set_comp
@@ -151,8 +159,8 @@ EOF
151
159
  f.close
152
160
  end
153
161
 
154
- def create_targets( linker, ldshared, ldflags, kernel_files )
155
- create_targets_old( linker, ldshared, ldflags, kernel_files )
162
+ def create_targets( linker, ldshared, ldshared_flags, ldflags, kernel_files )
163
+ create_targets_old( linker, ldshared, ldshared_flags, ldflags, kernel_files )
156
164
  file multibinary_path => [io_bin, comp_bin] do
157
165
  sh "k1-create-multibinary --clusters #{comp_bin} --clusters-names \"comp-part\" --boot #{io_bin} --bootname \"io-part\" -T #{multibinary_path}"
158
166
  end
@@ -392,7 +400,7 @@ EOF
392
400
  EOF
393
401
  end
394
402
 
395
- def copy_array_param_from_ruby( param, ruby_param )
403
+ def copy_array_param_from_ruby(par, param, ruby_param )
396
404
  rb_ptr = Variable::new("_boast_rb_ptr", CustomType, :type_name => "VALUE")
397
405
  (rb_ptr === ruby_param).pr
398
406
  get_output.print <<EOF
@@ -402,23 +410,23 @@ EOF
402
410
  Data_Get_Struct(_boast_rb_ptr, struct NARRAY, _boast_n_ary);
403
411
  _boast_array_size = _boast_n_ary->total * na_sizeof[_boast_n_ary->type];
404
412
  mppa_write(_mppa_fd_size, &_boast_array_size, sizeof(_boast_array_size));
405
- #{param} = (void *) _boast_n_ary->ptr;
406
- mppa_write(_mppa_fd_var, #{param}, _boast_array_size);
413
+ #{par} = (void *) _boast_n_ary->ptr;
414
+ mppa_write(_mppa_fd_var, #{par}, _boast_array_size);
407
415
  } else {
408
416
  rb_raise(rb_eArgError, "Wrong type of argument for %s, expecting array!", "#{param}");
409
417
  }
410
418
  EOF
411
419
  end
412
420
 
413
- def copy_scalar_param_from_ruby( param, ruby_param )
421
+ def copy_scalar_param_from_ruby(par, param, ruby_param )
414
422
  case param.type
415
423
  when Int
416
- (param === FuncCall::new("NUM2INT", ruby_param)).pr if param.type.size == 4
417
- (param === FuncCall::new("NUM2LONG", ruby_param)).pr if param.type.size == 8
424
+ (par === FuncCall::new("NUM2INT", ruby_param)).pr if param.type.size == 4
425
+ (par === FuncCall::new("NUM2LONG", ruby_param)).pr if param.type.size == 8
418
426
  when Real
419
- (param === FuncCall::new("NUM2DBL", ruby_param)).pr
427
+ (par === FuncCall::new("NUM2DBL", ruby_param)).pr
420
428
  end
421
- get_output.puts " mppa_write(_mppa_fd_var, &#{param}, sizeof(#{param}));"
429
+ get_output.puts " mppa_write(_mppa_fd_var, &#{par}, sizeof(#{par}));"
422
430
  end
423
431
 
424
432
  def get_params_value
@@ -460,7 +468,7 @@ EOF
460
468
  def create_procedure_call
461
469
  end
462
470
 
463
- def copy_array_param_to_ruby(param, ruby_param)
471
+ def copy_array_param_to_ruby(par, param, ruby_param)
464
472
  rb_ptr = Variable::new("_boast_rb_ptr", CustomType, :type_name => "VALUE")
465
473
  (rb_ptr === ruby_param).pr
466
474
  get_output.print <<EOF
@@ -472,7 +480,7 @@ EOF
472
480
  size_t _boast_array_size;
473
481
  Data_Get_Struct(_boast_rb_ptr, struct NARRAY, _boast_n_ary);
474
482
  _boast_array_size = _boast_n_ary->total * na_sizeof[_boast_n_ary->type];
475
- mppa_read(_mppa_fd_var, #{param}, _boast_array_size);
483
+ mppa_read(_mppa_fd_var, #{par}, _boast_array_size);
476
484
  EOF
477
485
  end
478
486
  get_output.print <<EOF
@@ -482,17 +490,20 @@ EOF
482
490
  EOF
483
491
  end
484
492
 
485
- def copy_scalar_param_to_ruby(param, ruby_param)
493
+ def copy_scalar_param_to_ruby(par, param, ruby_param)
486
494
  if param.scalar_output? then
487
495
  get_output.print <<EOF
488
- mppa_read(_mppa_fd_var, &#{param}, sizeof(#{param}));
496
+ mppa_read(_mppa_fd_var, &#{par}, sizeof(#{par}));
489
497
  EOF
490
498
  case param.type
491
499
  when Int
492
- get_output.puts " rb_hash_aset(_boast_refs, ID2SYM(rb_intern(\"#{param}\")),rb_int_new((long long)#{param}));" if param.type.signed?
493
- get_output.puts " rb_hash_aset(_boast_refs, ID2SYM(rb_intern(\"#{param}\")),rb_int_new((unsigned long long)#{param}));" if not param.type.signed?
500
+ if param.type.signed? then
501
+ get_output.puts " rb_hash_aset(_boast_refs, ID2SYM(rb_intern(\"#{param}\")),rb_int_new((long long)#{par}));"
502
+ else
503
+ get_output.puts " rb_hash_aset(_boast_refs, ID2SYM(rb_intern(\"#{param}\")),rb_int_new((unsigned long long)#{par}));"
504
+ end
494
505
  when Real
495
- get_output.puts " rb_hash_aset(_boast_refs, ID2SYM(rb_intern(\"#{param}\")),rb_float_new((double)#{param}));"
506
+ get_output.puts " rb_hash_aset(_boast_refs, ID2SYM(rb_intern(\"#{param}\")),rb_float_new((double)#{par}));"
496
507
  end
497
508
  end
498
509
  end
@@ -502,7 +513,7 @@ EOF
502
513
  _mppa_fd_var = mppa_open(\"/mppa/buffer/host#4/board0#mppa0#pcie0#4\", O_RDONLY);
503
514
  EOF
504
515
  get_results_old
505
- get_output.puts " mppa_read(_mppa_fd_var, &_boast_ret, sizeof(_boast_ret));" if @procedure.properties[:return]
516
+ get_output.puts " mppa_read(_mppa_fd_var, &_boast_params._boast_ret, sizeof(_boast_params._boast_ret));" if @procedure.properties[:return]
506
517
  get_output.puts " mppa_read(_mppa_fd_var, &_boast_duration, sizeof(_boast_duration));"
507
518
  get_output.print <<EOF
508
519
  mppa_close(_mppa_fd_var);