Commit 75513ce2 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Remove temp storage size restriction

this is causing a bug somehow
parent dd0a49e4
......@@ -28,7 +28,6 @@ FeatureSpace::FeatureSpace(
int n_sis_select,
int max_store_rung,
int n_rung_generate,
int max_temp_store,
double min_abs_feat_val,
double max_abs_feat_val
):
......@@ -47,8 +46,7 @@ FeatureSpace::FeatureSpace(
_n_samp(phi_0[0]->n_samp()),
_n_feat(phi_0.size()),
_n_rung_store(max_store_rung),
_n_rung_generate(n_rung_generate),
_max_temp_store(max_temp_store)
_n_rung_generate(n_rung_generate)
{
if(_mpi_comm->rank() == 0)
......@@ -58,8 +56,6 @@ FeatureSpace::FeatureSpace(
out_file_stream << std::setw(14) <<std::left << "# FEAT_ID" << std::setw(24) << std::left << "Score" << "Feature Expression" << std::endl;
out_file_stream.close();
}
if(_max_temp_store != -1)
_max_temp_store /= 3;
_project = project_funcs::project_r;
......@@ -238,10 +234,7 @@ void FeatureSpace::generate_feature_space(std::vector<double>& prop)
if(nn <= _n_rung_store)
{
bool use_temp = (nn != _max_phi) || (_max_phi > _n_rung_store);
if(_max_temp_store == -1)
node_value_arrs::resize_values_arr(_n_rung_store, _phi.size(), _phi.size(), use_temp);
else
node_value_arrs::resize_values_arr(_n_rung_store, _phi.size(), _max_temp_store, use_temp);
node_value_arrs::resize_values_arr(nn, _phi.size(), use_temp);
for(int ff = _start_gen[0]; ff < _phi.size(); ++ff)
{
......@@ -380,11 +373,7 @@ void FeatureSpace::generate_feature_space(std::vector<double>& prop)
if(_max_phi <= _n_rung_store)
{
bool use_temp = (_max_phi > _n_rung_store);
if(_max_temp_store == -1)
node_value_arrs::resize_values_arr(_n_rung_store, _phi.size(), _phi.size(), use_temp);
else
node_value_arrs::resize_values_arr(_n_rung_store, _phi.size(), _max_temp_store, use_temp);
node_value_arrs::resize_values_arr(nn, _phi.size(), use_temp);
}
for(int ff = _start_gen.back(); ff < _phi.size(); ++ff)
{
......
......@@ -71,7 +71,6 @@ public:
int n_sis_select=1,
int max_store_rung=2,
int n_rung_generate=0,
int max_temp_store=-1,
double min_abs_feat_val=1e-50,
double max_abs_feat_val=1e50
);
......
......@@ -3,7 +3,6 @@
int node_value_arrs::N_SELECTED;
int node_value_arrs::N_SAMPLES;
int node_value_arrs::N_STORE_FEATURES;
int node_value_arrs::N_TEMP_STORE_FEATURES;
int node_value_arrs::N_RUNGS_STORED;
int node_value_arrs::N_SAMPLES_TEST;
......@@ -63,25 +62,23 @@ void node_value_arrs::initialize_values_arr(int n_samples, int n_samples_test, i
N_SAMPLES_TEST = n_samples_test;
N_RUNGS_STORED = 0;
N_STORE_FEATURES = n_primary_feat;
N_TEMP_STORE_FEATURES = n_primary_feat;
VALUES_ARR = std::vector<double>(N_TEMP_STORE_FEATURES * N_SAMPLES);
TEST_VALUES_ARR = std::vector<double>(N_TEMP_STORE_FEATURES * N_SAMPLES_TEST);
VALUES_ARR = std::vector<double>(N_STORE_FEATURES * N_SAMPLES);
TEST_VALUES_ARR = std::vector<double>(N_STORE_FEATURES * N_SAMPLES_TEST);
TEMP_STORAGE_ARR = std::vector<double>(3 * N_TEMP_STORE_FEATURES * N_SAMPLES);
TEMP_STORAGE_REG = std::vector<int>(3 * N_TEMP_STORE_FEATURES, -1);
TEMP_STORAGE_ARR = std::vector<double>(3 * N_STORE_FEATURES * N_SAMPLES);
TEMP_STORAGE_REG = std::vector<int>(3 * N_STORE_FEATURES, -1);
TEMP_STORAGE_TEST_ARR = std::vector<double>(3 * N_TEMP_STORE_FEATURES * N_SAMPLES_TEST);
TEMP_STORAGE_TEST_REG = std::vector<int>(3 * N_TEMP_STORE_FEATURES, -1);
TEMP_STORAGE_TEST_ARR = std::vector<double>(3 * N_STORE_FEATURES * N_SAMPLES_TEST);
TEMP_STORAGE_TEST_REG = std::vector<int>(3 * N_STORE_FEATURES, -1);
}
void node_value_arrs::resize_values_arr(int n_dims, int n_feat, int max_temp_store, bool use_temp)
void node_value_arrs::resize_values_arr(int n_dims, int n_feat, bool use_temp)
{
N_RUNGS_STORED = n_dims;
N_STORE_FEATURES = n_feat;
N_TEMP_STORE_FEATURES = std::min(n_feat, max_temp_store);
if(N_TEMP_STORE_FEATURES == 0)
N_TEMP_STORE_FEATURES = 1;
if(N_STORE_FEATURES == 0)
N_STORE_FEATURES = 1;
VALUES_ARR.resize(N_STORE_FEATURES * N_SAMPLES);
VALUES_ARR.shrink_to_fit();
......@@ -91,16 +88,16 @@ void node_value_arrs::resize_values_arr(int n_dims, int n_feat, int max_temp_sto
if(use_temp)
{
TEMP_STORAGE_ARR.resize(3 * N_TEMP_STORE_FEATURES * N_SAMPLES);
TEMP_STORAGE_ARR.resize(3 * N_STORE_FEATURES * N_SAMPLES);
TEMP_STORAGE_ARR.shrink_to_fit();
TEMP_STORAGE_REG.resize(3 * N_TEMP_STORE_FEATURES, - 1);
TEMP_STORAGE_REG.resize(3 * N_STORE_FEATURES, - 1);
TEMP_STORAGE_REG.shrink_to_fit();
TEMP_STORAGE_TEST_ARR.resize(3 * N_TEMP_STORE_FEATURES * N_SAMPLES_TEST);
TEMP_STORAGE_TEST_ARR.resize(3 * N_STORE_FEATURES * N_SAMPLES_TEST);
TEMP_STORAGE_TEST_ARR.shrink_to_fit();
TEMP_STORAGE_TEST_REG.resize(3 * N_TEMP_STORE_FEATURES, - 1);
TEMP_STORAGE_TEST_REG.resize(3 * N_STORE_FEATURES, - 1);
TEMP_STORAGE_TEST_REG.shrink_to_fit();
}
else
......@@ -116,7 +113,7 @@ double* node_value_arrs::get_value_ptr(int arr_ind, int feat_ind, int offset)
return access_value_arr(arr_ind);
temp_storage_reg(arr_ind, offset) = feat_ind;
return access_temp_storage((arr_ind % N_TEMP_STORE_FEATURES) + (offset % 3) * N_TEMP_STORE_FEATURES);
return access_temp_storage((arr_ind % N_STORE_FEATURES) + (offset % 3) * N_STORE_FEATURES);
}
double* node_value_arrs::get_test_value_ptr(int arr_ind, int feat_ind, int offset)
......@@ -125,7 +122,7 @@ double* node_value_arrs::get_test_value_ptr(int arr_ind, int feat_ind, int offse
return access_test_value_arr(arr_ind);
temp_storage_test_reg(arr_ind, offset) = feat_ind;
return access_temp_storage_test((arr_ind % N_TEMP_STORE_FEATURES) + (offset % 3) * N_TEMP_STORE_FEATURES);
return access_temp_storage_test((arr_ind % N_STORE_FEATURES) + (offset % 3) * N_STORE_FEATURES);
}
void node_value_arrs::initialize_d_matrix_arr()
......
......@@ -21,7 +21,6 @@ namespace node_value_arrs
extern int N_SAMPLES; //!< Number of samples in the nodes
extern int N_SAMPLES_TEST; //!< Number of samples in the nodes
extern int N_STORE_FEATURES; //!< Number of features with stored values
extern int N_TEMP_STORE_FEATURES; //!< Number of feature that can be stored in TEMP_STORAGE ARRs values
extern int N_RUNGS_STORED; //!< Number of rungs with values stored
......@@ -63,7 +62,7 @@ namespace node_value_arrs
* @param n_feat number of features to store
* @param use_temp If true keep the temporary_storage
*/
void resize_values_arr(int n_dims, int n_feat, int max_temp_store, bool use_temp);
void resize_values_arr(int n_dims, int n_feat, bool use_temp);
/**
* @brief set of the value arrays
......@@ -90,7 +89,7 @@ namespace node_value_arrs
*
* @return The register element for a given feature index and offset
*/
inline int& temp_storage_reg(int ind, int offset = 0){return TEMP_STORAGE_REG[(ind % N_TEMP_STORE_FEATURES) + (offset % 3) * N_TEMP_STORE_FEATURES];}
inline int& temp_storage_reg(int ind, int offset = 0){return TEMP_STORAGE_REG[(ind % N_STORE_FEATURES) + (offset % 3) * N_STORE_FEATURES];}
/**
* @brief Get a reference slot/feature test register
......@@ -100,7 +99,7 @@ namespace node_value_arrs
*
* @return The register element for a given feature index and offset
*/
inline int& temp_storage_test_reg(int ind, int offset = 0){return TEMP_STORAGE_TEST_REG[(ind % N_TEMP_STORE_FEATURES) + (offset % 3) * N_TEMP_STORE_FEATURES];}
inline int& temp_storage_test_reg(int ind, int offset = 0){return TEMP_STORAGE_TEST_REG[(ind % N_STORE_FEATURES) + (offset % 3) * N_STORE_FEATURES];}
/**
* @brief Access element of the permanent storage array
......
......@@ -14,8 +14,7 @@ InputParser::InputParser(boost::property_tree::ptree IP, std::string fn, std::sh
_max_store_rung(IP.get<int>("n_rung_store", _max_rung - 1)),
_n_rung_generate(IP.get<int>("n_rung_generate", 0)),
_n_samp(0),
_n_residuals(IP.get<int>("n_residual", 1)),
_max_temp_store(IP.get<int>("max_temp_storage", -1))
_n_residuals(IP.get<int>("n_residual", 1))
{
std::ifstream data_stream;
std::string line;
......@@ -269,7 +268,7 @@ void InputParser::generate_feature_space(std::shared_ptr<MPI_Interface> comm, st
for(int ff = 0; ff < headers.size(); ++ff)
phi_0.push_back(std::make_shared<FeatureNode>(ff, headers[ff], data[ff], test_data[ff], units[ff]));
_feat_space = std::make_shared<FeatureSpace>(comm, phi_0, _opset, _prop_train, _task_sizes_train, _max_rung, _n_sis_select, _max_store_rung, _n_rung_generate, _max_temp_store, _l_bound, _u_bound);
_feat_space = std::make_shared<FeatureSpace>(comm, phi_0, _opset, _prop_train, _task_sizes_train, _max_rung, _n_sis_select, _max_store_rung, _n_rung_generate, _l_bound, _u_bound);
}
void stripComments(std::string& filename)
......
......@@ -50,7 +50,6 @@ public:
int _n_sis_select;
int _n_samp;
int _n_residuals;
int _max_temp_store; //!< Maximum number of features to store in temporary storage
InputParser(boost::property_tree::ptree IP, std::string fn, std::shared_ptr<MPI_Interface> comm);
inline std::shared_ptr<FeatureSpace> feat_space(){return _feat_space;}
......
Supports Markdown
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