Skip to content

Instantly share code, notes, and snippets.

@berezovskyi
Created December 22, 2012 18:48
Show Gist options
  • Save berezovskyi/4360451 to your computer and use it in GitHub Desktop.
Save berezovskyi/4360451 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
home_path = "/home/localusers/io8x41/"
save_path = "qgen/"
mpi_path = "mpi/"
java_path = "java/"
cout_path = "runlog/"
err_path = "errlog/"
task_path = "tasks/"
pid_path = "pids/"
file_name = "maingo"
wall_time = "2:00:00"
problem_sizes = [4800, 4320, 3840, 3360, 2880, 2400, 1920, 1440, 960, 480]
ppn_sizes = [[3,8], [2,8], [3,4], [2,4], [1,4], [1, 2], [1,1]]
i = 1
files = []
problem_sizes.each do |ps|
ppn_sizes.each do |cpu|
fname = "ab_m#{"%02d" % i}_#{ps}_#{cpu[0]}x#{cpu[1]}"
ftask = File.open(save_path + mpi_path + task_path + fname + ".sh", "w") { |file|
file.puts "\#!/bin/bash"
file.puts "\#PBS -S /bin/bash"
file.puts "\#PBS -l nodes=#{cpu[0]}:ppn=#{cpu[1]},walltime=#{wall_time}"
file.puts "\#PBS -e #{home_path}#{mpi_path}#{err_path}#{fname}.err"
file.puts "\#PBS -o #{home_path}#{mpi_path}#{cout_path}#{fname}.log"
file.puts "mpiexec #{home_path}#{mpi_path}#{file_name} #{ps}"
}
files << fname
i += 1
end
end
fcomm = File.open(save_path + mpi_path + "qgen.sh", "w") { |file|
file.puts "\#!/bin/bash"
files.each { |f|
file.puts "qsub #{home_path}#{mpi_path}#{task_path}#{f}.sh > #{home_path}#{mpi_path}#{pid_path}#{f}.pid"
}
}
puts "Generated files:"
files.each do |f|
puts "\t#{f}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment