correct squiggle time

This commit is contained in:
NunoSempere 2023-11-20 22:57:33 +00:00
parent a5e0da8cd4
commit 05b1b99561
3 changed files with 15 additions and 8 deletions

View File

@ -29,7 +29,7 @@ The name of this repository is a pun on two meanings of "time to": "how much tim
| Nim | 40.8ms | 84 | | Nim | 40.8ms | 84 |
| Lua (LuaJIT) | 69.9ms | 82 | | Lua (LuaJIT) | 69.9ms | 82 |
| OCaml (flambda) | 187.9ms | 123 | | OCaml (flambda) | 187.9ms | 123 |
| Squiggle (bun) | 0.538s | 14* | | Squiggle (bun) | 0.387s | 14* |
| Javascript (node) | 0.445s | 69 | | Javascript (node) | 0.445s | 69 |
| SquigglePy (v0.27) | 1.507s | 18* | | SquigglePy (v0.27) | 1.507s | 18* |
| R (3.6.1) | 4.508s | 49 | | R (3.6.1) | 4.508s | 49 |

View File

@ -1,5 +1,8 @@
OUTPUT=./samples OUTPUT=./samples
build:
gcc -O3 samples.c ./squiggle_c/squiggle.c ./squiggle_c/squiggle_more.c -lm -fopenmp -o $(OUTPUT)
install: install:
rm -r squiggle_c rm -r squiggle_c
git clone https://git.nunosempere.com/personal/squiggle.c git clone https://git.nunosempere.com/personal/squiggle.c
@ -8,9 +11,6 @@ install:
cp -r squiggle_c/examples/more/12_time_to_botec_parallel/example.c samples.c cp -r squiggle_c/examples/more/12_time_to_botec_parallel/example.c samples.c
sed -i 's|../../..|squiggle_c|' samples.c sed -i 's|../../..|squiggle_c|' samples.c
build:
gcc -O3 samples.c ./squiggle_c/squiggle.c ./squiggle_c/squiggle_more.c -lm -fopenmp -o $(OUTPUT)
time-linux: time-linux:
@echo "Running 100x and taking avg time: OMP_NUM_THREADS=16 $(OUTPUT)" @echo "Running 100x and taking avg time: OMP_NUM_THREADS=16 $(OUTPUT)"
@t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do OMP_NUM_THREADS=16 $(OUTPUT); 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_NUM_THREADS=16 $(OUTPUT); 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

View File

@ -248,18 +248,18 @@ make tidy
It emits one warning about something I already took care of, so by default I've suppressed it. I think this is good news in terms of making me more confident that this simple library is correct :). It emits one warning about something I already took care of, so by default I've suppressed it. I think this is good news in terms of making me more confident that this simple library is correct :).
### Division between core functions and extraneous expansions ### Division between core functions and squiggle_moreneous expansions
This library differentiates between core functions, which are pretty tightly scoped, and expansions and convenience functions, which are more meandering. Expansions are in `extra.c` and `extra.h`. To use them, take care to link them: This library differentiates between core functions, which are pretty tightly scoped, and expansions and convenience functions, which are more meandering. Expansions are in `squiggle_more.c` and `squiggle_more.h`. To use them, take care to link them:
``` ```
// In your C source file // In your C source file
#include "extra.h" #include "squiggle_more.h"
``` ```
``` ```
# When compiling: # When compiling:
gcc -std=c99 -Wall -O3 example.c squiggle.c extra.c -lm -o ./example gcc -std=c99 -Wall -O3 example.c squiggle.c squiggle_more.c -lm -o ./example
``` ```
@ -290,6 +290,13 @@ Behaviour on error can be toggled by the `EXIT_ON_ERROR` variable. This library
Overall, I'd describe the error handling capabilities of this library as pretty rudimentary. For example, this program might fail in surprising ways if you ask for a lognormal with negative standard deviation, because I haven't added error checking for that case yet. Overall, I'd describe the error handling capabilities of this library as pretty rudimentary. For example, this program might fail in surprising ways if you ask for a lognormal with negative standard deviation, because I haven't added error checking for that case yet.
## Extra: confidence intervals
// to do
## Extra paralellism
// to do
## Related projects ## Related projects