Implemented everything pending Python chart generation
This commit is contained in:
parent
475aaf100f
commit
29b4f6b2ef
@ -14,7 +14,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
extern void setup(int64_t N, uint64_t A[]);
|
extern void setup(int64_t N, uint64_t A[]);
|
||||||
extern int64_t sum(int64_t N, uint64_t A[]);
|
extern int64_t sum(int64_t N, uint64_t A[]);
|
||||||
|
|
||||||
@ -40,11 +39,17 @@ int main(int argc, char** argv)
|
|||||||
setup(n, &A[0]);
|
setup(n, &A[0]);
|
||||||
|
|
||||||
// insert your timer code here
|
// insert your timer code here
|
||||||
|
std::chrono::time_point<std::chrono::high_resolution_clock> start_time = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
// invoke method to perform the sum
|
// invoke method to perform the sum
|
||||||
t = sum(n, &A[0]);
|
t = sum(n, &A[0]);
|
||||||
|
|
||||||
// insert your 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
|
||||||
|
std::chrono::time_point<std::chrono::high_resolution_clock> end_time = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
std::chrono::duration<double> elapsed = end_time - start_time;
|
||||||
|
|
||||||
|
std::cout << " Elapsed time is : " << elapsed.count() << " " << std::endl;
|
||||||
|
|
||||||
printf(" Sum result = %lld \n", t);
|
printf(" Sum result = %lld \n", t);
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ void
|
|||||||
setup(int64_t N, uint64_t A[])
|
setup(int64_t N, uint64_t A[])
|
||||||
{
|
{
|
||||||
printf(" inside direct_sum problem_setup, N=%lld \n", N);
|
printf(" inside direct_sum problem_setup, N=%lld \n", N);
|
||||||
|
result = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
@ -23,6 +24,6 @@ sum(int64_t N, uint64_t A[])
|
|||||||
{
|
{
|
||||||
result += i;
|
result += i;
|
||||||
}
|
}
|
||||||
return 0;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,19 +6,29 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
int64_t result;
|
||||||
|
|
||||||
void
|
void
|
||||||
setup(int64_t N, uint64_t A[])
|
setup(int64_t N, uint64_t A[])
|
||||||
{
|
{
|
||||||
printf(" inside sum_vector problem_setup, N=%lld \n", N);
|
printf(" inside sum_vector problem_setup, N=%lld \n", N);
|
||||||
|
result = 0;
|
||||||
|
for (int64_t i = 0; i < N; i++)
|
||||||
|
{
|
||||||
|
A[i] = i;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
sum(int64_t N, uint64_t A[])
|
sum(int64_t N, uint64_t A[])
|
||||||
{
|
{
|
||||||
printf(" inside sum_vector perform_sum, N=%lld \n", N);
|
printf(" inside sum_vector perform_sum, N=%lld \n", N);
|
||||||
|
for (int64_t i = 0; i < N; i++)
|
||||||
return 0;
|
{
|
||||||
|
result += A[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user