Skip to content
Snippets Groups Projects
Commit b51a72f7 authored by Stefan Lankes's avatar Stefan Lankes
Browse files

add option to define num_steps by the command line

parent 5d46f7d9
No related branches found
No related tags found
No related merge requests found
Pipeline #1518568 passed
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <sys/time.h> #include <sys/time.h>
volatile int SEM = 1; volatile int SEM = 1;
int num_steps = 10000000; long long num_steps = 10000000;
double step; double step;
double sum; double sum;
...@@ -47,6 +47,13 @@ int main(int argc, char** argv) ...@@ -47,6 +47,13 @@ int main(int argc, char** argv)
thread_param thr_arg[MAX_THREADS]; thread_param thr_arg[MAX_THREADS];
struct timeval start, end; struct timeval start, end;
if (argc > 1)
num_steps = atoll(argv[1]);
if (num_steps < 100)
num_steps = 1000000;
printf("\nnum_steps = %lld\n", num_steps);
step = 1.0 / (double)num_steps; step = 1.0 / (double)num_steps;
sum = 0.0; sum = 0.0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment