module BOAST::MPPAProbe

@private

Public Instance Methods

compute() click to toggle source
# File lib/BOAST/Runtime/MPPARuntime.rb, line 40
    def compute
      get_output.print <<EOF
  mppa_mon_measure_stop(_mppa_ctx, &_mppa_report);
  _mppa_avg_pwr = 0;
  _mppa_energy = 0;
  for(_mppa_i=0; _mppa_i < _mppa_report->count; _mppa_i++){
    _mppa_avg_pwr += _mppa_report->measures[_mppa_i].avg_power;
    _mppa_energy += _mppa_report->measures[_mppa_i].total_energy;
  }
  _mppa_avg_pwr = _mppa_avg_pwr/(float) _mppa_report->count;
  _mppa_duration = _mppa_report->total_time;
  mppa_mon_measure_free_report(_mppa_report);
  mppa_mon_close(_mppa_ctx);
EOF
    end
configure() click to toggle source
# File lib/BOAST/Runtime/MPPARuntime.rb, line 31
def configure
end
decl() click to toggle source
# File lib/BOAST/Runtime/MPPARuntime.rb, line 17
    def decl
      get_output.print <<EOF
  float _mppa_avg_pwr;
  float _mppa_energy;
  float _mppa_duration;
  mppa_mon_ctx_t * _mppa_ctx;
  mppa_mon_sensor_t _mppa_pwr_sensor[] = {MPPA_MON_PWR_MPPA0};
  mppa_mon_measure_report_t * _mppa_report;
  mppa_mon_open(0, &_mppa_ctx);
  mppa_mon_measure_set_sensors(_mppa_ctx, _mppa_pwr_sensor, 1);
  mppa_mon_measure_start(_mppa_ctx);
EOF
    end
header() click to toggle source

Monitoring has to be started before transfer begin and after transfers end as we don’t have sync points in between.

# File lib/BOAST/Runtime/MPPARuntime.rb, line 10
def header
  get_output.puts "#include <mppa_mon.h>"
end
preamble() click to toggle source
# File lib/BOAST/Runtime/MPPARuntime.rb, line 14
def preamble
end
start() click to toggle source
# File lib/BOAST/Runtime/MPPARuntime.rb, line 34
def start
end
stop() click to toggle source
# File lib/BOAST/Runtime/MPPARuntime.rb, line 37
def stop
end
store() click to toggle source
# File lib/BOAST/Runtime/MPPARuntime.rb, line 56
    def store
      get_output.print <<EOF
  rb_hash_aset(_boast_stats,ID2SYM(rb_intern("mppa_avg_pwr")),rb_float_new(_mppa_avg_pwr));
  rb_hash_aset(_boast_stats,ID2SYM(rb_intern("mppa_energy")),rb_float_new(_mppa_energy));
  rb_hash_aset(_boast_stats,ID2SYM(rb_intern("mppa_duration")), rb_float_new(_mppa_duration));
EOF
    end