mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-11 13:59:08 +00:00
[legacy] move communication and nn to legacy and refactor logger (#4671)
* [legacy] move communication to legacy (#4640) * [legacy] refactor logger and clean up legacy codes (#4654) * [legacy] make logger independent to gpc * [legacy] make optim independent to registry * [legacy] move test engine to legacy * [legacy] move nn to legacy (#4656) * [legacy] move nn to legacy * [checkpointio] fix save hf config * [test] remove useledd rpc pp test * [legacy] fix nn init * [example] skip tutorial hybriad parallel example * [devops] test doc check * [devops] test doc check
This commit is contained in:
15
colossalai/legacy/nn/layer/parallel_sequence/_utils.py
Normal file
15
colossalai/legacy/nn/layer/parallel_sequence/_utils.py
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
|
||||
def _calc_incoming_device_range(i, rank, world_size, sub_seq_length):
|
||||
device_of_incoming_k = (rank - i - 1) % world_size
|
||||
start_idx = sub_seq_length * device_of_incoming_k
|
||||
end_idx = sub_seq_length * (device_of_incoming_k + 1)
|
||||
return start_idx, end_idx
|
||||
|
||||
|
||||
def _calc_current_device_range(rank, sub_seq_length):
|
||||
start_idx = sub_seq_length * rank
|
||||
end_idx = sub_seq_length * (rank + 1)
|
||||
return start_idx, end_idx
|
Reference in New Issue
Block a user