diff --git a/src/feature_creation/feature_space/FeatureSpace.cpp b/src/feature_creation/feature_space/FeatureSpace.cpp index 3c2c3fae597ae18b8042a1f280708df800ee1f13..9d5f632ccbf7082a14e4c24015c26bdb5f986f86 100644 --- a/src/feature_creation/feature_space/FeatureSpace.cpp +++ b/src/feature_creation/feature_space/FeatureSpace.cpp @@ -516,6 +516,10 @@ void FeatureSpace::generate_feature_space() } } node_value_arrs::clear_temp_reg(); + for(int ff = _start_gen.back(); ff < _phi.size(); ++ff) + { + _phi[ff]->reset_feats(_phi); + } if(nn <= _n_rung_store) { @@ -828,6 +832,8 @@ void FeatureSpace::sis(const std::vector<double>& prop) #ifdef PARAMETERIZE if(_reparam_residual && (_phi_selected.size() > 0)) { + double start_time = omp_get_wtime(); + // Make a hard copy of the previously selected features node_ptr copy; for(int ff = _phi_selected.size() - _n_sis_select; ff < _phi_selected.size(); ++ff) @@ -862,6 +868,12 @@ void FeatureSpace::sis(const std::vector<double>& prop) _phi[ff]->set_value(); _phi[ff]->test_value(); } + + _mpi_comm->barrier(); + if(_mpi_comm->rank() == 0) + { + std::cout << "The time for reparameterization: " << omp_get_wtime() - start_time << " s" << std::endl; + } } #endif // Create output directories if needed @@ -885,13 +897,13 @@ void FeatureSpace::sis(const std::vector<double>& prop) _phi_selected.reserve(_phi_selected.size() + _n_sis_select); // Get projection scores - double start = omp_get_wtime(); + double start_time = omp_get_wtime(); _project(prop.data(), _scores.data(), _phi, _task_sizes, prop.size() / _n_samp); _mpi_comm->barrier(); if(_mpi_comm->rank() == 0) { - std::cout << "Projection time: " << omp_get_wtime() - start << " s" << std::endl; + std::cout << "Projection time: " << omp_get_wtime() - start_time << " s" << std::endl; } // Sort the scores to get inds @@ -914,7 +926,7 @@ void FeatureSpace::sis(const std::vector<double>& prop) } // Get the best features currently generated on this rank - start = omp_get_wtime(); + start_time = omp_get_wtime(); while((cur_feat_local != _n_sis_select) && (ii < _scores.size())) { if(_is_valid(_phi[inds[ii]]->value_ptr(), _n_samp, _cross_cor_max, scores_sel_all, _scores[inds[ii]], cur_feat + cur_feat_local, 0)) @@ -934,7 +946,7 @@ void FeatureSpace::sis(const std::vector<double>& prop) _mpi_comm->barrier(); if(_mpi_comm->rank() == 0) { - std::cout << "Time to get best features on rank : " << omp_get_wtime() - start << " s" << std::endl; + std::cout << "Time to get best features on rank : " << omp_get_wtime() - start_time << " s" << std::endl; } @@ -948,7 +960,7 @@ void FeatureSpace::sis(const std::vector<double>& prop) // Generate features on the fly and get the best features for this rank if(_n_rung_generate > 0) { - start = omp_get_wtime(); + start_time = omp_get_wtime(); phi_sel.resize(cur_feat_local); scores_sel.resize(cur_feat_local); @@ -957,14 +969,14 @@ void FeatureSpace::sis(const std::vector<double>& prop) _mpi_comm->barrier(); if(_mpi_comm->rank() == 0) { - std::cout << "Projection time for features generated on the fly: " << omp_get_wtime() - start << " s" << std::endl; + std::cout << "Projection time for features generated on the fly: " << omp_get_wtime() - start_time << " s" << std::endl; } } // Reset scores std::fill_n(&scores_sel_all[cur_feat], _n_sis_select, 0.0); // If we are only on one process then phi_sel are the selected features - start = omp_get_wtime(); + start_time = omp_get_wtime(); if(_mpi_comm->size() > 1) { // Collect the best features from all ranks @@ -973,7 +985,6 @@ void FeatureSpace::sis(const std::vector<double>& prop) { local_sel[ff] = mpi_reduce_op::make_node_sc_pair(phi_sel[ff], scores_sel[ff]); } - std::vector<node_sc_pair> selected(_n_sis_select); mpi::all_reduce( *_mpi_comm, @@ -982,11 +993,9 @@ void FeatureSpace::sis(const std::vector<double>& prop) mpi_reduce_op::select_top_feats ); - // Move the selected features to _phi_selected and set the value properly _mpi_comm->barrier(); - cur_feat_local = 0; - for(auto& sel : selected) + cur_feat_local = 0; for(auto& sel : selected) { _phi_selected.push_back(std::get<0>(sel)); _phi_selected.back()->set_selected(true); @@ -1062,7 +1071,7 @@ void FeatureSpace::sis(const std::vector<double>& prop) if(_mpi_comm->rank() == 0) { - std::cout << "Complete final combination/selection from all ranks: " << omp_get_wtime() - start << " s" << std::endl; + std::cout << "Complete final combination/selection from all ranks: " << omp_get_wtime() - start_time << " s" << std::endl; out_file_stream << "#"; for(int dd = 0; dd < 71; ++dd) {