mirror of
https://github.com/codeplea/genann.git
synced 2025-12-24 12:42:52 +00:00
Shave around 94 million instructions and 10 million branches off of execution
trace of example4 if the sigmoid activation function is resolved at link-time.
Before (`make`):
```
Performance counter stats for './example4':
98.988806 task-clock (msec) # 0.998 CPUs utilized
1 context-switches # 0.010 K/sec
0 cpu-migrations # 0.000 K/sec
79 page-faults # 0.798 K/sec
312,298,260 cycles # 3.155 GHz
1,094,183,752 instructions # 3.50 insn per cycle
212,007,732 branches # 2141.734 M/sec
62,774 branch-misses # 0.03% of all branches
0.099228100 seconds time elapsed
```
After:
`make`:
```
Performance counter stats for './example4':
97.335180 task-clock (msec) # 0.998 CPUs utilized
0 context-switches # 0.000 K/sec
0 cpu-migrations # 0.000 K/sec
82 page-faults # 0.842 K/sec
306,722,357 cycles # 3.151 GHz
1,065,669,644 instructions # 3.47 insn per cycle
214,256,601 branches # 2201.225 M/sec
60,154 branch-misses # 0.03% of all branches
0.097577079 seconds time elapsed
```
`make sigmoid`:
```
Performance counter stats for './example4':
92.629610 task-clock (msec) # 0.997 CPUs utilized
0 context-switches # 0.000 K/sec
0 cpu-migrations # 0.000 K/sec
78 page-faults # 0.842 K/sec
291,863,801 cycles # 3.151 GHz
1,000,931,204 instructions # 3.43 insn per cycle
202,465,800 branches # 2185.757 M/sec
50,949 branch-misses # 0.03% of all branches
0.092889789 seconds time elapsed
```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
35 lines
609 B
Makefile
35 lines
609 B
Makefile
CFLAGS = -Wall -Wshadow -O3 -g -march=native
|
|
LDLIBS = -lm
|
|
|
|
all: test example1 example2 example3 example4
|
|
|
|
sigmoid: CFLAGS += -Dgenann_act=genann_act_sigmoid_cached
|
|
sigmoid: all
|
|
|
|
threshold: CFLAGS += -Dgenann_act=genann_act_threshold
|
|
threshold: all
|
|
|
|
linear: CFLAGS += -Dgenann_act=genann_act_linear
|
|
linear: all
|
|
|
|
test: test.o genann.o
|
|
|
|
check: test
|
|
./$^
|
|
|
|
example1: example1.o genann.o
|
|
|
|
example2: example2.o genann.o
|
|
|
|
example3: example3.o genann.o
|
|
|
|
example4: example4.o genann.o
|
|
|
|
|
|
clean:
|
|
$(RM) *.o
|
|
$(RM) test example1 example2 example3 example4 *.exe
|
|
$(RM) persist.txt
|
|
|
|
.PHONY: sigmoid threshold linear clean
|