Add simple iteration option for regression runnersa dn save CPU

This commit is contained in:
Ion Gaztañaga
2018-09-25 09:06:33 +02:00
parent 72c7ef7801
commit f3e2c9cc73
7 changed files with 99 additions and 69 deletions

View File

@@ -268,15 +268,9 @@ void print_header()
int main(int argc, const char *argv[])
{
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
std::size_t numrep [] = { 300, 3000, 30000, 300000, 600000, 1500000, 3000000 };
#else
std::size_t numrep [] = { 20, 200, 2000, 20000, 40000, 100000, 200000 };
#endif
std::size_t numele [] = { 10000, 1000, 100, 10, 5, 2, 1 };
#else
//#define SINGLE_TEST
#define SIMPLE_IT
#ifdef SINGLE_TEST
#ifdef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS
std::size_t numrep[] = { 1000 };
#elif defined(NDEBUG)
@@ -285,6 +279,16 @@ int main(int argc, const char *argv[])
std::size_t numrep [] = { 1000 };
#endif
std::size_t numele [] = { 100 };
#elif defined(SIMPLE_IT)
std::size_t numrep [] = { 3 };
std::size_t numele [] = { 100 };
#else
#ifdef NDEBUG
std::size_t numrep [] = { 300, 3000, 30000, 300000, 600000, 1500000, 3000000 };
#else
std::size_t numrep [] = { 20, 200, 2000, 20000, 40000, 100000, 200000 };
#endif
std::size_t numele [] = { 10000, 1000, 100, 10, 5, 2, 1 };
#endif
bool csv_output = argc == 2 && (strcmp(argv[1], "--csv-output") == 0);

View File

@@ -146,21 +146,25 @@ int allocation_loop()
<< "-------------------------------------------\n"
<< std::endl;
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
unsigned int numrep [] = { /*10000, */10000, 100000, 1000000 };
#else
unsigned int numrep [] = { /*10000, */1000, 10000, 100000 };
#endif
unsigned int numele [] = { /*10000, */1000, 100, 10 };
#else
//#define SINGLE_TEST
#define SIMPLE_IT
#ifdef SINGLE_TEST
#ifdef NDEBUG
unsigned int numrep [] = { 50000 };
#else
unsigned int numrep [] = { 5000 };
#endif
unsigned int numele [] = { 100 };
#elif defined(SIMPLE_IT)
unsigned int numrep [] = { 3 };
unsigned int numele [] = { 100 };
#else
#ifdef NDEBUG
unsigned int numrep [] = { /*10000, */10000, 100000, 1000000 };
#else
unsigned int numrep [] = { /*10000, */1000, 10000, 100000 };
#endif
unsigned int numele [] = { /*10000, */1000, 100, 10 };
#endif
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){

View File

@@ -171,21 +171,25 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
int main(int argc, const char *argv[])
{
#define SINGLE_TEST
#ifndef SINGLE_TEST
//#define SINGLE_TEST
#define SIMPLE_IT
#ifdef SINGLE_TEST
#ifdef NDEBUG
unsigned int numit [] = { 10 };
#else
unsigned int numit [] = { 10 };
#endif
unsigned int numele [] = { 10000 };
#elif defined(SIMPLE_IT)
unsigned int numit [] = { 3 };
unsigned int numele[] = { 10000 };
#else
#ifdef NDEBUG
unsigned int numit [] = { 2000, 20000, 200000, 2000000 };
#else
unsigned int numit [] = { 100, 1000, 10000, 100000 };
#endif
unsigned int numele [] = { 10000, 1000, 100, 10 };
#else
#ifdef NDEBUG
unsigned int numit [] = { 2000 };
#else
unsigned int numit [] = { 100 };
#endif
unsigned int numele [] = { 10000 };
#endif
bool csv_output = argc == 2 && (strcmp(argv[1], "--csv-output") == 0);

View File

@@ -170,21 +170,25 @@ void print_header()
int main()
{
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
unsigned int numit [] = { 1000, 10000, 100000, 1000000 };
#else
unsigned int numit [] = { 100, 1000, 10000, 100000 };
#endif
unsigned int numele [] = { 10000, 1000, 100, 10 };
#else
//#define SINGLE_TEST
#define SIMPLE_IT
#ifdef SINGLE_TEST
#ifdef NDEBUG
std::size_t numit [] = { 1000 };
#else
std::size_t numit [] = { 100 };
#endif
std::size_t numele [] = { 10000 };
#elif defined SIMPLE_IT
std::size_t numit [] = { 3 };
std::size_t numele [] = { 10000 };
#else
#ifdef NDEBUG
unsigned int numit [] = { 1000, 10000, 100000, 1000000 };
#else
unsigned int numit [] = { 100, 1000, 10000, 100000 };
#endif
unsigned int numele [] = { 10000, 1000, 100, 10 };
#endif
print_header();

View File

@@ -132,21 +132,25 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
int main(int argc, const char *argv[])
{
#define SINGLE_TEST
#ifndef SINGLE_TEST
//#define SINGLE_TEST
#define SIMPLE_IT
#ifdef SINGLE_TEST
#ifdef NDEBUG
unsigned int numit [] = { 10 };
#else
unsigned int numit [] = { 50 };
unsigned int numele[] = { 2000 };
#endif
#elif defined SIMPLE_IT
unsigned int numit [] = { 3 };
unsigned int numele[] = { 2000 };
#else
#ifdef NDEBUG
unsigned int numit [] = { 100, 1000, 10000 };
#else
unsigned int numit [] = { 10, 100, 1000 };
#endif
unsigned int numele [] = { 10000, 2000, 500 };
#else
#ifdef NDEBUG
unsigned int numit [] = { 500 };
#else
unsigned int numit [] = { 50 };
#endif
unsigned int numele [] = { 2000 };
#endif
bool csv_output = argc == 2 && (strcmp(argv[1], "--csv-output") == 0);

View File

@@ -221,21 +221,25 @@ void stable_vector_operations()
int main(int argc, const char *argv[])
{
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
unsigned int numit [] = { 40, 400, 4000, 40000 };
#else
unsigned int numit [] = { 4, 40, 400, 4000 };
#endif
unsigned int numele [] = { 10000, 1000, 100, 10 };
#else
//#define SINGLE_TEST
#define SIMPLE_IT
#ifdef SINGLE_TEST
#ifdef NDEBUG
unsigned int numit [] = { 40 };
#else
unsigned int numit [] = { 4 };
#endif
unsigned int numele [] = { 10000 };
#elif defined(SIMPLE_IT)
unsigned int numit [] = { 3 };
unsigned int numele [] = { 10000 };
#else
#ifdef NDEBUG
unsigned int numit [] = { 40, 400, 4000, 40000 };
#else
unsigned int numit [] = { 4, 40, 400, 4000 };
#endif
unsigned int numele [] = { 10000, 1000, 100, 10 };
#endif
//Warning: range erasure is buggy. Vector iterators are not stable, so it is not

View File

@@ -24,13 +24,19 @@ using boost::timer::cpu_timer;
using boost::timer::cpu_times;
using boost::timer::nanosecond_type;
#define SIMPLE_IT
#ifdef SIMPLE_IT
static const std::size_t NIter = 3;
#else
#ifdef NDEBUG
static const std::size_t NIter = 250;
#else
static const std::size_t NIter = 25;
#endif
#endif
static const std::size_t NElements = 1000;
#ifdef NDEBUG
static const std::size_t NIter = 250;
#else
static const std::size_t NIter = 25;
#endif
void compare_times(cpu_times time_numerator, cpu_times time_denominator){
std::cout << ((double)time_numerator.wall/(double)time_denominator.wall) << std::endl;
@@ -290,8 +296,8 @@ cpu_times search_time(boost::container::vector<typename C::value_type> &unique_r
{
find_timer.resume();
for(std::size_t rep = 0; rep != 2; ++rep)
for(std::size_t i = 0, max = unique_range.size(); i != max; ++i){
v_it[i] = c.find(unique_range[i]);
for(std::size_t j = 0, max = unique_range.size(); j != max; ++j){
v_it[j] = c.find(unique_range[j]);
}
find_timer.stop();
if(!check_not_end(v_it, c.end())){
@@ -302,8 +308,8 @@ cpu_times search_time(boost::container::vector<typename C::value_type> &unique_r
{
lower_timer.resume();
for(std::size_t rep = 0; rep != 2; ++rep)
for(std::size_t i = 0, max = unique_range.size(); i != max; ++i){
v_it[i] = c.lower_bound(unique_range[i]);
for(std::size_t j = 0, max = unique_range.size(); j != max; ++j){
v_it[j] = c.lower_bound(unique_range[j]);
}
lower_timer.stop();
if(!check_not_end(v_it, c.end())){
@@ -314,8 +320,8 @@ cpu_times search_time(boost::container::vector<typename C::value_type> &unique_r
{
upper_timer.resume();
for(std::size_t rep = 0; rep != 2; ++rep)
for(std::size_t i = 0, max = unique_range.size(); i != max; ++i){
v_it[i] = c.upper_bound(unique_range[i]);
for(std::size_t j = 0, max = unique_range.size(); j != max; ++j){
v_it[j] = c.upper_bound(unique_range[j]);
}
upper_timer.stop();
if(!check_not_end(v_it, c.end(), 1u)){
@@ -326,8 +332,8 @@ cpu_times search_time(boost::container::vector<typename C::value_type> &unique_r
{
equal_range_timer.resume();
for(std::size_t rep = 0; rep != 2; ++rep)
for(std::size_t i = 0, max = unique_range.size(); i != max; ++i){
v_itp[i] = c.equal_range(unique_range[i]);
for(std::size_t j = 0, max = unique_range.size(); j != max; ++j){
v_itp[j] = c.equal_range(unique_range[j]);
}
equal_range_timer.stop();
if(!check_all_not_empty(v_itp)){
@@ -339,8 +345,8 @@ cpu_times search_time(boost::container::vector<typename C::value_type> &unique_r
std::size_t count = 0;
count_timer.resume();
for(std::size_t rep = 0; rep != 2; ++rep)
for(std::size_t i = 0, max = unique_range.size(); i != max; ++i){
count += c.count(unique_range[i]);
for(std::size_t j = 0, max = unique_range.size(); j != max; ++j){
count += c.count(unique_range[j]);
}
count_timer.stop();
if(count/2 != c.size()){