server_scripts 0.0.8 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d900565278f9df7242f33d23a8b8e22ee67429a
4
- data.tar.gz: 6deaa6599e7bc742ebcabeee802ea699f9f9d44f
3
+ metadata.gz: f1fcfa7acf474ee5e2995af309c00516764836c4
4
+ data.tar.gz: 3e3567be1f67c495143ecabe583be364235cadf1
5
5
  SHA512:
6
- metadata.gz: 685af965add627451c130b29c557d13c3231e6b94730c2d2dfe7882027492d15933a353002978f3df5137222a19eccc7656d5c7307771f866f3ea820de22b411
7
- data.tar.gz: 9f5c6cd9efd59294f7e8a430be9fa4abd99989a67c6591486dcdf735a9da33d549e5b1671371b2b7073eeacd34c4020da3d280a3485c784e3be96914ba3a835d
6
+ metadata.gz: 8996a1076526a5e44e58b649ae8daf11a520ed7cecbc2c26bd1eff94f2c6a7109e609f3ce995c00d333895303a9c9e6c47242b440306a551e2b803d88701176d
7
+ data.tar.gz: 99e4065047cba125b88baf6a8f4f7391f926a7b9909ba7136d395f4bc584f1e671c9f65ae5caea0ef2aa5e74076c8ff6637124c0acd13f416c0a357ab57a627e
@@ -11,6 +11,7 @@ require 'server_scripts/version'
11
11
 
12
12
  module ServerScripts
13
13
  class << self
14
+ @@verbose = false
14
15
  def system
15
16
  sys = ENV["SYSTEM_NAME"]
16
17
 
@@ -28,6 +29,14 @@ module ServerScripts
28
29
  def group_name
29
30
  ENV["GROUP_NAME"]
30
31
  end
32
+
33
+ def verbose
34
+ @@verbose
35
+ end
36
+
37
+ def verbose= v
38
+ @@verbose = v
39
+ end
31
40
  end
32
41
  end # module ServerScripts
33
42
 
@@ -1,19 +1,51 @@
1
1
  module ServerScripts
2
2
  module Computer
3
3
  class ABCI < Base
4
- FULL_NODE = "rt_F"
5
-
6
- def header(node_type: FULL_NODE)
7
- h = %q{
4
+
5
+ HEADER = %q{
8
6
  #!/bin/bash
9
7
 
10
8
  #$ -cwd
11
9
  #$ -l %{node_type}=%{nodes}
12
- #$ -l h_rt=%{walltime}
10
+ #$ -l h_rt=%{wall_time}
13
11
  #$ -N %{job_name}
14
12
  #$ -o %{out_file}
15
13
  #$ -e %{err_file}
16
- }
14
+
15
+ . /etc/profile.d/modules.sh
16
+ module load intel-mkl
17
+
18
+ }
19
+ FULL_NODE = "rt_F"
20
+
21
+ MODULES = {
22
+ "gcc" => "gcc",
23
+ "intel-mpi" => "intel-mpi",
24
+ "openmpi" => "openmpi",
25
+ "itac" => "intel-itac intel-vtune"
26
+ }
27
+
28
+ def header
29
+ HEADER % {node_type: node_type, nodes: @nodes, wall_time: @wall_time,
30
+ job_name: @job_name, out_file: @out_file, err_file: @err_file}
31
+ end
32
+
33
+ def env_setter
34
+ str = "\n"
35
+ @env.each do |var, value|
36
+ str += "export #{var}=#{value}\n"
37
+ end
38
+
39
+ str
40
+ end
41
+
42
+ def job_submit_cmd batch_script:, res_id: nil
43
+ res = res_id ? " -ar #{res_id} " : ""
44
+ "qsub -g #{ServerScripts.group_name} #{res} #{batch_script}"
45
+ end
46
+
47
+ def module_load_cmd
48
+ "module load #{@modules.map { |m| MODULES[m] }.join(' ')}"
17
49
  end
18
50
  end
19
51
  end
@@ -59,11 +59,23 @@ module ServerScripts
59
59
  end
60
60
 
61
61
  def extract_data_from_profiles
62
+ if ServerScripts.verbose
63
+ puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
64
+ puts "Parsing REGEX: #{@regex}"
65
+ end
66
+
62
67
  Dir.glob(@regex) do |fname|
68
+ if ServerScripts.verbose
69
+ puts "--------------------------------------"
70
+ puts "Reading file #{fname}..."
71
+ end
72
+
63
73
  proc_id = fname.match(@regex.gsub("*", "(\\d+)"))[1].to_i
64
74
  @time_hash[proc_id] = {}
65
75
  output = File.read(fname).split("\n")
66
76
  recent_cpu = nil
77
+
78
+ puts("\tPROC ID: #{proc_id}") if ServerScripts.verbose
67
79
 
68
80
  output.each do |line|
69
81
  cpu_match = line.match(/CPU\s(\d+)/)
@@ -78,11 +90,20 @@ module ServerScripts
78
90
  @time_hash[proc_id][recent_cpu][:exec_time] = match_data[2].to_f / 1e3
79
91
  @time_hash[proc_id][recent_cpu][:sleep_time] = match_data[3].to_f / 1e3
80
92
  @time_hash[proc_id][recent_cpu][:overhead_time] = match_data[4].to_f / 1e3
93
+ if ServerScripts.verbose
94
+ puts("\t\tCPU ID: #{recent_cpu}")
95
+ puts("\t\t\tTotal Time: #{@time_hash[proc_id][recent_cpu][:total_time]}")
96
+ puts("\t\t\tExec Time: #{@time_hash[proc_id][recent_cpu][:exec_time]}")
97
+ puts("\t\t\tSleep Time: #{@time_hash[proc_id][recent_cpu][:sleep_time]}")
98
+ puts("\t\t\tOverhead Time: #{@time_hash[proc_id][recent_cpu][:overhead_time]}")
99
+ end
81
100
  end
82
101
  recent_cpu = nil
83
102
  end
84
103
  end
104
+ puts("--------------------------------------") if ServerScripts.verbose
85
105
  end
106
+ puts("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") if ServerScripts.verbose
86
107
  end
87
108
  end # class
88
109
  end # module Parser
@@ -1,3 +1,3 @@
1
1
  module ServerScripts
2
- VERSION = "0.0.8"
2
+ VERSION = "0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: '0.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sameer Deshmukh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-26 00:00:00.000000000 Z
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ptools