-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsrun.py
122 lines (94 loc) · 4.71 KB
/
jsrun.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env python
#
# Author: Veronica G. Vergara L.
#
#
from .base_jobLauncher import BaseJobLauncher
class Jsrun(BaseJobLauncher):
def __init__(self):
self.__name = 'jsrun'
self.__launchCmd = 'jsrun'
self.__numProcessesOpt = '-p'
self.__numCPUsPerResourceOpt = '-c'
self.__launchDistributionOpt = '-d'
self.__numGPUsPerResourceOpt = '-g'
self.__latencyPriorityOpt = '-l'
self.__memoryPerResourceOpt = '-m'
self.__numResourcesOpt = '-n'
self.__numResourcesPerHostOpt = '-r'
self.__stdioModeOpt = '-e'
self.__appfileOpt = '-f'
self.__stderrOpt = '-k'
self.__stdoutOpt = '-o'
self.__stdinOpt = '-t'
self.__chdirOpt = '-h'
self.__debugSymbolsOpt = '-u'
self.__immediateReturnOpt = '-i'
self.__exitOnErrorOpt = '-X'
self.__environmentSettingOpt = '-E'
#BaseJobLauncher.__init__(self,self.__name,self.__launchCmd,self.__numProcessesOpt,self.__numCPUsPerResourceOpt,self.__launchDistributionOpt,self.__numGPUsPerResourceOpt,
# self.__latencyPriorityOpt,self.__memoryPerResourceOpt,self.__numResourcesOpt,self.__numResourcesPerHostOpt,self.__stdioModeOpt,self.__appfileOpt,
# self.__stderrOpt,self.__stdoutOpt,self.__stdinOpt,self.__chdirOpt,self.__debugSymbolsOpt,self.__immediateReturnOpt,self.__exitOnErrorOpt,
# self.__environmentSettingOpt)
BaseJobLauncher.__init__(self,self.__name,self.__launchCmd)
def build_job_command(self,template_dict):
print("Building job command in the Jsrun class")
job_launch_command = self.__launchCmd + " "
ktemp = "total_processes"
if ktemp in template_dict:
job_launch_command += self.__numProcessesOpt + " " + template_dict[ktemp] + " "
ktemp = "num_cpus_per_resource"
if ktemp in template_dict:
job_launch_command += self.__numCPUsPerResourceOpt + " " + template_dict[ktemp] + " "
ktemp = "launch_distribution"
if ktemp in template_dict:
job_launch_command += self.__launchDistributionOpt + " " + template_dict[ktemp] + " "
ktemp = "num_gpus_per_resource"
if ktemp in template_dict:
job_launch_command += self.__numGPUsPerResourceOpt + " " + template_dict[ktemp] + " "
ktemp = "latency_priority"
if ktemp in template_dict:
job_launch_command += self.__latencyPriorityOpt + " " + template_dict[ktemp] + " "
ktemp = "memory_per_resource"
if ktemp in template_dict:
job_launch_command += self.__memoryPerResourceOpt + " " + template_dict[ktemp] + " "
ktemp = "num_resources"
if ktemp in template_dict:
job_launch_command += self.__numResourcesOpt + " " + template_dict[ktemp] + " "
ktemp = "num_resources_per_host"
if ktemp in template_dict:
job_launch_command += self.__numResourcesPerHostOpt + " " + template_dict[ktemp] + " "
ktemp = "stdio_mode"
if ktemp in template_dict:
job_launch_command += self.__stdioModeOpt + " " + template_dict[ktemp] + " "
ktemp = "app_file"
if ktemp in template_dict:
job_launch_command += self.__appfileOpt + " " + template_dict[ktemp] + " "
ktemp = "stderr"
if ktemp in template_dict:
job_launch_command += self.__stderrOpt + " " + template_dict[ktemp] + " "
ktemp = "stdout"
if ktemp in template_dict:
job_launch_command += self.__stdoutOpt + " " + template_dict[ktemp] + " "
ktemp = "stdin"
if ktemp in template_dict:
job_launch_command += self.__stdinOpt + " " + template_dict[ktemp] + " "
ktemp = "chdir"
if ktemp in template_dict:
job_launch_command += self.__chdirOpt + " " + template_dict[ktemp] + " "
ktemp = "debug_symbols"
if ktemp in template_dict:
job_launch_command += self.__debugSymbolsOpt + " " + template_dict[ktemp] + " "
ktemp = "immediate_return"
if ktemp in template_dict:
job_launch_command += self.__immediateReturnOpt + " " + template_dict[ktemp] + " "
ktemp = "exit_on_error"
if ktemp in template_dict:
job_launch_command += self.__exitOnErrorOpt + " " + template_dict[ktemp] + " "
ktemp = "environment_setting"
if ktemp in template_dict:
job_launch_command += self.__environmentSettingOpt + " " + template_dict[ktemp] + " "
job_launch_command += template_dict["pathtoexecutable"]
return job_launch_command
if __name__ == '__main__':
print('This is the Jsrun job launcher class')