First
This commit is contained in:
parent
79dc35236c
commit
ce591fefc7
47
Makefile
47
Makefile
@ -1,47 +0,0 @@
|
||||
CXX ?= g++
|
||||
CXXFLAGS ?= -O3 -march=native -ffast-math -funroll-loops -std=c++17 -Wall -Wextra -Wno-unused-parameter
|
||||
LDFLAGS ?= -pthread
|
||||
|
||||
SRC := main.cpp \
|
||||
xenith/core/model.cpp \
|
||||
xenith/core/backward.cpp \
|
||||
xenith/core/trainer.cpp \
|
||||
xenith/core/checkpoint.cpp \
|
||||
xenith/core/generate.cpp \
|
||||
xenith/core/gradcheck.cpp
|
||||
|
||||
OBJ := $(SRC:.cpp=.o)
|
||||
DEP := $(OBJ:.o=.d)
|
||||
BIN := bin/xenith
|
||||
|
||||
# Без -include .d make считает ПЕРВУЮ цель в make-файле целью по умолчанию.
|
||||
# Если первой стоит "-include $(DEP)", сборка молча превращается в no-op:
|
||||
# ни один .o не пересобирается, и правки исходников не доходят до бинарника.
|
||||
# Именно так мы потеряли час: gradcheck показывал одни и те же числа
|
||||
# после нескольких исправлений. Поэтому первая цель здесь — всегда all.
|
||||
ALL_OBJ := $(OBJ)
|
||||
|
||||
all: $(BIN)
|
||||
.PHONY: all
|
||||
|
||||
bin:
|
||||
mkdir -p bin
|
||||
|
||||
$(BIN): $(ALL_OBJ)
|
||||
@mkdir -p bin
|
||||
$(CXX) $(ALL_OBJ) -o $@ $(LDFLAGS)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
debug:
|
||||
$(MAKE) clean
|
||||
$(MAKE) CXXFLAGS="-O1 -g -std=c++17 -Wall -Wextra -Wno-unused-parameter -fsanitize=address,undefined" \
|
||||
LDFLAGS="-pthread -fsanitize=address,undefined"
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(DEP) $(BIN)
|
||||
|
||||
.PHONY: debug clean
|
||||
|
||||
-include $(DEP)
|
||||
9
main.d
9
main.d
@ -1,9 +0,0 @@
|
||||
main.o: main.cpp xenith/core/checkpoint.h xenith/core/model.h \
|
||||
xenith/core/tensor.h xenith/core/generate.h xenith/core/train.h \
|
||||
xenith/core/gradcheck.h
|
||||
xenith/core/checkpoint.h:
|
||||
xenith/core/model.h:
|
||||
xenith/core/tensor.h:
|
||||
xenith/core/generate.h:
|
||||
xenith/core/train.h:
|
||||
xenith/core/gradcheck.h:
|
||||
Loading…
x
Reference in New Issue
Block a user