prepare adding squiggle.c to time to botec.

This commit is contained in:
NunoSempere 2023-08-17 14:30:33 +02:00
parent 2ea32e2a47
commit 0c22716635
4 changed files with 9 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -42,11 +42,13 @@ int main(){
for(int i=0; i<n_samples; i++){ for(int i=0; i<n_samples; i++){
result_many[i] = sample_mixture(samplers, weights, n_dists, seed); result_many[i] = sample_mixture(samplers, weights, n_dists, seed);
} }
printf("Mean: %f\n", array_mean(result_many, n_samples));
// printf("result_many: [");
// for(int i=0; i<100; i++){
// printf("%.2f, ", result_many[i]);
// }
// printf("]\n");
printf("result_many: [");
for(int i=0; i<100; i++){
printf("%.2f, ", result_many[i]);
}
printf("]\n");
free(seed); free(seed);
} }

View File

@ -34,13 +34,13 @@ format: $(SRC)
$(FORMATTER) $(SRC) $(FORMATTER) $(SRC)
run: $(SRC) $(OUTPUT) run: $(SRC) $(OUTPUT)
OMP_NUM_THREADS=1 ./$(OUTPUT) && echo ./$(OUTPUT) && echo
time-linux: time-linux:
@echo "Requires /bin/time, found on GNU/Linux systems" && echo @echo "Requires /bin/time, found on GNU/Linux systems" && echo
@echo "Running 100x and taking avg time $(OUTPUT)" @echo "Running 100x and taking avg time $(OUTPUT)"
@t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do $(OUTPUT); done' 2>&1 >/dev/null | grep real | awk '{print $$2}' ); echo "scale=2; 1000 * $$t / 100" | bc | sed "s|^|Time using 1 thread: |" | sed 's|$$|ms|' && echo @t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do ./$(OUTPUT); done' 2>&1 >/dev/null | grep real | awk '{print $$2}' ); echo "scale=2; 1000 * $$t / 100" | bc | sed "s|^|Time using 1 thread: |" | sed 's|$$|ms|' && echo
## Profiling ## Profiling