Skip to content

Commit

Permalink
[SOURCE] Fix pattern matching bug of Epochs
Browse files Browse the repository at this point in the history
  • Loading branch information
leondavi committed Jun 9, 2024
1 parent c723839 commit af735b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions src_erl/NerlnetApp/src/Client/clientStatem.erl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ waitforWorkers(cast, In = {stateChange,WorkerName}, State = #client_statem_state
case NewWaitforWorkers of % TODO Guy here we need to check for keep alive with workers
[] -> send_client_is_ready(MyName), % when all workers done their work
stats:increment_messages_sent(ClientStatsEts),
?LOG_INFO("Client ~p and its workers are ready~n",[MyName]),
{next_state, NextState, State#client_statem_state{waitforWorkers = []}};
_ -> %io:format("Client ~p is waiting for workers ~p~n",[MyName,NewWaitforWorkers]),
{next_state, waitforWorkers, State#client_statem_state{waitforWorkers = NewWaitforWorkers}}
Expand Down
9 changes: 4 additions & 5 deletions src_erl/NerlnetApp/src/Source/sourceStatem.erl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ idle(cast, {startCasting,_Body}, State = #source_statem_state{batchesList = Batc
?LOG_NOTICE("Frequency: ~pHz [Batches/Second]",[Frequency]),
?LOG_NOTICE("Batch size: ~p", [BatchSize]),
?LOG_NOTICE("Sample size = ~p",[SampleSize]),
?LOG_NOTICE("Rounds of all data (Source Epochs): ~p", [Epochs]),
?LOG_NOTICE("# of batches to send is ~p ",[BatchesToSend]),
if
Epochs =:= 0 ->
Expand Down Expand Up @@ -286,14 +285,14 @@ spawnTransmitter(SourceEtsRef, WorkersListOfNames, BatchesListToSend)->
Method = ets:lookup_element(SourceEtsRef, method , ?DATA_IDX),
TimeInterval_ms = ets:lookup_element(SourceEtsRef, time_interval_ms, ?DATA_IDX), % frequency to time interval duration in milliseconds between each send
ClientWorkerPairs = nerl_tools:get_client_worker_pairs(WorkersListOfNames,WorkersMap,[]),
Epochs = ets:lookup_element(SourceEtsRef, epochs, ?DATA_IDX),
Phase = ets:lookup_element(SourceEtsRef, current_phase, ?DATA_IDX),
MyName = ets:lookup_element(SourceEtsRef, my_name, ?DATA_IDX),
case Phase of
?PHASE_TRAINING_ATOM -> pass;
?PHASE_PREDICTION_ATOM -> Epochs = 1; % In prediction phase, we send only a single epoch always!
Epochs = case Phase of
?PHASE_TRAINING_ATOM -> ets:lookup_element(SourceEtsRef, epochs, ?DATA_IDX);
?PHASE_PREDICTION_ATOM -> 1; % In prediction phase, we send only a single epoch always!
_ -> ?LOG_ERROR("Source ~p has an unknown phase: ~p",[MyName, Phase])
end,
?LOG_NOTICE("Rounds of all data (Source Epochs): ~p", [Epochs]),
SourcePid = self(),
TimeIntervalWithOverheadFactor = TimeInterval_ms * ?SENDING_FREQUENCY_OVERHEAD_FIX_FACTOR_PERC,
spawn_link(?MODULE,transmitter,[TimeIntervalWithOverheadFactor,SourceEtsRef, SourcePid ,Epochs, ClientWorkerPairs, BatchesListToSend, Method]).
Expand Down

0 comments on commit af735b3

Please sign in to comment.