forked from personal/squiggle.c
add one sole makefile for examples using core functionality
This commit is contained in:
parent
a81c0df329
commit
3f9027a530
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
|
@ -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
|
|
|
@ -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
|
|
85
examples/core/makefile
Normal file
85
examples/core/makefile
Normal file
|
@ -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
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "../../squiggle.h"
|
#include "../../../squiggle.h"
|
||||||
#include "../../squiggle_more.h"
|
#include "../../squiggle_more.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user