Skip to content

Commit

Permalink
[SOURCE] Fix RR batch ID issue
Browse files Browse the repository at this point in the history
- TODO fix batch ID issue of random
  • Loading branch information
leondavi committed Jul 20, 2024
1 parent e46270b commit 1dd4250
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src_erl/NerlnetApp/src/Source/sourceSendingPolicies.erl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ send_method_round_robin(TransmitterEts, Epochs, TimeInterval_ms, ClientWorkerPai
TotalNumOfBatches = length(BatchesListToSend),
BatchesIndexes = generate_batch_indexes(TotalNumOfBatches, EpochIdx),
ClientWorkerPairsLength = length(ClientWorkerPairs),
WorkerIdxBatchIdxTuples = [ {X , X rem ClientWorkerPairsLength} || X <- BatchesIndexes],
WorkerIdxBatchIdxTuples = [ {X div ClientWorkerPairsLength, X rem ClientWorkerPairsLength} || X <- BatchesIndexes],
BatchesWithIndexes = lists:zip(WorkerIdxBatchIdxTuples, BatchesListToSend),
lists:foreach(BatchFunc, BatchesWithIndexes),
% update batches sent
Expand All @@ -97,7 +97,7 @@ send_method_random(TransmitterEts, Epochs, TimeInterval_ms, ClientWorkerPairs, B
TotalNumOfBatches = length(BatchesListToSend),
BatchesIndexes = generate_batch_indexes(TotalNumOfBatches, EpochIdx),
ClientWorkerPairsLength = length(ClientWorkerPairs),
WorkerIdxBatchIdxTuples = [ {X , rand:uniform(ClientWorkerPairsLength)} || X <- BatchesIndexes],
WorkerIdxBatchIdxTuples = [ {X div ClientWorkerPairsLength, rand:uniform(ClientWorkerPairsLength)} || X <- BatchesIndexes],
BatchesWithIndexes = lists:zip(WorkerIdxBatchIdxTuples, BatchesListToSend), % Tuple {{BatchIdx, WorkerIdx}, Batch}
lists:foreach(BatchFunc, BatchesWithIndexes),
% update batches sent
Expand Down

0 comments on commit 1dd4250

Please sign in to comment.