Cleanup to benchmark.cpp

This commit is contained in:
Wes Bethel 2022-10-19 15:25:41 -07:00
parent 9185be7074
commit 760ae0cc77

View File

@ -23,30 +23,16 @@ int main(int argc, char** argv)
{
std::cout << std::fixed << std::setprecision(2);
printf(" hello world \n");
std::vector<int> test_sizes{64, 128, 256, 512, 1024, 2048};
//#define MAX_PROBLEM_SIZE 500000000
//#define MAX_PROBLEM_SIZE 1 << 20 // 1M
//#define MAX_PROBLEM_SIZE 1 << 24 // 16M
//#define MAX_PROBLEM_SIZE 1 << 27 // 128M
#define MAX_PROBLEM_SIZE 1 << 28 // 256M
//#define MAX_PROBLEM_SIZE 1 << 30 // 1 G
//std::vector<int64_t> problem_sizes{100000, 500000, 1000000, 5000000, 10000000, 50000000, 100000000, MAX_PROBLEM_SIZE};
//std::vector<int64_t> problem_sizes{ MAX_PROBLEM_SIZE};
std::vector<int64_t> problem_sizes{ MAX_PROBLEM_SIZE >> 5, MAX_PROBLEM_SIZE >> 4, MAX_PROBLEM_SIZE >> 3, MAX_PROBLEM_SIZE >> 2, MAX_PROBLEM_SIZE >> 1, MAX_PROBLEM_SIZE};
std::vector<uint64_t> A(MAX_PROBLEM_SIZE);
//int A[MAX_PROBLEM_SIZE]; // buffer big enough for all problem sizes
// int A[MAX_PROBLEM_SIZE]; // buffer big enough for all problem sizes
int64_t t;
int n_problems = problem_sizes.size();
printf(" hello world again \n");
/* For each test size */
for (int n : problem_sizes)
{
@ -55,12 +41,12 @@ int main(int argc, char** argv)
// invoke user code to set up the problem
setup(n, &A[0]);
// insert timer code here
// insert your timer code here
// invoke method to perform the sum
t = sum(n, &A[0]);
// insert end timer code here, and print out elapsed time for this problem size
// insert your end timer code here, and print out elapsed time for this problem size
printf(" Sum result = %lld \n",t);