squiggle.c

Self-contained Monte Carlo estimation in C99
Log | Files | Refs | README

commit 48f333adfeea46098157593773c47c0604989590
parent b497b5b399b0bab278ac450b8d4a1fc55c79e16d
Author: NunoSempere <nuno.sempere@protonmail.com>
Date:   Sat, 13 Jan 2024 01:05:44 +0100

formatting pass; makefile tweaks

Diffstat:
Mexamples/more/00_example_template/example | 0
Mexamples/more/01_sample_from_cdf/example | 0
Mexamples/more/02_sample_from_cdf_beta/example | 0
Mexamples/more/03_ci_beta/example | 0
Mexamples/more/04_nuclear_war/example | 0
Mexamples/more/05_burn_10kg_fat/example | 0
Mexamples/more/06_nuclear_recovery/example | 0
Mexamples/more/07_algebra/example | 0
Mexamples/more/08_algebra_and_conversion/example | 0
Mexamples/more/09_ergonomic_algebra/example | 0
Mexamples/more/10_twitter_thread_example/example | 0
Mexamples/more/11_billion_lognormals_paralell/example | 0
Mexamples/more/12_time_to_botec_parallel/example | 0
Mexamples/more/13_parallelize_min/example | 0
Mexamples/more/14_check_confidence_interval/example | 0
Mmakefile | 6++++--
Msquiggle_more.c | 2+-
17 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/examples/more/00_example_template/example b/examples/more/00_example_template/example Binary files differ. diff --git a/examples/more/01_sample_from_cdf/example b/examples/more/01_sample_from_cdf/example Binary files differ. diff --git a/examples/more/02_sample_from_cdf_beta/example b/examples/more/02_sample_from_cdf_beta/example Binary files differ. diff --git a/examples/more/03_ci_beta/example b/examples/more/03_ci_beta/example Binary files differ. diff --git a/examples/more/04_nuclear_war/example b/examples/more/04_nuclear_war/example Binary files differ. diff --git a/examples/more/05_burn_10kg_fat/example b/examples/more/05_burn_10kg_fat/example Binary files differ. diff --git a/examples/more/06_nuclear_recovery/example b/examples/more/06_nuclear_recovery/example Binary files differ. diff --git a/examples/more/07_algebra/example b/examples/more/07_algebra/example Binary files differ. diff --git a/examples/more/08_algebra_and_conversion/example b/examples/more/08_algebra_and_conversion/example Binary files differ. diff --git a/examples/more/09_ergonomic_algebra/example b/examples/more/09_ergonomic_algebra/example Binary files differ. diff --git a/examples/more/10_twitter_thread_example/example b/examples/more/10_twitter_thread_example/example Binary files differ. diff --git a/examples/more/11_billion_lognormals_paralell/example b/examples/more/11_billion_lognormals_paralell/example Binary files differ. diff --git a/examples/more/12_time_to_botec_parallel/example b/examples/more/12_time_to_botec_parallel/example Binary files differ. diff --git a/examples/more/13_parallelize_min/example b/examples/more/13_parallelize_min/example Binary files differ. diff --git a/examples/more/14_check_confidence_interval/example b/examples/more/14_check_confidence_interval/example Binary files differ. diff --git a/makefile b/makefile @@ -24,10 +24,12 @@ lint: clang-tidy squiggle_more.c -- -lm profile: - sudo perf record ./examples/more/12_time_to_botec_parallel/example + sudo perf record -g ./examples/more/12_time_to_botec_parallel/example sudo perf report rm perf.data + sudo perf stat ./examples/more/12_time_to_botec_parallel/example time-linux: + gcc -O3 -Wall -Wextra -Wdouble-promotion -Wconversion examples/more/12_time_to_botec_parallel/example.c squiggle.c squiggle_more.c -lm -fopenmp -o examples/more/12_time_to_botec_parallel/example @echo "Running 100x and taking avg time: $(TTB)" - @t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do $(TTB); done' 2>&1 >/dev/null | grep real | awk '{print $$2}' ); echo "scale=2; 1000 * $$t / 100" | bc | sed "s|^|Time using 16 threads: |" | sed 's|$$|ms|' && echo + @t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do OMP_PROC_BIND=TRUE $(TTB); done' 2>&1 >/dev/null | grep real | awk '{print $$2}' ); echo "scale=2; 1000 * $$t / 100" | bc | sed "s|^|Time using 16 threads: |" | sed 's|$$|ms|' && echo diff --git a/squiggle_more.c b/squiggle_more.c @@ -62,7 +62,7 @@ void sampler_parallel(double (*sampler)(uint64_t* seed), double* results, int n_ int i; #pragma omp parallel private(i) { -#pragma omp for +#pragma omp for for (i = 0; i < n_threads; i++) { int lower_bound_inclusive = i * quotient; int upper_bound_not_inclusive = ((i + 1) * quotient); // note the < in the for loop below,