File size: 957 Bytes
1485644
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
CC		:= gcc
CFLAGS		:= -std=c99 -O3 -Ofast -mtune=native -march=native -fopenmp -static
CLIBS		:= -lm -lc


C_TOKENIZER := tokenizer.bin
C_MODEL 	:= model.bin
C_CONFIG 	:= config.h

SRC		:= $(wildcard *.c)
TARGET		:= a.out





all:	$(TARGET)

clean:
		$(RM) $(TARGET) *.o

wipe:	
		make clean
		$(RM) $(C_TOKENIZER) $(C_MODEL) $(C_CONFIG)

run:	$(TARGET)
	OMP_NUM_THREADS=4 ./$< -t 0 -n 512 -p "One day, " -v





$(C_TOKENIZER):
	awk 'BEGIN {for (i = 0; i <= 255; i++) printf("%c%c%c", i, 0, 0)}' > $@





model.o:	$(C_MODEL)
	objcopy --input-target binary \
		--output-target elf64-x86-64 \
		--redefine-sym _binary_model_bin_start=_embedded_binary_model \
		$< $@




tokenizer.o:	$(C_TOKENIZER)
	objcopy --input-target binary \
		--output-target elf64-x86-64 \
		--redefine-sym _binary_tokenizer_bin_start=_embedded_binary_tokenizer \
		$< $@	





$(TARGET): $(SRC) model.o tokenizer.o
	$(CC) $(CFLAGS) -o $@ $^ $(CLIBS)



.PHONY: all wipe clean run