MCPcopy Create free account
hub / github.com/LBANN/lbann / add_parallel_command

Method add_parallel_command

python/lbann/launcher/lsf.py:78–132  ·  view source on GitHub ↗

Add command to be executed in parallel. The command is launched with jsrun. Parallel processes are distributed evenly amongst the compute nodes. Args: command (`str` or `Iterable` of `str`s): Command to be executed in parallel. work_d

(self,
                             command,
                             work_dir=None,
                             nodes=None,
                             procs_per_node=None,
                             reservation=None,
                             launcher=None,
                             launcher_args=None)

Source from the content-addressed store, hash-verified

76 self.add_header_line(f'#BSUB -U {self.reservation}')
77
78 def add_parallel_command(self,
79 command,
80 work_dir=None,
81 nodes=None,
82 procs_per_node=None,
83 reservation=None,
84 launcher=None,
85 launcher_args=None):
86 """Add command to be executed in parallel.
87
88 The command is launched with jsrun. Parallel processes are
89 distributed evenly amongst the compute nodes.
90
91 Args:
92 command (`str` or `Iterable` of `str`s): Command to be
93 executed in parallel.
94 work_dir (str, optional): Working directory.
95 nodes (int, optional): Number of compute nodes.
96 procs_per_node (int, optional): Number of parallel
97 processes per compute node.
98 reservation (str, optional): Scheduler advance reservation.
99 launcher (str, optional): jsrun executable.
100 launcher_args (`Iterable` of `str`s, optional):
101 Command-line arguments to jsrun.
102
103 """
104
105 # Use default values if needed
106 if work_dir is None:
107 work_dir = self.work_dir
108 if nodes is None:
109 nodes = self.nodes
110 if procs_per_node is None:
111 procs_per_node = self.procs_per_node
112 if reservation is None:
113 reservation = self.reservation
114 if launcher is None:
115 launcher = self.launcher
116 if launcher_args is None:
117 launcher_args = self.launcher_args
118
119 # Construct jsrun invocation
120 args = [launcher]
121 args.extend(make_iterable(launcher_args))
122 args.append(f'--chdir {work_dir}')
123 args.extend([
124 f'--nrs {nodes}',
125 '--rs_per_host 1',
126 f'--tasks_per_rs {procs_per_node}',
127 '--launch_distribution packed',
128 '--cpu_per_rs ALL_CPUS',
129 '--gpu_per_rs ALL_GPUS',
130 ])
131 args.extend(make_iterable(command))
132 self.add_command(args)
133
134 def submit(self, overwrite=False):
135 """Submit batch job to LSF with bsub.

Callers

nothing calls this directly

Calls 2

make_iterableFunction · 0.90
add_commandMethod · 0.80

Tested by

no test coverage detected