Module: Pwrake::MCGP

Defined in:
lib/pwrake/misc/mcgp.rb

Class Method Summary collapse

Class Method Details

.graph_partition(host_map, target = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pwrake/misc/mcgp.rb', line 8

def graph_partition(host_map, target=nil)
  t1 = Time.now
  wgts = host_map.group_weight_sum
  if wgts.size > 1
    list = wgts.size.times.to_a
    g = GraphTracerGroup.new([list],[wgts])
    trace(g,target)
    g.part_graph
    #g.write_dot('dag1.dot')
    #return
  end

  #$debug=true

  list = host_map.group_hosts
  wgts = host_map.group_core_weight
  g = GraphTracerNode.new(list,wgts)
  trace(g,target)
  g.part_graph
  t2 = Time.now
  Pwrake::Log.info "Time for TOTAL Graph Partitioning: #{t2-t1} sec"
  #g.write_dot('dag2.dot')
  #exit
end

.trace(g, target) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/pwrake/misc/mcgp.rb', line 34

def trace(g,target)
  if target
    g.trace(target)
  else
    Rake.application.top_level_tasks.each do |t|
      g.trace(t)
    end
  end
end