From 3f9027a530edb48f361e4de3ce781794acdd5d19 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 19 Nov 2023 14:32:29 +0000 Subject: [PATCH] add one sole makefile for examples using core functionality --- examples/core/00_example_template/example.c | 2 +- examples/core/00_example_template/makefile | 53 ----------- examples/core/01_one_sample/example.c | 2 +- examples/core/01_one_sample/makefile | 53 ----------- .../02_many_samples_time_to_botec/makefile | 53 ----------- .../example | Bin .../example.c | 2 +- examples/core/03_gcc_nested_function/example | Bin 22064 -> 22064 bytes .../core/03_gcc_nested_function/example.c | 2 +- examples/core/03_gcc_nested_function/makefile | 57 ------------ .../{06_gamma_beta => 04_gamma_beta}/example | Bin .../example.c | 2 +- .../example | Bin .../example.c | 2 +- .../run-sorted.sh | 0 examples/core/06_gamma_beta/makefile | 53 ----------- .../core/16_100_lognormal_samples/makefile | 53 ----------- examples/core/makefile | 85 ++++++++++++++++++ .../more/04_sample_from_cdf_simple/example.c | 2 +- .../more/05_sample_from_cdf_beta/example.c | 2 +- .../more/05_sample_from_cdf_beta/makefile | 58 ------------ examples/more/07_ci_beta/example.c | 2 +- examples/more/07_ci_beta/makefile | 58 ------------ examples/more/08_nuclear_war/example.c | 2 +- examples/more/08_nuclear_war/makefile | 53 ----------- examples/more/09_burn_10kg_fat/example.c | 2 +- examples/more/09_burn_10kg_fat/makefile | 57 ------------ examples/more/10_nuclear_recovery/example.c | 2 +- examples/more/10_nuclear_recovery/makefile | 57 ------------ examples/more/11_algebra/example.c | 2 +- examples/more/11_algebra/makefile | 57 ------------ .../more/12_algebra_and_conversion/example.c | 2 +- .../more/12_algebra_and_conversion/makefile | 57 ------------ examples/more/13_ergonomic_algebra/example.c | 2 +- examples/more/13_ergonomic_algebra/makefile | 57 ------------ .../more/14_twitter_thread_example/example.c | 2 +- .../more/14_twitter_thread_example/makefile | 57 ------------ .../{04_sample_from_cdf_simple => }/makefile | 0 38 files changed, 101 insertions(+), 849 deletions(-) delete mode 100644 examples/core/00_example_template/makefile delete mode 100644 examples/core/01_one_sample/makefile delete mode 100644 examples/core/02_many_samples_time_to_botec/makefile rename examples/core/{02_many_samples_time_to_botec => 02_time_to_botec}/example (100%) rename examples/core/{02_many_samples_time_to_botec => 02_time_to_botec}/example.c (97%) delete mode 100644 examples/core/03_gcc_nested_function/makefile rename examples/core/{06_gamma_beta => 04_gamma_beta}/example (100%) rename examples/core/{06_gamma_beta => 04_gamma_beta}/example.c (97%) rename examples/core/{16_100_lognormal_samples => 05_hundred_lognormals}/example (100%) rename examples/core/{16_100_lognormal_samples => 05_hundred_lognormals}/example.c (92%) rename examples/core/{16_100_lognormal_samples => 05_hundred_lognormals}/run-sorted.sh (100%) delete mode 100644 examples/core/06_gamma_beta/makefile delete mode 100644 examples/core/16_100_lognormal_samples/makefile create mode 100644 examples/core/makefile delete mode 100644 examples/more/05_sample_from_cdf_beta/makefile delete mode 100644 examples/more/07_ci_beta/makefile delete mode 100644 examples/more/08_nuclear_war/makefile delete mode 100644 examples/more/09_burn_10kg_fat/makefile delete mode 100644 examples/more/10_nuclear_recovery/makefile delete mode 100644 examples/more/11_algebra/makefile delete mode 100644 examples/more/12_algebra_and_conversion/makefile delete mode 100644 examples/more/13_ergonomic_algebra/makefile delete mode 100644 examples/more/14_twitter_thread_example/makefile rename examples/more/{04_sample_from_cdf_simple => }/makefile (100%) diff --git a/examples/core/00_example_template/example.c b/examples/core/00_example_template/example.c index 10de579..bcb38fd 100644 --- a/examples/core/00_example_template/example.c +++ b/examples/core/00_example_template/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include #include #include diff --git a/examples/core/00_example_template/makefile b/examples/core/00_example_template/makefile deleted file mode 100644 index ef385f7..0000000 --- a/examples/core/00_example_template/makefile +++ /dev/null @@ -1,53 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c -OUTPUT=example - -## Dependencies -MATH=-lm - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 -WARNINGS=-Wall -OPTIMIZED=-O3 #-Ofast -# OPENMP=-fopenmp - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - $(CC) $(OPTIMIZED) $(DEBUG) $(SRC) $(MATH) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - OMP_NUM_THREADS=1 ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/core/01_one_sample/example.c b/examples/core/01_one_sample/example.c index 683414a..82480a9 100644 --- a/examples/core/01_one_sample/example.c +++ b/examples/core/01_one_sample/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include #include #include diff --git a/examples/core/01_one_sample/makefile b/examples/core/01_one_sample/makefile deleted file mode 100644 index ef385f7..0000000 --- a/examples/core/01_one_sample/makefile +++ /dev/null @@ -1,53 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c -OUTPUT=example - -## Dependencies -MATH=-lm - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 -WARNINGS=-Wall -OPTIMIZED=-O3 #-Ofast -# OPENMP=-fopenmp - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - $(CC) $(OPTIMIZED) $(DEBUG) $(SRC) $(MATH) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - OMP_NUM_THREADS=1 ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/core/02_many_samples_time_to_botec/makefile b/examples/core/02_many_samples_time_to_botec/makefile deleted file mode 100644 index 2d251e0..0000000 --- a/examples/core/02_many_samples_time_to_botec/makefile +++ /dev/null @@ -1,53 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c -OUTPUT=example - -## Dependencies -MATH=-lm - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 -WARNINGS=-Wall -OPTIMIZED=-O3 #-Ofast -# OPENMP=-fopenmp - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - $(CC) $(OPTIMIZED) $(DEBUG) $(SRC) $(MATH) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/core/02_many_samples_time_to_botec/example b/examples/core/02_time_to_botec/example similarity index 100% rename from examples/core/02_many_samples_time_to_botec/example rename to examples/core/02_time_to_botec/example diff --git a/examples/core/02_many_samples_time_to_botec/example.c b/examples/core/02_time_to_botec/example.c similarity index 97% rename from examples/core/02_many_samples_time_to_botec/example.c rename to examples/core/02_time_to_botec/example.c index 2ddac68..147a02f 100644 --- a/examples/core/02_many_samples_time_to_botec/example.c +++ b/examples/core/02_time_to_botec/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include #include #include diff --git a/examples/core/03_gcc_nested_function/example b/examples/core/03_gcc_nested_function/example index a51388745a39cb4b279d5fea080b92196e043efa..961ece4bc4353513c065bf1b34fad5377aa51667 100755 GIT binary patch delta 63 zcmdn6hH(QB<$D^KG88A~7UZPH8|oPw8Ck%1xrup|KmlVDm_S-;If!q#dA{dF9ss}} B6?p&v delta 63 zcmdn6hH(QB<$D^KGZZK07UZPH8|oPw85_WOxrup|AOSO&Kw4@!h;O`kzUM?90Kc&n AcmMzZ diff --git a/examples/core/03_gcc_nested_function/example.c b/examples/core/03_gcc_nested_function/example.c index 226d94e..dbf9821 100644 --- a/examples/core/03_gcc_nested_function/example.c +++ b/examples/core/03_gcc_nested_function/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include #include #include diff --git a/examples/core/03_gcc_nested_function/makefile b/examples/core/03_gcc_nested_function/makefile deleted file mode 100644 index 6080f89..0000000 --- a/examples/core/03_gcc_nested_function/makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c -OUTPUT=example - -## Dependencies -MATH=-lm -DEPENDENCIES=$(MATH) -# OPENMP=-fopenmp - -## Flags -DEBUG= #'-g' -STANDARD=-std=gnu99 ## allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/core/06_gamma_beta/example b/examples/core/04_gamma_beta/example similarity index 100% rename from examples/core/06_gamma_beta/example rename to examples/core/04_gamma_beta/example diff --git a/examples/core/06_gamma_beta/example.c b/examples/core/04_gamma_beta/example.c similarity index 97% rename from examples/core/06_gamma_beta/example.c rename to examples/core/04_gamma_beta/example.c index 428037c..979c1a8 100644 --- a/examples/core/06_gamma_beta/example.c +++ b/examples/core/04_gamma_beta/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include #include #include diff --git a/examples/core/16_100_lognormal_samples/example b/examples/core/05_hundred_lognormals/example similarity index 100% rename from examples/core/16_100_lognormal_samples/example rename to examples/core/05_hundred_lognormals/example diff --git a/examples/core/16_100_lognormal_samples/example.c b/examples/core/05_hundred_lognormals/example.c similarity index 92% rename from examples/core/16_100_lognormal_samples/example.c rename to examples/core/05_hundred_lognormals/example.c index d9e65a5..5b93421 100644 --- a/examples/core/16_100_lognormal_samples/example.c +++ b/examples/core/05_hundred_lognormals/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include #include #include diff --git a/examples/core/16_100_lognormal_samples/run-sorted.sh b/examples/core/05_hundred_lognormals/run-sorted.sh similarity index 100% rename from examples/core/16_100_lognormal_samples/run-sorted.sh rename to examples/core/05_hundred_lognormals/run-sorted.sh diff --git a/examples/core/06_gamma_beta/makefile b/examples/core/06_gamma_beta/makefile deleted file mode 100644 index ef385f7..0000000 --- a/examples/core/06_gamma_beta/makefile +++ /dev/null @@ -1,53 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c -OUTPUT=example - -## Dependencies -MATH=-lm - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 -WARNINGS=-Wall -OPTIMIZED=-O3 #-Ofast -# OPENMP=-fopenmp - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - $(CC) $(OPTIMIZED) $(DEBUG) $(SRC) $(MATH) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - OMP_NUM_THREADS=1 ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/core/16_100_lognormal_samples/makefile b/examples/core/16_100_lognormal_samples/makefile deleted file mode 100644 index ef385f7..0000000 --- a/examples/core/16_100_lognormal_samples/makefile +++ /dev/null @@ -1,53 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c -OUTPUT=example - -## Dependencies -MATH=-lm - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 -WARNINGS=-Wall -OPTIMIZED=-O3 #-Ofast -# OPENMP=-fopenmp - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - $(CC) $(OPTIMIZED) $(DEBUG) $(SRC) $(MATH) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - OMP_NUM_THREADS=1 ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/core/makefile b/examples/core/makefile new file mode 100644 index 0000000..aa782d9 --- /dev/null +++ b/examples/core/makefile @@ -0,0 +1,85 @@ +# Interface: +# make all +# make format-all +# make run-all +# make one DIR=01_one_sample +# make format-one DIR=01_one_sample +# make run-one DIR=01_one_sample +# make time-linux-one DIR=01_one_sample +# make profile-one DIR=01_one_sample + +# Compiler +CC=gcc +# CC=tcc # <= faster compilation + +# Main file +SRC=example.c +OUTPUT=example + +## Dependencies +SQUIGGLE=../../squiggle.c +MATH=-lm +DEPS=$(SQUIGGLE) $(MATH) + +## Flags +DEBUG= #'-g' +STANDARD=-std=c99 +WARNINGS=-Wall +OPTIMIZED=-O3 #-Ofast + +## Formatter +STYLE_BLUEPRINT=webkit +FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) + +## make all +all: + $(CC) $(OPTIMIZED) $(DEBUG) 00_example_template/$(SRC) $(DEPS) -o 00_example_template/$(OUTPUT) + $(CC) $(OPTIMIZED) $(DEBUG) 01_one_sample/$(SRC) $(DEPS) -o 01_one_sample/$(OUTPUT) + $(CC) $(OPTIMIZED) $(DEBUG) 02_time_to_botec/$(SRC) $(DEPS) -o 02_time_to_botec/$(OUTPUT) + $(CC) $(OPTIMIZED) $(DEBUG) 03_gcc_nested_function/$(SRC) $(DEPS) -o 03_gcc_nested_function/$(OUTPUT) + $(CC) $(OPTIMIZED) $(DEBUG) 04_gamma_beta/$(SRC) $(DEPS) -o 04_gamma_beta/$(OUTPUT) + $(CC) $(OPTIMIZED) $(DEBUG) 05_hundred_lognormals/$(SRC) $(DEPS) -o 05_hundred_lognormals/$(OUTPUT) + +format-all: + $(FORMATTER) 00_example_template/$(SRC) + $(FORMATTER) 01_one_sample/$(SRC) + $(FORMATTER) 02_time_to_botec/$(SRC) + $(FORMATTER) 03_gcc_nested_function/$(SRC) + $(FORMATTER) 04_gamma_beta/$(SRC) + $(FORMATTER) 05_hundred_lognormals/$(SRC) + +run-all: + 00_example_template/$(OUTPUT) + 01_one_sample/$(OUTPUT) + 02_time_to_botec/$(OUTPUT) + 03_gcc_nested_function/$(OUTPUT) + 04_gamma_beta/$(OUTPUT) + 05_hundred_lognormals/$(OUTPUT) + +## make one DIR=01_one_sample +one: $(DIR)/$(SRC) + $(CC) $(OPTIMIZED) $(DEBUG) $(DIR)/$(SRC) $(DEPS) -o $(DIR)/$(OUTPUT) + +## make format-one DIR=01_one_sample +format-one: $(DIR)/$(SRC) + $(FORMATTER) $(DIR)/$(SRC) + +## make run-one DIR=01_one_sample +run-one: $(DIR)/$(OUTPUT) + $(DIR)/$(OUTPUT) && echo + +## make time-linux-one DIR=01_one_sample +time-linux-one: $(DIR)/$(OUTPUT) + @echo "Requires /bin/time, found on GNU/Linux systems" && echo + @echo "Running 100x and taking avg time $(DIR)/$(OUTPUT)" + @t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do $(DIR)/$(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 + +## e.g., make profile-linux-one DIR=01_one_sample +profile-linux-one: + echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" + echo "Must be run as sudo" + $(CC) $(OPTIMIZED) $(DEBUG) $(DIR)/$(SRC) $(DEPS) -o $(DIR)/$(OUTPUT) + # $(CC) $(SRC) $(DEPS) -o $(OUTPUT) + sudo perf record $(DIR)/$(OUTPUT) + sudo perf report + rm perf.data diff --git a/examples/more/04_sample_from_cdf_simple/example.c b/examples/more/04_sample_from_cdf_simple/example.c index d703666..5d3f246 100644 --- a/examples/more/04_sample_from_cdf_simple/example.c +++ b/examples/more/04_sample_from_cdf_simple/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/05_sample_from_cdf_beta/example.c b/examples/more/05_sample_from_cdf_beta/example.c index 09f7fd7..706dad0 100644 --- a/examples/more/05_sample_from_cdf_beta/example.c +++ b/examples/more/05_sample_from_cdf_beta/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/05_sample_from_cdf_beta/makefile b/examples/more/05_sample_from_cdf_beta/makefile deleted file mode 100644 index c1d84b2..0000000 --- a/examples/more/05_sample_from_cdf_beta/makefile +++ /dev/null @@ -1,58 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -# CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=./example - -## Dependencies -MATH=-lm -DEPENDENCIES=$(MATH) -# OPENMP=-fopenmp - -## Flags -VERBOSE=#-v -DEBUG= #'-g' -STANDARD=-std=c99 ## gnu99 allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(VERBOSE) $(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/07_ci_beta/example.c b/examples/more/07_ci_beta/example.c index 9ca9e6c..a10c075 100644 --- a/examples/more/07_ci_beta/example.c +++ b/examples/more/07_ci_beta/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/07_ci_beta/makefile b/examples/more/07_ci_beta/makefile deleted file mode 100644 index 821add6..0000000 --- a/examples/more/07_ci_beta/makefile +++ /dev/null @@ -1,58 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=./example - -## Dependencies -OPENMP=-fopenmp -MATH=-lm -DEPENDENCIES=$(MATH) $(OPENMP) -# OPENMP=-fopenmp - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 ## gnu99 allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/08_nuclear_war/example.c b/examples/more/08_nuclear_war/example.c index 1c44880..6cb883c 100644 --- a/examples/more/08_nuclear_war/example.c +++ b/examples/more/08_nuclear_war/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/08_nuclear_war/makefile b/examples/more/08_nuclear_war/makefile deleted file mode 100644 index 39acff1..0000000 --- a/examples/more/08_nuclear_war/makefile +++ /dev/null @@ -1,53 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=example - -## Dependencies -MATH=-lm - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 -WARNINGS=-Wall -OPTIMIZED=-O3 #-Ofast -# OPENMP=-fopenmp - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - $(CC) $(OPTIMIZED) $(DEBUG) $(SRC) $(MATH) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - OMP_NUM_THREADS=1 ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/09_burn_10kg_fat/example.c b/examples/more/09_burn_10kg_fat/example.c index 477cb2f..2184e51 100644 --- a/examples/more/09_burn_10kg_fat/example.c +++ b/examples/more/09_burn_10kg_fat/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/09_burn_10kg_fat/makefile b/examples/more/09_burn_10kg_fat/makefile deleted file mode 100644 index 9f5cdc4..0000000 --- a/examples/more/09_burn_10kg_fat/makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=./example - -## Dependencies -MATH=-lm -DEPENDENCIES=$(MATH) -# OPENMP=-fopenmp - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 ## gnu99 allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/10_nuclear_recovery/example.c b/examples/more/10_nuclear_recovery/example.c index abbfe8e..8434af6 100644 --- a/examples/more/10_nuclear_recovery/example.c +++ b/examples/more/10_nuclear_recovery/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/10_nuclear_recovery/makefile b/examples/more/10_nuclear_recovery/makefile deleted file mode 100644 index 9f5cdc4..0000000 --- a/examples/more/10_nuclear_recovery/makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=./example - -## Dependencies -MATH=-lm -DEPENDENCIES=$(MATH) -# OPENMP=-fopenmp - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 ## gnu99 allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/11_algebra/example.c b/examples/more/11_algebra/example.c index a6b6fbd..d621a3a 100644 --- a/examples/more/11_algebra/example.c +++ b/examples/more/11_algebra/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/11_algebra/makefile b/examples/more/11_algebra/makefile deleted file mode 100644 index 9f5cdc4..0000000 --- a/examples/more/11_algebra/makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=./example - -## Dependencies -MATH=-lm -DEPENDENCIES=$(MATH) -# OPENMP=-fopenmp - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 ## gnu99 allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/12_algebra_and_conversion/example.c b/examples/more/12_algebra_and_conversion/example.c index 9300561..d5fafdd 100644 --- a/examples/more/12_algebra_and_conversion/example.c +++ b/examples/more/12_algebra_and_conversion/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/12_algebra_and_conversion/makefile b/examples/more/12_algebra_and_conversion/makefile deleted file mode 100644 index 9f5cdc4..0000000 --- a/examples/more/12_algebra_and_conversion/makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=./example - -## Dependencies -MATH=-lm -DEPENDENCIES=$(MATH) -# OPENMP=-fopenmp - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 ## gnu99 allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/13_ergonomic_algebra/example.c b/examples/more/13_ergonomic_algebra/example.c index 35fcfd1..39785fb 100644 --- a/examples/more/13_ergonomic_algebra/example.c +++ b/examples/more/13_ergonomic_algebra/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/13_ergonomic_algebra/makefile b/examples/more/13_ergonomic_algebra/makefile deleted file mode 100644 index 9f5cdc4..0000000 --- a/examples/more/13_ergonomic_algebra/makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=./example - -## Dependencies -MATH=-lm -DEPENDENCIES=$(MATH) -# OPENMP=-fopenmp - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 ## gnu99 allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/14_twitter_thread_example/example.c b/examples/more/14_twitter_thread_example/example.c index 002f392..ba0f8eb 100644 --- a/examples/more/14_twitter_thread_example/example.c +++ b/examples/more/14_twitter_thread_example/example.c @@ -1,4 +1,4 @@ -#include "../../squiggle.h" +#include "../../../squiggle.h" #include "../../squiggle_more.h" #include #include diff --git a/examples/more/14_twitter_thread_example/makefile b/examples/more/14_twitter_thread_example/makefile deleted file mode 100644 index 9f5cdc4..0000000 --- a/examples/more/14_twitter_thread_example/makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Interface: -# make -# make build -# make format -# make run - -# Compiler -CC=gcc # required for nested functions -# CC=tcc # <= faster compilation - -# Main file -SRC=example.c ../../squiggle.c ../../squiggle_more.c -OUTPUT=./example - -## Dependencies -MATH=-lm -DEPENDENCIES=$(MATH) -# OPENMP=-fopenmp - -## Flags -DEBUG= #'-g' -STANDARD=-std=c99 ## gnu99 allows for nested functions. -EXTENSIONS= #-fnested-functions -WARNINGS=-Wall -OPTIMIZED=-O3#-Ofast -CFLAGS=$(DEBUG) $(STANDARD) $(EXTENSIONS) $(WARNINGS) $(OPTIMIZED) - -## Formatter -STYLE_BLUEPRINT=webkit -FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) - -## make build -build: $(SRC) - # gcc -std=gnu99 example.c -lm -o example - $(CC) $(CFLAGS) $(SRC) $(DEPENDENCIES) -o $(OUTPUT) - -format: $(SRC) - $(FORMATTER) $(SRC) - -run: $(SRC) $(OUTPUT) - ./$(OUTPUT) && echo - -time-linux: - @echo "Requires /bin/time, found on GNU/Linux systems" && echo - - @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 - -## Profiling - -profile-linux: - echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" - echo "Must be run as sudo" - $(CC) $(SRC) $(MATH) -o $(OUTPUT) - sudo perf record ./$(OUTPUT) - sudo perf report - rm perf.data diff --git a/examples/more/04_sample_from_cdf_simple/makefile b/examples/more/makefile similarity index 100% rename from examples/more/04_sample_from_cdf_simple/makefile rename to examples/more/makefile