class ServerScripts::Parser::ITAC
Attributes
ideal_itac_fname[R]
real_itac_fname[RW]
Public Class Methods
new(itac_file) { |self| ... }
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 7 def initialize itac_file check_for_traceanalyzer @real_itac_fname = itac_file @ideal_itac_fname = "#{@real_itac_fname}.ideal.single.stf" @real_function_profile = nil @ideal_function_profile = nil yield self if block_given? end
Public Instance Methods
analyze_function_profiles!()
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 30 def analyze_function_profiles! unless @real_function_profile @real_function_profile = `traceanalyzer --cli --functionprofile #{@real_itac_fname}` @real_function_profile = @real_function_profile.split("\n") end unless @ideal_function_profile @ideal_function_profile = `traceanalyzer --cli --functionprofile #{@ideal_itac_fname}` @ideal_function_profile = @ideal_function_profile.split("\n") end end
event_time(event, kind: :real, how: :all_procs)
click to toggle source
Get event time for a particular event. Specify whether from ideal trace or real trace.
# File lib/server_scripts/parser/itac.rb, line 65 def event_time(event, kind: :real, how: :all_procs) if kind == :real parse_real_event_time(event, how: how) elsif kind == :ideal parse_ideal_event_time(event, how: how) else raise ArgumentError, "kind argument should be either :real or :ideal, not #{kind}." end end
generate_ideal_trace!()
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 23 def generate_ideal_trace! unless File.file?(@ideal_itac_fname) Kernel.system( "traceanalyzer --cli --ideal -u -o #{@ideal_itac_fname} #{@real_itac_fname}") end end
ideal_mpi_time()
click to toggle source
Ideal MPI time. Only wait time.
# File lib/server_scripts/parser/itac.rb, line 48 def ideal_mpi_time @ideal_mpi_time ||= event_time("MPI", kind: :ideal) @ideal_mpi_time end
mpi_comm_time()
click to toggle source
Time that MPI spent in communication.
# File lib/server_scripts/parser/itac.rb, line 60 def mpi_comm_time real_mpi_time - ideal_mpi_time end
real_app_time()
click to toggle source
Total time of real execution including intialization etc.
# File lib/server_scripts/parser/itac.rb, line 42 def real_app_time @total_app_time ||= event_time("Application", kind: :real, how: :all_procs) @total_app_time end
real_mpi_time()
click to toggle source
Actual MPI time. Includes wait time and communication time.
# File lib/server_scripts/parser/itac.rb, line 54 def real_mpi_time @real_mpi_time ||= event_time("MPI") @real_mpi_time end
trace!()
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 18 def trace! generate_ideal_trace! analyze_function_profiles! end
Private Instance Methods
check_for_traceanalyzer()
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 130 def check_for_traceanalyzer unless File.which("traceanalyzer") raise RuntimeError, "Must have intel traceanalyzer executable installed." end end
get_allprocs_event_time(func_profile, event)
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 77 def get_allprocs_event_time(func_profile, event) regex_event = Regexp.quote(event) event_time = nil func_profile.each do |l| if l.match(/"All_Processes";"#{regex_event}"/) match_data = l.match /"All_Processes";"#{regex_event}";(\d+);(\d+);(\d+);(\d+)/ event_time = match_data[2].to_f / 1e9 break end end unless event_time raise RuntimeError, "no event #{event} could be found in the function profile" end event_time end
get_perproc_event_time(func_profile, event)
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 95 def get_perproc_event_time(func_profile, event) regex_event = Regexp.quote(event) per_proc_event_time = {} func_profile.each do |l| if l.match(/"Process\s(\d+)";"#{regex_event}"/) match_data = l.match(/"Process\s(\d+)";"#{regex_event}";(\d+);(\d+);(\d+);(\d+)/) per_proc_event_time[match_data[1].to_i] = match_data[3].to_f / 1e9 end end values = per_proc_event_time.values [values.inject(:+).to_f / values.size, values.min, values.max] end
parse_ideal_event_time(event, how:)
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 120 def parse_ideal_event_time(event, how:) if how == :all_procs get_allprocs_event_time(@ideal_function_profile, event) elsif how == :per_proc get_perproc_event_time(@ideal_function_profile, event) else raise ArgumentError, "how argument should be either :all_procs or :per_proc, not #{how}." end end
parse_real_event_time(event, how:)
click to toggle source
# File lib/server_scripts/parser/itac.rb, line 110 def parse_real_event_time(event, how:) if how == :all_procs get_allprocs_event_time(@real_function_profile, event) elsif how == :per_proc get_perproc_event_time(@real_function_profile, event) else raise ArgumentError, "how argument should be either :all_procs or :per_proc, not #{how}." end end