scheduler
zeus.optimizer.pipeline_frequency.server.scheduler
Interfaces for defining frequency schedulers.
FrequencyScheduler
Bases: ABC
Interface for classes that enclose frequency scheduling policies.
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
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 |
|
__init__
__init__(job_info, rank_infos, pfo_settings)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_info |
JobInfo
|
Info about the training job. |
required |
rank_infos |
list[RankInfo]
|
Info about all ranks. May not be sorted in rank order. |
required |
pfo_settings |
PFOServerSettings
|
PFOServerSettings object. |
required |
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
observe
observe(profiling_results)
Ingest the profiling results for the previous schedule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
profiling_results |
list[ProfilingResult]
|
Doesn't have to be sorted in rank order. |
required |
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
47 48 49 50 51 52 53 54 55 56 57 |
|
next_schedule
next_schedule()
Return the schedules for the next round of iterations.
Returns:
Type | Description |
---|---|
list[FrequencySchedule]
|
A list of |
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
_run
abstractmethod
_run()
Yield next schedules and receives profiling results in one place.
This is an alternative way to write a frequency scheduler. The advantage is that everything is enclosed inside this method. The downside is that you'll have to read this and understand how this generator works.
The following implementation is a simple example of writing a scheduler using
this class. yield
the next frequency schedule, and receive the profiling
results corresponding to that schedule from the yield
. observe
and
next_schedule
will run the generator for you.
In general, this generator should be designed to yield
schedules infinitely.
However, if this was written to write a finite number of next schedules and
raise StopIteration
, the last schedule cached inside self._next_schedule
will infinitely be returned from the call to next_schedule
. This can be
useful when you converge to the optimal schedule and stop the generator, and
the rest of training will run with the final optimal schedule indefinitely.
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
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 |
|
PointSolution
Bases: FrequencyScheduler
Runs the given frequency schedule.
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
__init__
__init__(job_info, rank_infos, pfo_settings, solution_path)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_info |
JobInfo
|
Info about the training job. |
required |
rank_infos |
list[RankInfo]
|
Info about all ranks. May not be sorted in rank order. |
required |
pfo_settings |
PFOServerSettings
|
PFOServerSettings object. |
required |
solution_path |
str
|
Path to the frequency Python file generated by lowtime. |
required |
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|
_run
_run()
Yield the schedule given by the solution path.
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
273 274 275 |
|
make_3d_parallel
make_3d_parallel(sched_cls, name=None)
Wrap sched_cls
so that it is aware of 3D parallelism.
Internally, this function subclasses sched_cls
and overrides observe
and
next_schedule
. observe
will aggregate the profiling results from all ranks
that share the same pp_rank and feed it to super().observe
, while next_schedule
will first retrieve the per-stage schedule from super().next_schedule
and then
copy-paste it to all ranks that share the same pp_rank. With this, the wrapped
scheduler can operate under the illusion that it's only deadling with pure pipeline
parallelism.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sched_cls |
Type[FrequencyScheduler]
|
The scheduler class to wrap. |
required |
name |
str | None
|
Name of the scheduler. If None, use |
None
|
Source code in zeus/optimizer/pipeline_frequency/server/scheduler.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|