Skip to content

Commit b1fae9f

Browse files
add usage
1 parent b528e8c commit b1fae9f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

colossalai/device/alpha_beta_profiler.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
class AlphaBetaProfiler:
1616
'''
1717
Profile alpha and beta value for a given device list.
18+
19+
Usage:
20+
# Note: the environment of execution is supposed to be
21+
# multi-process with multi-gpu in mpi style.
22+
>>> physical_devices = [0, 1, 4, 5]
23+
>>> ab_profiler = AlphaBetaProfiler(physical_devices)
24+
>>> ab_dict = profiler.profile_ab()
25+
>>> print(ab_dict)
26+
{(0, 1): (1.9641406834125518e-05, 4.74049549614719e-12), (0, 4): (1.9506998360157013e-05, 6.97421973297474e-11), (0, 5): (2.293858677148819e-05, 7.129930361393644e-11),
27+
(1, 4): (1.9010603427886962e-05, 7.077968863788975e-11), (1, 5): (1.9807778298854827e-05, 6.928845708992215e-11), (4, 5): (1.8681809306144713e-05, 4.7522367291330524e-12),
28+
(1, 0): (1.9641406834125518e-05, 4.74049549614719e-12), (4, 0): (1.9506998360157013e-05, 6.97421973297474e-11), (5, 0): (2.293858677148819e-05, 7.129930361393644e-11),
29+
(4, 1): (1.9010603427886962e-05, 7.077968863788975e-11), (5, 1): (1.9807778298854827e-05, 6.928845708992215e-11), (5, 4): (1.8681809306144713e-05, 4.7522367291330524e-12)}
1830
'''
1931

2032
def __init__(self,

0 commit comments

Comments
 (0)