time reporting script

parent af128108
......@@ -21,6 +21,7 @@ then
export LD_LIBRARY_PATH="$TINYGB_PATH/lib";
scripts/provide_wdir.sh build/tinygb WORKING_DIR $1
export LD_LIBRARY_PATH=$OLD_LD_PATH
$TINYGB_PATH/scripts/time_report.sh
else
echo "Compilation failed."
fi
#!/bin/bash
for step in selcrit selred buildmats utsolve matmulsub \
rowech addcrit
do
step_time=$(grep $step /tmp/log_tinygb | \
awk 'NR % 2 == 0 {s+=$1} NR % 2 == 1 {s-=$1} END {print s}')
printf "%-9s %8ds\n" $step $step_time
done
......@@ -112,7 +112,7 @@ void addcrit(const std::string& mat_newpols_file,
int
main(int argc, char **argv) {
tinygb::Logger("/tmp/log_tinygb").log("addcrit start");
tinygb::Logger("/tmp/log_tinygb").log("addcrit start");
(void)argc; // To get rid of the warning -Wunused-parameter argc
tinygb::WORKDIR = (std::string)argv[1];
......@@ -120,7 +120,7 @@ main(int argc, char **argv) {
TINYGB_TRY(tinygb::load_glob_params(tinygb::WORKDIR + "/global_parameters.txt"), "addcrit");
tinygb::addcrit(argv[2], argv[3], argv[4]);
tinygb::Logger("/tmp/log_tinygb").log("addcrit stop");
tinygb::Logger("/tmp/log_tinygb").log("addcrit stop");
return EXIT_SUCCESS;
}
......
......@@ -57,8 +57,8 @@ std::vector<Polynomial> F4() {
(!MAXSTEP_FLAG || step_number < MAXSTEP) &&
(!STOP_CRITERION || !stop_crit)) {
std::cerr << "step " << step_number << std::endl;
Logger("/tmp/log_tinygb").log("step " + std::to_string(step_number));
std::cerr << "STEP " << step_number << std::endl;
Logger("/tmp/log_tinygb").log("--- STEP " + std::to_string(step_number) + " ---");
TINYGB_TRY(SaveCritPairs("critpairs_glob.txt", global_critical_pairs), "f4");
std::system(("build/selcrit/selcrit " + WORKDIR + " critpairs_glob.txt critpairs_step.txt").c_str());
......
......@@ -6,5 +6,9 @@ void Logger::log(const std::string& s) {
std::system(("echo $(date +\"%s\") \"" + s + "\" >> " + filename_).c_str());
}
void Logger::erase() {
std::system(("rm -f " + filename_).c_str());
}
} // namespace tinygb
......@@ -11,6 +11,7 @@ class Logger {
: filename_(filename) {}
void log(const std::string& s);
void erase();
private:
std::string filename_;
......
......@@ -4,6 +4,7 @@
#include <unistd.h>
#include "./glob_params.h"
#include "./f4_launcher.h"
#include "./logger.h"
void usage() {
std::cerr << "usage: tinygb WORKDIR INPUTSYS [OPTIONS]" << std::endl;
......@@ -28,6 +29,7 @@ void usage() {
}
int main(int argc, char** argv) {
tinygb::Logger("/tmp/log_tinygb").erase();
int c;
int flag_output_file = 0;
std::ostream* output = &std::cout;
......
......@@ -61,7 +61,7 @@ rowech(std::string resD_file, std::string resB_file,
int
main(int argc, char **argv) {
tinygb::Logger("/tmp/log_tinygb").log("rowech start");
tinygb::Logger("/tmp/log_tinygb").log("rowech start");
(void)argc; // To get rid of the warning -Wunused-parameter argc
......@@ -70,7 +70,7 @@ main(int argc, char **argv) {
TINYGB_TRY(tinygb::load_glob_params(tinygb::WORKDIR + "/global_parameters.txt"), "rowech");
tinygb::rowech(argv[2], argv[3], argv[4], argv[5]);
tinygb::Logger("/tmp/log_tinygb").log("rowech stop");
tinygb::Logger("/tmp/log_tinygb").log("rowech stop");
return EXIT_SUCCESS;
}
......@@ -27,7 +27,7 @@ void selcrit(const std::string& infile,
} // namespace tinygb
int main(int argc, char **argv) {
tinygb::Logger("/tmp/log_tinygb").log("selcrit start");
tinygb::Logger("/tmp/log_tinygb").log("selcrit start");
(void)argc; // To get rid of the warning -Wunused-parameter argc
......@@ -36,7 +36,7 @@ int main(int argc, char **argv) {
TINYGB_TRY(tinygb::load_glob_params(tinygb::WORKDIR + "/global_parameters.txt"), "selcrit");
tinygb::selcrit(argv[2], argv[3]);
tinygb::Logger("/tmp/log_tinygb").log("selcrit end");
tinygb::Logger("/tmp/log_tinygb").log("selcrit stop");
return EXIT_SUCCESS;
}
......@@ -37,7 +37,7 @@ void selred(const std::string& critpairs_file,
} // namespace tinygb
int main(int argc, char **argv) {
tinygb::Logger("/tmp/log_tinygb").log("selred start");
tinygb::Logger("/tmp/log_tinygb").log("selred start");
(void)argc; // To get rid of the warning -Wunused-parameter argc
......@@ -50,7 +50,7 @@ int main(int argc, char **argv) {
mat_ids.push_back(argv[i]);
tinygb::selred(argv[2], argv[3], mat_ids);
tinygb::Logger("/tmp/log_tinygb").log("selred stop");
tinygb::Logger("/tmp/log_tinygb").log("selred stop");
return EXIT_SUCCESS;
}
......@@ -3,6 +3,7 @@ Import('env')
source_files = ['tinygb_init.cc',
'#src/givaro_wrapper.cc',
'#src/monomial.cc',
'#src/logger.cc',
'#src/critical_pair.cc',
'#src/polynomial_in_matrix.cc',
'#src/polynomial.cc',
......
......@@ -6,6 +6,7 @@
#include "linalg/storage_matrix.h"
#include "linalg/matrix_factory.h"
#include "./macros.h"
#include "./logger.h"
namespace tinygb {
......@@ -47,7 +48,6 @@ std::shared_ptr<const StorageMatrix> Interreduce(const std::vector<Polynomial>&
}
void tinygb_init(std::vector<Polynomial>& sys) {
std::vector<PolynomialInMatrix> gb;
std::vector<CriticalPair> global_critical_pairs;
std::vector<CriticalPair> step_critical_pairs;
......@@ -67,7 +67,7 @@ void tinygb_init(std::vector<Polynomial>& sys) {
} // namespace tinygb
int main(int argc, char **argv) {
std::cerr << "tinygb_init: start" << std::endl;
tinygb::Logger("/tmp/log_tinygb").log("tinygb_init start");
(void)argc; // To get rid of the warning -Wunused-parameter argc
tinygb::WORKDIR = (std::string)argv[1];
......@@ -90,6 +90,6 @@ int main(int argc, char **argv) {
TINYGB_TRY(file.close(), "tinygb_init");
std::cerr << "tinygb_init: end" << std::endl;
tinygb::Logger("/tmp/log_tinygb").log("tinygb_init end");
return EXIT_SUCCESS;
}
......@@ -25,7 +25,7 @@ void utsolve(std::string res_file, std::string matA_file, std::string matB_file)
}
int main(int argc, char **argv) {
tinygb::Logger("/tmp/log_tinygb").log("utsolve start");
tinygb::Logger("/tmp/log_tinygb").log("utsolve start");
(void)argc; // To get rid of the warning -Wunused-parameter argc
......@@ -34,7 +34,7 @@ int main(int argc, char **argv) {
TINYGB_TRY(tinygb::load_glob_params(tinygb::WORKDIR + "/global_parameters.txt"), "utsolve");
tinygb::utsolve(argv[2], argv[3], argv[4]);
tinygb::Logger("/tmp/log_tinygb").log("utsolve stop");
tinygb::Logger("/tmp/log_tinygb").log("utsolve stop");
return EXIT_SUCCESS;
}
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