-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
202 lines (162 loc) · 7.93 KB
/
Copy pathMakefile
File metadata and controls
202 lines (162 loc) · 7.93 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
CONFIG ?= Release
FLAGS ?=
BUILD_DIR := build
GOLDEN_LIBNEO_REF := e451e0a42f5228d85b0479de40aa35db8b48239d
# Prevent ambient shell env from silently changing which libneo is fetched.
# Pass the ref explicitly via: make ... LIBNEO_REF=<branch|tag|sha>
# $(origin) distinguishes a command-line assignment from an env import.
unexport LIBNEO_REF LIBNEO_PATH
ifeq ($(origin LIBNEO_REF),command line)
FLAGS += -DLIBNEO_REF=$(LIBNEO_REF)
endif
ifeq ($(origin LIBNEO_PATH),command line)
FLAGS += -DLIBNEO_SOURCE_DIR=$(LIBNEO_PATH)
endif
BUILD_NINJA := $(BUILD_DIR)/build.ninja
PYTHON_FOR_TESTS := $(if $(wildcard .venv/bin/python),$(CURDIR)/.venv/bin/python,python)
SIMPLE_GVEC_QA_CACHE_ROOT ?= $(HOME)/data/SIMPLE/gvec_qa_roundtrip
SIMPLE_FIGURE8_DATA_ROOT ?= $(HOME)/data/QUASR/SIMPLE/figure8
SIMPLE_DATA_REPO ?= $(HOME)/data
SIMPLE_DATA_GVEC_QA_DIR ?= $(SIMPLE_DATA_REPO)/TESTS/SIMPLE/gvec_qa_roundtrip
# Common ctest command with optional verbose and test name filtering
CTEST_CMD = cd $(BUILD_DIR) && ctest --test-dir test --output-on-failure $(if $(filter 1,$(VERBOSE)),-V) $(if $(TEST),-R "$(TEST)")
CTEST_CMD_NOPY = cd $(BUILD_DIR) && SIMPLE_ENABLE_PYTHON_TOOLS=0 ctest --test-dir test --output-on-failure $(if $(filter 1,$(VERBOSE)),-V) $(if $(TEST),-R "$(TEST)")
NVHPC_CTEST_CMD = cd $(NVHPC_BUILD_DIR) && ACC_DEVICE_TYPE=HOST ACC_DEVICE_NUM=0 SIMPLE_ENABLE_PYTHON_TOOLS=0 ctest --test-dir test --output-on-failure $(if $(filter 1,$(VERBOSE)),-V) $(if $(TEST),-R "$(TEST)")
# NVIDIA HPC SDK paths for nvfortran builds
NVHPC_ROOT := /opt/nvidia/hpc_sdk/Linux_x86_64/25.11
NVHPC_HPCX := $(NVHPC_ROOT)/comm_libs/13.0/hpcx/hpcx-2.25.1/ompi
NVHPC_BUILD_DIR := build_nvfortran
NVHPC_ACC_BUILD_DIR := build_nvfortran_acc
.PHONY: all configure reconfigure build build-deterministic build-deterministic-nopy test test-nopy test-fast test-smoke test-slow test-regression test-all test-golden-main test-golden-tag test-golden install clean venv nvfortran nvfortran-test nvfortran-test-nopy nvfortran-configure nvfortran-clean
.PHONY: nvfortran-acc nvfortran-acc-test nvfortran-acc-test-nopy nvfortran-acc-configure nvfortran-acc-clean
.PHONY: gvec-qa-cache-fetch gvec-qa-cache-build gvec-qa-cache-sync-data gvec-qa-cache-refresh-data
.PHONY: figure8-data-fetch
all: build
$(BUILD_NINJA):
cmake -S . -B$(BUILD_DIR) -GNinja -DCMAKE_BUILD_TYPE=$(CONFIG) -DCMAKE_COLOR_DIAGNOSTICS=ON $(FLAGS)
configure: $(BUILD_NINJA)
reconfigure:
cmake -S . -B$(BUILD_DIR) -GNinja -DCMAKE_BUILD_TYPE=$(CONFIG) -DCMAKE_COLOR_DIAGNOSTICS=ON
build: configure
cmake --build $(BUILD_DIR) --config $(CONFIG)
# Test targets
# Usage: make [test-target] [TEST=test_name] [VERBOSE=1]
# Example: make test TEST=test_gvec VERBOSE=1
# Example: make test-golden-main TEST=classifier VERBOSE=1
# Run all tests except regression tests (default)
test: build-deterministic
$(CTEST_CMD) -LE "regression"
# Run all non-Python tests (exclude python + regression)
test-nopy: build-deterministic
$(CTEST_CMD_NOPY) -LE "python|regression"
# Run only fast tests (exclude slow and regression tests)
test-fast: build-deterministic
$(CTEST_CMD) -LE "slow|regression|performance|scalability"
# Sub-minute libneo reverse-dependency gate set.
test-smoke: build-deterministic
$(CTEST_CMD) -L smoke
# Run only slow tests
test-slow: build-deterministic
$(CTEST_CMD) -L "slow" -LE "regression|performance|scalability"
# Run only regression tests (requires deterministic FP build without Python interface)
test-regression: FLAGS += -DLIBNEO_REF=$(GOLDEN_LIBNEO_REF)
test-regression: build-deterministic-nopy
export GOLDEN_LIBNEO_REF=$(GOLDEN_LIBNEO_REF); $(CTEST_CMD) -L "regression"
# Build with deterministic floating-point for regression tests
# Keeps CODE intact so local dependency paths are respected
build-deterministic:
@echo "Building with deterministic FP..."
cmake -S . -B$(BUILD_DIR) -GNinja -DCMAKE_BUILD_TYPE=$(CONFIG) -DSIMPLE_DETERMINISTIC_FP=ON -DCMAKE_COLOR_DIAGNOSTICS=ON $(FLAGS)
cmake --build $(BUILD_DIR) --config $(CONFIG)
# Deterministic build matching golden record reference configuration (Python OFF)
build-deterministic-nopy:
@echo "Building with deterministic FP and Python interface OFF (golden record reference)..."
cmake -S . -B$(BUILD_DIR) -GNinja -DCMAKE_BUILD_TYPE=$(CONFIG) -DSIMPLE_DETERMINISTIC_FP=ON -DENABLE_PYTHON_INTERFACE=OFF -DCMAKE_COLOR_DIAGNOSTICS=ON $(FLAGS)
cmake --build $(BUILD_DIR) --config $(CONFIG)
# Run all tests including regression tests
test-all: build
$(CTEST_CMD)
# Golden record test target
# Compares current branch against main to enforce strict numerical reproducibility
# Any differences must be manually reviewed before merging
test-golden: build-deterministic-nopy
cd $(BUILD_DIR) && ctest --output-on-failure $(if $(filter 1,$(VERBOSE)),-V) -L "golden_record" $(if $(TEST),-R "$(TEST)")
# Golden record tests without deterministic FP (faster, for local iteration only)
test-golden-fast: build
cd $(BUILD_DIR) && ctest --output-on-failure $(if $(filter 1,$(VERBOSE)),-V) -L "golden_record" $(if $(TEST),-R "$(TEST)")
gvec-qa-cache-fetch:
SIMPLE_GVEC_QA_CACHE_ROOT="$(SIMPLE_GVEC_QA_CACHE_ROOT)" \
GITLAB_DATA_SIMPLE_GVEC_SUBDIR="TESTS/SIMPLE/gvec_qa_roundtrip" \
bash tools/fetch_gvec_qa_cache.sh
figure8-data-fetch:
SIMPLE_FIGURE8_DATA_ROOT="$(SIMPLE_FIGURE8_DATA_ROOT)" \
bash tools/fetch_figure8_data.sh
gvec-qa-cache-build: build-deterministic
cd $(BUILD_DIR)/test/tests && \
SIMPLE_GVEC_QA_CACHE_ROOT="$(SIMPLE_GVEC_QA_CACHE_ROOT)" \
"$(PYTHON_FOR_TESTS)" "$(CURDIR)/test/tests/run_gvec_qa_roundtrip.py"
gvec-qa-cache-sync-data:
mkdir -p "$(SIMPLE_DATA_GVEC_QA_DIR)"
rsync -a --delete "$(SIMPLE_GVEC_QA_CACHE_ROOT)/" "$(SIMPLE_DATA_GVEC_QA_DIR)/"
gvec-qa-cache-refresh-data: gvec-qa-cache-build gvec-qa-cache-sync-data
venv:
./setup-venv.sh
venv-nopy:
./setup-venv.sh --no-pysimple
doc: configure
cmake --build --preset default --target doc
fpm:
fpm build
clean:
rm -rf $(BUILD_DIR)
# NVIDIA nvfortran build targets
# Uses NVIDIA HPC SDK with HPC-X MPI and proper CUDA setup
nvfortran-configure:
NVHPC_CUDA_HOME=/opt/cuda \
cmake -S . -B$(NVHPC_BUILD_DIR) -GNinja \
-DCMAKE_BUILD_TYPE=$(CONFIG) \
-DCMAKE_Fortran_COMPILER=nvfortran \
-DCMAKE_C_COMPILER=nvc \
-DMPI_HOME=$(NVHPC_HPCX) \
-DMPI_C_COMPILER=$(NVHPC_HPCX)/bin/mpicc \
-DMPI_Fortran_COMPILER=$(NVHPC_HPCX)/bin/mpifort \
-DSIMPLE_DETERMINISTIC_FP=ON \
-DENABLE_PYTHON_INTERFACE=OFF \
-DSIMPLE_ENABLE_PYTHON_TOOLS=OFF \
-DCMAKE_COLOR_DIAGNOSTICS=ON \
$(FLAGS)
nvfortran: nvfortran-configure
NVHPC_CUDA_HOME=/opt/cuda cmake --build $(NVHPC_BUILD_DIR) --config $(CONFIG)
nvfortran-test-nopy: nvfortran
$(NVHPC_CTEST_CMD) -LE "python|regression"
# NVHPC test target with optional filtering.
# Usage: make nvfortran-test [TEST=test_name] [VERBOSE=1]
nvfortran-test: nvfortran
$(NVHPC_CTEST_CMD) -LE "regression"
nvfortran-clean:
rm -rf $(NVHPC_BUILD_DIR)
nvfortran-acc-configure:
NVHPC_CUDA_HOME=/opt/cuda \
cmake -S . -B$(NVHPC_ACC_BUILD_DIR) -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_Fortran_COMPILER=nvfortran \
-DCMAKE_C_COMPILER=nvc \
-DMPI_HOME=$(NVHPC_HPCX) \
-DMPI_C_COMPILER=$(NVHPC_HPCX)/bin/mpicc \
-DMPI_Fortran_COMPILER=$(NVHPC_HPCX)/bin/mpifort \
-DSIMPLE_DETERMINISTIC_FP=ON \
-DSIMPLE_ENABLE_OPENACC=ON \
-DENABLE_PYTHON_INTERFACE=OFF \
-DSIMPLE_ENABLE_PYTHON_TOOLS=OFF \
-DCMAKE_COLOR_DIAGNOSTICS=ON \
$(FLAGS)
nvfortran-acc: nvfortran-acc-configure
NVHPC_CUDA_HOME=/opt/cuda cmake --build $(NVHPC_ACC_BUILD_DIR) --config $(CONFIG)
nvfortran-acc-test-nopy: nvfortran-acc
cd $(NVHPC_ACC_BUILD_DIR) && ACC_DEVICE_TYPE=NVIDIA ACC_DEVICE_NUM=0 SIMPLE_ENABLE_PYTHON_TOOLS=0 \
ctest --test-dir test --output-on-failure $(if $(filter 1,$(VERBOSE)),-V) $(if $(TEST),-R $(TEST)) -LE "python|regression"
nvfortran-acc-test: nvfortran-acc
cd $(NVHPC_ACC_BUILD_DIR) && ACC_DEVICE_TYPE=NVIDIA ACC_DEVICE_NUM=0 SIMPLE_ENABLE_PYTHON_TOOLS=0 \
ctest --test-dir test --output-on-failure $(if $(filter 1,$(VERBOSE)),-V) $(if $(TEST),-R $(TEST)) -LE "regression"
nvfortran-acc-clean:
rm -rf $(NVHPC_ACC_BUILD_DIR)