Class: MRunEnv::MPIRunner

Inherits:
Object
  • Object
show all
Defined in:
ext/lib/CompLearnLib/RunEnv.rb,
ext/lib/CompLearnLib/RunEnv.rb

Overview

For now, use these paths

Constant Summary collapse

@@MPIRUBY =
'mpi_ruby'
@@MPIRUN =
'mpirun'
@@MPILAMBOOT =
'lamboot'
@@MPIWIPE =
'wipe'
@@MPIHALT =
'lamhalt'

Class Method Summary collapse

Class Method Details

.bootMPIObject



67
68
69
70
71
72
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 67

def MPIRunner.bootMPI()
  MPIRunner.getGoodHostsFile
  result = `#{@@MPILAMBOOT} -x -v -s #{@hostFilename}`
  puts result
  @lamRunning = true
end

.getGoodHostsFileObject



57
58
59
60
61
62
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 57

def MPIRunner.getGoodHostsFile()
  unless defined?(@hostFilename)
    @hostFilename = SSHAgent.writeGoodHostFile
  end
  @hostFilename
end

.haltMPIObject



76
77
78
79
80
81
82
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 76

def MPIRunner.haltMPI()
  MPIRunner.getGoodHostsFile
  #result = `#{@@MPIHALT}`
  result = `#{@@MPIWIPE} -v #{@hostFilename}`
  SSHAgent.runEverywhere('"killall mpi_ruby;killall lamboot;killall lamd"')
  @lamRunning = false
end

.lamRunning?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 73

def MPIRunner.lamRunning?()
  defined?(@lamRunning) && @lamRunning
end

.rebootMPIObject



63
64
65
66
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 63

def MPIRunner.rebootMPI()
  MPIRunner.haltMPI
  MPIRunner.bootMPI
end

.runMPIRubyScript(scriptArray) ⇒ Object

returns PID of controller



87
88
89
90
91
92
93
94
95
96
97
98
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 87

def MPIRunner.runMPIRubyScript(scriptArray) # returns PID of controller
  scriptName = scriptArray[0]
  scriptArgs = (scriptArray[1..-1]).join(' ')
  puts "Running script #{scriptName} on #{`hostname`}"
  MPIRunner.bootMPI unless lamRunning?
#    res = fork()
#    if (res)
#      res
#    else
    exec("#{@@MPIRUN} C #{@@MPIRUBY} #{scriptName} #{scriptArgs}")
#    end
end

.stopMPIRubyScriptObject



83
84
85
86
# File 'ext/lib/CompLearnLib/RunEnv.rb', line 83

def MPIRunner.stopMPIRubyScript()
  #Process.kill(9, pid)
  MPIRunner.haltMPI()
end