tweak: link math library.

This commit is contained in:
NunoSempere 2023-05-29 17:47:52 -04:00
parent 7d1919dc3d
commit 5cfc4ab468
2 changed files with 7 additions and 5 deletions

View File

@ -21,14 +21,14 @@ STANDARD=-std=c99
WARNINGS=-Wall
OPTIMIZED=-O3 #-O3 actually gives better performance than -Ofast, at least for this version
OPENMP=-fopenmp
MATH=-lm
## Formatter
STYLE_BLUEPRINT=webkit
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
## make build
build: $(SRC)
$(CC) $(OPTIMIZED) $(DEBUG) $(OPENMP) $(SRC) -o $(OUTPUT)
$(CC) $(OPTIMIZED) $(DEBUG) $(OPENMP) $(SRC) $(MATH) -o $(OUTPUT)
#fast: Has been removed, compilation of "build" is very fast and it outputs optimized code by default
@ -36,6 +36,7 @@ format: $(SRC)
$(FORMATTER) $(SRC)
run: $(SRC) $(OUTPUT)
./$(OUTPUT)
# echo "Increasing stack size limit, because we are dealing with 1M samples"
# # ulimit: increase stack size limit
# # -Ss: the soft limit. If you set the hard limit, you then can't raise it
@ -43,7 +44,8 @@ run: $(SRC) $(OUTPUT)
# # Then run the program
# ulimit -Ss 256000 && ./$(OUTPUT)
linux:
sudo apt-get install libomp-dev
# Old:
# Link libraries, for good measure

View File

@ -258,11 +258,11 @@ int main() {
float (*samplers[])(void) = {sample_0, sample_1, sample_few, sample_many};
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);
printf("Total time (ms): %f\n", ((double) (end-start)) / CLOCKS_PER_SEC * 1000);
return 0;
}
}