Commit e1924308 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

FeatureSpace add more clear temp reg

May fix the possible overwrite error
parent 5fb1d443
......@@ -1053,7 +1053,7 @@ void FeatureSpace::generate_and_project(std::shared_ptr<LossFunction> loss, std:
#endif
for(auto feat = _phi.begin() + _start_rung.back() + _mpi_comm->rank(); feat < _phi.end(); feat += _mpi_comm->size())
{
unsigned long int feat_ind = _phi.size() + _n_sis_select * (omp_get_num_threads() + _mpi_comm->size());
unsigned long int feat_ind = _phi.size() + 2 * _n_sis_select * (omp_get_num_threads() + _mpi_comm->size());
node_value_arrs::clear_temp_reg_thread();
std::vector<node_ptr> generated_phi;
......@@ -1091,6 +1091,7 @@ void FeatureSpace::generate_and_project(std::shared_ptr<LossFunction> loss, std:
while((ii < inds.size()) && ((scores[inds[ii]] < worst_score) || (phi_sel_private.size() < _n_sis_select)))
{
node_value_arrs::clear_temp_reg_thread();
double cur_score = scores[inds[ii]];
int valid_feat = _is_valid(
generated_phi[inds[ii]]->stand_value_ptr(),
......@@ -1138,6 +1139,7 @@ void FeatureSpace::generate_and_project(std::shared_ptr<LossFunction> loss, std:
worst_score_ind = std::max_element(scores_sel.begin(), scores_sel.end()) - scores_sel.begin();
for(int sc = 0; sc < scores_sel_private.size(); ++sc)
{
node_value_arrs::clear_temp_reg_thread();
if(scores_sel_private[sc] > scores_sel[worst_score_ind])
{
continue;
......@@ -1178,7 +1180,7 @@ void FeatureSpace::generate_and_project(std::shared_ptr<LossFunction> loss, std:
// Go through all features and remove any that were valid, but no longer are due to new better features appearing. If _cross_cor_max == 1.0 then this is not necessary
if(_cross_cor_max < 0.99999)
{
int index_base = _phi.size() + _n_sis_select * _mpi_comm->rank();
int index_base = _phi.size() + 2 * _n_sis_select + _mpi_comm->rank();
std::vector<int> inds = util_funcs::argsort(scores_sel);
std::vector<node_ptr> phi_sel_copy(phi_sel);
......@@ -1193,6 +1195,7 @@ void FeatureSpace::generate_and_project(std::shared_ptr<LossFunction> loss, std:
int ii = 1;
while((ii < inds.size()) && (phi_sel.size() < _n_sis_select))
{
node_value_arrs::clear_temp_reg_thread();
if(
_is_valid_feat_list(
phi_sel_copy[inds[ii]]->stand_value_ptr(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment