Class: ServerScripts::Parser::ITAC

Inherits:
Object
  • Object
show all
Defined in:
lib/server_scripts/parser/itac.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(itac_file) {|_self| ... } ⇒ ITAC

Returns a new instance of ITAC.

Yields:

  • (_self)

Yield Parameters:



7
8
9
10
11
12
13
14
15
16
# 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

Instance Attribute Details

#ideal_itac_fnameObject (readonly)

Returns the value of attribute ideal_itac_fname.



5
6
7
# File 'lib/server_scripts/parser/itac.rb', line 5

def ideal_itac_fname
  @ideal_itac_fname
end

#real_itac_fnameObject

Returns the value of attribute real_itac_fname.



4
5
6
# File 'lib/server_scripts/parser/itac.rb', line 4

def real_itac_fname
  @real_itac_fname
end

Instance Method Details

#analyze_function_profiles!Object



30
31
32
33
34
35
36
37
38
39
# 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) ⇒ Object

Get event time for a particular event. Specify whether from ideal trace or real trace.



65
66
67
68
69
70
71
72
73
# 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!Object



23
24
25
26
27
28
# 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_timeObject

Ideal MPI time. Only wait time.



48
49
50
51
# 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_timeObject

Time that MPI spent in communication.



60
61
62
# File 'lib/server_scripts/parser/itac.rb', line 60

def mpi_comm_time
  real_mpi_time - ideal_mpi_time
end

#real_app_timeObject

Total time of real execution including intialization etc.



42
43
44
45
# 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_timeObject

Actual MPI time. Includes wait time and communication time.



54
55
56
57
# File 'lib/server_scripts/parser/itac.rb', line 54

def real_mpi_time
  @real_mpi_time ||= event_time("MPI")
  @real_mpi_time
end

#trace!Object



18
19
20
21
# File 'lib/server_scripts/parser/itac.rb', line 18

def trace!
  generate_ideal_trace!
  analyze_function_profiles!
end