#! /usr/bin/env ruby # coding: utf-8 require "optparse" require "yaml" require "pp" require "comana/queuesubmitter.rb" require "comana/machineinfo.rb" ## option analysis OPTS = {} op = OptionParser.new #op.on("-e", "--economy" , "Prior efficiency."){OPTS[:e] = true} op.on("-s" , "--speed" , "Prior speed to efficiency."){OPTS[:s] = true} op.on("-n nodes" , "--nodes" , "Node series." ){|v| OPTS[:n] = v} op.on("-c command", "--command", "Command to calculate." ){|v| OPTS[:c] = v} op.on("-d dir" , "--dir" , "Directory to calculate." ){|v| OPTS[:d] = v} op.parse!(ARGV) #cluster = ARGV[0] #cluster = ARGV OPTS[:machineinfo] = MachineInfo.load_file qs = QueueSubmitter.new(OPTS) begin qs.start rescue QueueSubmitter::AlreadyStartedError puts "Already started. Exit" exit rescue QueueSubmitter::PrepareNextError puts "Submitted. Exit" exit end #yaml = YAML.load_file("#{ENV["HOME"]}/.machineinfo") #pp yaml # #if File.exits?(SCRIPT_FILE) # puts "#{SCRIPT_FILE} already exist. Exit." # exit #end # #File.open(SCRIPT_FILE, "w") do |io| # io.puts "#PBS -N task" # io.puts "#PBS -l nodes=4:ppn=1:Ga" # io.puts "cd $PBS_O_WORKDIR" # io.puts "runvasp" # #io.puts "#/usr/local/bin/mpiexec /usr/local/bin/vasp5212mpi-ifc11-fast" # #io.puts "#/home/ippei/local/mpi/mpiexec-0.84/mpiexec /usr/local/calc/bin/vasp5212-mpich2" # #io.puts "#/usr/local/calc/mpiexec/bin/mpiexec /usr/local/calc/bin/vasp5212-mpich2" # #io.puts "#~/tmp.rb #OK" # # #io.puts condition # #io.puts rsync # #io.puts run # #io.puts rsync # #io.puts mv to trash? #end # ## Record job_id in pbs. Overwrite if exists. #job_id = `qsub #{SCRIPT_FILE}` #File.open(PBS_LOG, "w") do |io| # io.puts job_id #end #