-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (69 loc) · 2.53 KB
/
Makefile
File metadata and controls
80 lines (69 loc) · 2.53 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
TOOLCHAIN_FILE=$(BUILD_DIR)/build/$(BUILD_TYPE)/generators/conan_toolchain.cmake
help: ## Show help
@grep -E '^[.a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
clean: ## Clean autogenerated files
@echo "=== Cleaning build artifacts and tmp files ==="
rm -rf dist outputs
find . -type f -name "*.DS_Store" -ls -delete
find . | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -rf
find . | grep -E ".pytest_cache" | xargs rm -rf
find . | grep -E ".ipynb_checkpoints" | xargs rm -rf
find . | grep -E ".coverage*" | xargs rm -rf
bash scripts/clean.sh
build_cpu: ## Configure and build for CPU
@echo "=== Building for CPU ==="
conan install . --build=missing --output-folder=$(BUILD_DIR)
cmake -B $(BUILD_DIR) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE)
cmake --build $(BUILD_DIR) --target train render nn_test -j8
run_kslicer: ## Generate Vulkan code with kslicer
@echo "=== Running kslicer ==="
bash scripts/run_kslicer.sh $(KSLICER_CFG)
build_gpu: run_kslicer ## Configure and build for GPU
@echo "=== Building for GPU ==="
conan install . --build=missing --output-folder=$(BUILD_DIR)
cmake -B $(BUILD_DIR) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DUSE_VULKAN=ON
cmake --build $(BUILD_DIR) --target train render -j8
train: ## Run train
@echo "=== Running train ==="
./$(BUILD_DIR)/bin/train \
--n_hidden 2 \
--hidden_size 64 \
--batch_size 512 \
--train_sample $(POINTS)/sdf1_train.bin \
--train_cfg $(CONF)/train.txt \
--save_to $(WEIGHTS)/sdf1_trained_weights_512.bin
render: ## Run render
@echo "=== Running render ==="
./$(BUILD_DIR)/bin/render \
--n_hidden 2 \
--hidden_size 64 \
--batch_size 1 \
--weights $(WEIGHTS)/sdf1_trained_weights_512.bin \
--camera $(CONF)/camera_1.txt \
--light $(CONF)/light.txt \
--save_to $(PICTURES)/out_cpu_cpp_bsize_512.bmp
test_unit: ## Run unit tests
@echo "=== Running unit tests ==="
./$(BUILD_DIR)/test/unit/nn_test
train_py: ## Train network with numpy
@echo "=== Running train with numpy ==="
python scripts/train.py \
--train_points $(POINTS)/sdf1_train.bin \
--n_hidden 2 \
--hidden_size 64 \
--n_epochs 1500 \
--batch_size 512 \
--save_to $(WEIGHTS)/numpy_bsize_512.bin \
-v
infer_py: ## Run network inference on python
@echo "=== Running inference on python ==="
python scripts/infer.py \
--weights $(WEIGHTS)/sdf1_gt_weights.bin \
--points $(POINTS)/sdf1_test.bin \
--n_hidden 2 \
--hidden_size 64