Skip to content
Snippets Groups Projects
Commit 5799c010 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Add time printing lines

parent 8f0ade75
Branches
No related tags found
No related merge requests found
......@@ -78,15 +78,39 @@ void SISSORegressor::set_error(std::vector<int>& inds, double* coeffs)
void SISSORegressor::fit()
{
std::vector<double> residual(_n_samp);
std::clock_t start;
double duration;
start = std::clock();
_feat_space->sis(_prop);
_mpi_comm->barrier();
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
if(_mpi_comm->rank() == 0)
std::cout << "Time for SIS: " << duration << std::endl;
start = std::clock();
std::vector<node_ptr> min_node(1, _feat_space->phi_selected()[0]);
_models.push_back(Model(_prop, min_node));
_models[_models.size() - 1].copy_error(residual.data());
_mpi_comm->barrier();
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
if(_mpi_comm->rank() == 0)
std::cout << "Time for Model: " << duration << std::endl;
for(int dd = 2; dd <= _n_dim; ++dd)
{
start = std::clock();
_feat_space->sis(residual);
_mpi_comm->barrier();
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
if(_mpi_comm->rank() == 0)
std::cout << "Time for SIS: " << duration << std::endl;
start = std::clock();
l0_norm(residual, dd);
_mpi_comm->barrier();
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
if(_mpi_comm->rank() == 0)
std::cout << "Time for l0-norm: " << duration << std::endl;
_models[_models.size() - 1].copy_error(residual.data());
}
}
......
......@@ -3,6 +3,7 @@
#include <feature_creation/feature_space/FeatureSpace.hpp>
#include <descriptor_identifier/Model/Model.hpp>
#include <ctime>
/**
* @brief SISSO Regressor class, to find the best models, and store them
......@@ -124,4 +125,4 @@ public:
};
#endif
\ No newline at end of file
#endif
......@@ -131,7 +131,6 @@ void FeatureSpace::generate_feature_space()
std::vector<std::vector<node_ptr>> next_phi_gathered;
mpi::all_gather(*_mpi_comm, next_phi, next_phi_gathered);
std::cout << nn << " set values" << std::endl;
for(auto& next_phi_vec : next_phi_gathered)
{
_phi.reserve(_phi.size() + next_phi_vec.size());
......
......@@ -132,7 +132,6 @@ void InputParser::generate_feature_space(std::shared_ptr<MPI_Interface> comm)
}
node_value_arrs::setup_values_arr(_prop.size(), std::min(_max_rung, 2), headers.size(), _opset);
std::cout << node_value_arrs::get_max_number_features(_opset, _max_rung, headers.size()) << std::endl;
std::vector<node_ptr> phi_0;
for(int ff = 0; ff < headers.size(); ++ff)
phi_0.push_back(std::make_shared<FeatureNode>(ff, headers[ff], data[ff], units[ff]));
......
......@@ -25,13 +25,17 @@ int main(int argc, char const *argv[])
//construct the parser and pass it to the inputs
boost::property_tree::ptree propTree;
boost::property_tree::json_parser::read_json(filename,propTree);
std::clock_t start;
start = std::clock();
InputParser IP(propTree, filename, comm);
boost::filesystem::remove(filename);
if(comm->rank() == 0)
boost::filesystem::remove(filename);
std::cout << "FEAT_MADE" << std::endl;
comm->barrier();
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
if(comm->rank() == 0)
std::cout<< "time input_parsing/Feature space generation: "<< duration << std::endl;
SISSORegressor sisso(IP._feat_space, IP._prop, IP._n_dim);
sisso.fit();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment