forked from personal/squiggle.c
prepare adding squiggle.c to time to botec.
This commit is contained in:
parent
2ea32e2a47
commit
0c22716635
Binary file not shown.
BIN
examples/02_many_samples_time_to_botec/example
Executable file
BIN
examples/02_many_samples_time_to_botec/example
Executable file
Binary file not shown.
|
@ -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);
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user