server_scripts 0.0.2 → 0.0.3

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: 7fc3282ab4ef93f7e6de815343bca4bf11b6fb60
4
- data.tar.gz: e9b5a827cda61da04b79f1526df3ed223b593bca
3
+ metadata.gz: 44c45be7c8faebd8504682600c9b4da7694ddd18
4
+ data.tar.gz: ea70dfe5c454365731449ac559f2ff8f1a7e87ed
5
5
  SHA512:
6
- metadata.gz: 7a9d9cd9fd246095acc03507e37e7419da713ff0bad625dbb46582a6cc09f7e5d58a775b07f09cf3d7b72301233ddb338449c366a44946b68e0cf86f301c3ff1
7
- data.tar.gz: 1c29990c502b25014a60feb44bb1d9e23e12be06b74c7e6663634ddd9a93572bc30bc94a35fa12f83acd616ce5572f9d83c0b275df636819f82acb96ab6a31d5
6
+ metadata.gz: 2a095ccfe52889d91fcf96376e63710b7df2c1a37e930d6786e15883969d92eef2a9385d04d7049e67d00b17f8e3c652e053f267e0ccd67f4b7a82ba71c8197b
7
+ data.tar.gz: b5363004c437866dc232450109274ce457c0d47b85ec67e48b29c360424806cfd59baac3c78ade0123fd24960e1b2063275f62bb3573bc8322f76c8c913f8413
@@ -2,7 +2,7 @@ module ServerScripts
2
2
  module Computer
3
3
  class Base
4
4
  def initialize(node_type, nodes, job_name, wall_time, out_file,
5
- err_file, env)
5
+ err_file, env, modules)
6
6
  @node_type = node_type
7
7
  @nodes = nodes
8
8
  @job_name = job_name
@@ -10,6 +10,7 @@ module ServerScripts
10
10
  @out_file = out_file
11
11
  @err_file = err_file
12
12
  @env = env
13
+ @modules = modules
13
14
  end
14
15
 
15
16
  def node_type
@@ -9,9 +9,18 @@ module ServerScripts
9
9
  #$ -N %{job_name}
10
10
  #$ -o %{out_file}
11
11
  #$ -e %{err_file}
12
+
13
+ . /etc/profile.d/modules.sh
12
14
  }
13
15
 
14
16
  FULL_NODE = "f_node"
17
+
18
+ MODULES = {
19
+ "gcc" => "gcc/8.3.0",
20
+ "intel-mpi" => "intel-mpi",
21
+ "openmpi" => "cuda/8.0.61 openmpi",
22
+ "itac" => "intel-itac intel-vtune"
23
+ }
15
24
 
16
25
  def header
17
26
  HEADER % {node_type: node_type, nodes: @nodes, wall_time: @wall_time,
@@ -31,6 +40,10 @@ module ServerScripts
31
40
  res = res_id ? " -ar #{res_id} " : ""
32
41
  "qsub -g #{ServerScripts.group_name} #{res} #{batch_script}"
33
42
  end
43
+
44
+ def module_load_cmd
45
+ "module load #{@modules.map { |m| MODULES[m] }.join(' ')}"
46
+ end
34
47
  end
35
48
  end
36
49
  end
@@ -15,7 +15,7 @@ module ServerScripts
15
15
 
16
16
  class OpenMPI < MPIProgram
17
17
  def run_cmd
18
- "mpirun --mca mpi_cuda_support 0 #{env_variables} -N #{@npernode} -np #{@nprocs}"
18
+ "mpirun --mca mpi_cuda_support 0 -x LD_LIBRARY_PATH #{env_variables} -N #{@npernode} -np #{@nprocs}"
19
19
  end
20
20
 
21
21
  private
@@ -1,3 +1,3 @@
1
1
  module ServerScripts
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -39,6 +39,8 @@ module ServerScripts
39
39
  attr_accessor :additional_commands
40
40
  attr_accessor :enable_intel_itac
41
41
  attr_accessor :intel_vtune_fname
42
+ attr_accessor :source_bashrc
43
+ attr_accessor :modules
42
44
 
43
45
  attr_reader :env
44
46
  attr_reader :job_fname
@@ -61,6 +63,8 @@ module ServerScripts
61
63
  @job_script = nil
62
64
  @enable_intel_itac = false
63
65
  @additional_commands = []
66
+ @modules = []
67
+ @source_bashrc = true
64
68
 
65
69
  yield self
66
70
  end
@@ -84,11 +88,14 @@ module ServerScripts
84
88
 
85
89
  def generate_job_script!
86
90
  @system = ServerScripts.system.new(@node_type, @nodes, @job_name,
87
- @wall_time, @out_file, @err_file, @env)
91
+ @wall_time, @out_file, @err_file, @env, @modules)
88
92
  configure_executor!
89
93
 
90
94
  @job_script = ""
91
95
  @job_script += @system.header
96
+ @job_script += "\nsource ~/.bashrc\n" if @source_bashrc
97
+ @job_script += @system.module_load_cmd
98
+
92
99
  @job_script += @system.env_setter
93
100
  @additional_commands.each do |c|
94
101
  @job_script += c + "\n"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sameer Deshmukh