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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44c45be7c8faebd8504682600c9b4da7694ddd18
|
4
|
+
data.tar.gz: ea70dfe5c454365731449ac559f2ff8f1a7e87ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/server_scripts.rb
CHANGED
@@ -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"
|