C-optimized tweaks.
This commit is contained in:
parent
28d443a6cf
commit
c35ddcc358
|
@ -37,7 +37,7 @@ format: $(SRC)
|
||||||
$(FORMATTER) $(SRC)
|
$(FORMATTER) $(SRC)
|
||||||
|
|
||||||
run: $(SRC) $(OUTPUT)
|
run: $(SRC) $(OUTPUT)
|
||||||
export OMP_NUM_THREADS=4; ./$(OUTPUT)
|
OMP_NUM_THREADS=4 ./$(OUTPUT)
|
||||||
|
|
||||||
test: $(SRC) $(OUTPUT)
|
test: $(SRC) $(OUTPUT)
|
||||||
OMP_NUM_THREADS=1 ./$(OUTPUT)
|
OMP_NUM_THREADS=1 ./$(OUTPUT)
|
||||||
|
|
Binary file not shown.
|
@ -242,10 +242,12 @@ float split_array_sum(float** meta_array, int length, int divided_into)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
clock_t start, end;
|
|
||||||
start = clock();
|
|
||||||
//initialize randomness
|
//initialize randomness
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
|
clock_t start, end;
|
||||||
|
start = clock();
|
||||||
|
|
||||||
// Toy example
|
// Toy example
|
||||||
// Declare variables in play
|
// Declare variables in play
|
||||||
float p_a, p_b, p_c;
|
float p_a, p_b, p_c;
|
||||||
|
@ -268,9 +270,9 @@ int main()
|
||||||
mixture_f(samplers, weights, n_dists, dist_mixture, n_threads);
|
mixture_f(samplers, weights, n_dists, dist_mixture, n_threads);
|
||||||
printf("Sum(dist_mixture, N)/N = %f\n", split_array_sum(dist_mixture, N, n_threads) / N);
|
printf("Sum(dist_mixture, N)/N = %f\n", split_array_sum(dist_mixture, N, n_threads) / N);
|
||||||
|
|
||||||
end = clock();
|
|
||||||
split_array_free(dist_mixture, n_threads);
|
split_array_free(dist_mixture, n_threads);
|
||||||
|
|
||||||
printf("Total time (ms): %f\n", ((double)(end - start)) / CLOCKS_PER_SEC * 1000);
|
end = clock();
|
||||||
|
printf("Time (ms): %f\n", ((double)(end - start)) / (CLOCKS_PER_SEC * 10) * 1000);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user