@@ -19,8 +19,8 @@ ADOutlier::AlgoParams::AlgoParams(): stat(ADOutlier::ExclusiveRuntime), sstd_sig
1919/* ---------------------------------------------------------------------------
2020 * Implementation of ADOutlier class
2121 * --------------------------------------------------------------------------- */
22- ADOutlier::ADOutlier (OutlierStatistic stat)
23- : m_execDataMap(nullptr ), m_param(nullptr ), m_local_param(nullptr ), m_use_ps(false ), m_perf(nullptr ), m_statistic(stat), m_sync_call_count(0 ), m_global_model_sync_freq(1 )
22+ ADOutlier::ADOutlier (int rank, OutlierStatistic stat)
23+ : m_execDataMap(nullptr ), m_param(nullptr ), m_local_param(nullptr ), m_use_ps(false ), m_perf(nullptr ), m_statistic(stat), m_sync_call_count(0 ), m_global_model_sync_freq(1 ), m_rank(rank)
2424{
2525}
2626
@@ -49,17 +49,17 @@ void loadPerFunctionThresholds(ADOutlierType* into, const std::string &filename)
4949}
5050
5151
52- ADOutlier *ADOutlier::set_algorithm (const std::string & algorithm, const AlgoParams ¶ms) {
52+ ADOutlier *ADOutlier::set_algorithm (int rank, const std::string & algorithm, const AlgoParams ¶ms) {
5353 if (algorithm == " sstd" || algorithm == " SSTD" ) {
54- return new ADOutlierSSTD (params.stat , params.sstd_sigma );
54+ return new ADOutlierSSTD (rank, params.stat , params.sstd_sigma );
5555 }
5656 else if (algorithm == " hbos" || algorithm == " HBOS" ) {
57- ADOutlierHBOS* alg = new ADOutlierHBOS (params.stat , params.hbos_thres , params.glob_thres , params.hbos_max_bins );
57+ ADOutlierHBOS* alg = new ADOutlierHBOS (rank, params.stat , params.hbos_thres , params.glob_thres , params.hbos_max_bins );
5858 loadPerFunctionThresholds (alg,params.func_threshold_file );
5959 return alg;
6060 }
6161 else if (algorithm == " copod" || algorithm == " COPOD" ) {
62- ADOutlierCOPOD* alg = new ADOutlierCOPOD (params.stat , params.hbos_thres );
62+ ADOutlierCOPOD* alg = new ADOutlierCOPOD (rank, params.stat , params.hbos_thres );
6363 loadPerFunctionThresholds (alg,params.func_threshold_file );
6464 return alg;
6565 }
@@ -111,8 +111,8 @@ void ADOutlier::updateGlobalModel()
111111 PerfTimer timer;
112112 timer.start ();
113113
114- if ( m_sync_call_count % m_global_model_sync_freq == 0 ){
115- verboseStream << " ADOutlier performing synchronization of local and global model" << std::endl;
114+ if ( m_sync_call_count == 0 || (m_sync_call_count + m_rank) % m_global_model_sync_freq == 0 ){ // apart from on first step, stagger updates over ranks by rank index
115+ verboseStream << " ADOutlier rank " << m_rank << " performing synchronization of local and global model on call count " << m_sync_call_count << std::endl;
116116 PerfTimer utimer;
117117 utimer.start ();
118118
@@ -144,7 +144,7 @@ void ADOutlier::setIgnoreFunction(const std::string &func){
144144/* ---------------------------------------------------------------------------
145145 * Implementation of ADOutlierSSTD class
146146 * --------------------------------------------------------------------------- */
147- ADOutlierSSTD::ADOutlierSSTD (OutlierStatistic stat, double sigma) : ADOutlier(stat), m_sigma(sigma) {
147+ ADOutlierSSTD::ADOutlierSSTD (int rank, OutlierStatistic stat, double sigma) : ADOutlier(rank, stat), m_sigma(sigma) {
148148 m_param = new SstdParam ();
149149 m_local_param = new SstdParam ();
150150}
@@ -281,7 +281,7 @@ unsigned long ADOutlierSSTD::compute_outliers(Anomalies &outliers,
281281/* ---------------------------------------------------------------------------
282282 * Implementation of ADOutlierHBOS class
283283 * --------------------------------------------------------------------------- */
284- ADOutlierHBOS::ADOutlierHBOS (OutlierStatistic stat, double threshold, bool use_global_threshold, int maxbins) : ADOutlier(stat), m_alpha(78.88e-32 ), m_threshold(threshold), m_use_global_threshold(use_global_threshold), m_maxbins(maxbins) {
284+ ADOutlierHBOS::ADOutlierHBOS (int rank, OutlierStatistic stat, double threshold, bool use_global_threshold, int maxbins) : ADOutlier(rank, stat), m_alpha(78.88e-32 ), m_threshold(threshold), m_use_global_threshold(use_global_threshold), m_maxbins(maxbins) {
285285 m_param = new HbosParam ();
286286 m_local_param = new HbosParam ();
287287}
@@ -531,7 +531,7 @@ unsigned long ADOutlierHBOS::compute_outliers(Anomalies &outliers,
531531/* ---------------------------------------------------------------------------
532532 * Implementation of ADOutlierCOPOD class
533533 * --------------------------------------------------------------------------- */
534- ADOutlierCOPOD::ADOutlierCOPOD (OutlierStatistic stat, double threshold, bool use_global_threshold) : ADOutlier(stat), m_alpha(78.88e-32 ), m_threshold(threshold), m_use_global_threshold(use_global_threshold) {
534+ ADOutlierCOPOD::ADOutlierCOPOD (int rank, OutlierStatistic stat, double threshold, bool use_global_threshold) : ADOutlier(rank, stat), m_alpha(78.88e-32 ), m_threshold(threshold), m_use_global_threshold(use_global_threshold) {
535535 m_param = new CopodParam ();
536536 m_local_param = new CopodParam ();
537537}
0 commit comments