2026-03-20 00:33:45 +08:00
|
|
|
# GenSolver Makefile
|
|
|
|
|
#
|
fix: harden CUDA safety checks and translate comments to English
Safety fixes (4 critical, 4 warning) from code review:
- qap.cuh: fix clone_to_device cross-device D2H by retaining host matrices
- types.cuh: add CUDA_CHECK to InjectBuffer, track owner_gpu for safe destroy
- types.cuh: add bounds check on lexicographic priority index
- solver.cuh: cap migrate_kernel islands to MAX_ISLANDS=64 to prevent stack overflow
- multi_gpu_solver.cuh: guard against 0 GPUs, propagate stop_reason from best GPU
- types.cuh: warn on SeqRegistry overflow
- solver.cuh: warn when constraint_directed/phased_search disabled without AOS
Translate all Chinese comments to English across 25+ source files
(core/*.cuh, problems/*.cuh, Makefile, multi-GPU tests).
Verified on V100S×2 (sm_70, CUDA 12.8): e5 (12 problem types, all optimal),
e13 (multi-objective + multi-GPU, 9 configs, all passed).
2026-03-25 11:52:50 +08:00
|
|
|
# Usage:
|
|
|
|
|
# make e1 e2 e3 e4 e5 e6 → Build individual experiments
|
|
|
|
|
# make diag → Build diagnostic program
|
|
|
|
|
# make all → Build all
|
|
|
|
|
# make clean → Clean
|
2026-03-20 00:33:45 +08:00
|
|
|
|
|
|
|
|
NVCC = nvcc
|
|
|
|
|
ARCH ?= -arch=sm_75
|
|
|
|
|
CFLAGS = -O2 -std=c++17 --extended-lambda
|
|
|
|
|
INCLUDES = -I core -I problems -I ../benchmark/common
|
|
|
|
|
|
|
|
|
|
CORE_HEADERS = $(wildcard core/*.cuh)
|
|
|
|
|
PROB_HEADERS = $(wildcard problems/*.cuh)
|
|
|
|
|
COMMON_HEADERS = $(wildcard ../benchmark/common/*.cuh)
|
|
|
|
|
ALL_HEADERS = $(CORE_HEADERS) $(PROB_HEADERS) $(COMMON_HEADERS)
|
|
|
|
|
|
|
|
|
|
BENCH_DIR = ../benchmark
|
|
|
|
|
EXP_DIR = $(BENCH_DIR)/experiments
|
|
|
|
|
EXPERIMENTS = e0_diagnosis e1_vs_mip e2_vs_routing e2.1_custom_routing e3_ablation e4_scalability e5_generality e6_gpu_hardware e8_p2_search_strategy opt_init_solution
|
|
|
|
|
|
|
|
|
|
.PHONY: all clean diag test_multi_gpu test_multi_gpu_b3 $(patsubst %,e%,0 1 2 2.1 3 4 5 6 8)
|
|
|
|
|
|
|
|
|
|
all: e0 e1 e2 e2.1 e3 e4 e5 e6 e8 test_multi_gpu test_multi_gpu_b3
|
|
|
|
|
|
|
|
|
|
e0 diag: $(EXP_DIR)/e0_diagnosis/bench_diagnosis
|
|
|
|
|
e1: $(EXP_DIR)/e1_vs_mip/gpu
|
|
|
|
|
e2: $(EXP_DIR)/e2_vs_routing/gpu
|
|
|
|
|
e2.1: $(EXP_DIR)/e2.1_custom_routing/gpu
|
|
|
|
|
e3: $(EXP_DIR)/e3_ablation/gpu
|
|
|
|
|
e4: $(EXP_DIR)/e4_scalability/gpu
|
|
|
|
|
e5: $(EXP_DIR)/e5_generality/gpu
|
|
|
|
|
e6: $(EXP_DIR)/e6_gpu_hardware/gpu
|
|
|
|
|
e8: $(EXP_DIR)/e8_p2_search_strategy/gpu
|
|
|
|
|
|
|
|
|
|
$(EXP_DIR)/%/gpu: $(EXP_DIR)/%/gpu.cu $(ALL_HEADERS) problems/tsplib_data.h
|
|
|
|
|
$(NVCC) $(ARCH) $(CFLAGS) $(INCLUDES) -o $@ $<
|
|
|
|
|
|
|
|
|
|
$(EXP_DIR)/e0_diagnosis/bench_diagnosis: $(EXP_DIR)/e0_diagnosis/bench_diagnosis.cu $(ALL_HEADERS)
|
|
|
|
|
$(NVCC) $(ARCH) $(CFLAGS) $(INCLUDES) -o $@ $<
|
|
|
|
|
|
fix: harden CUDA safety checks and translate comments to English
Safety fixes (4 critical, 4 warning) from code review:
- qap.cuh: fix clone_to_device cross-device D2H by retaining host matrices
- types.cuh: add CUDA_CHECK to InjectBuffer, track owner_gpu for safe destroy
- types.cuh: add bounds check on lexicographic priority index
- solver.cuh: cap migrate_kernel islands to MAX_ISLANDS=64 to prevent stack overflow
- multi_gpu_solver.cuh: guard against 0 GPUs, propagate stop_reason from best GPU
- types.cuh: warn on SeqRegistry overflow
- solver.cuh: warn when constraint_directed/phased_search disabled without AOS
Translate all Chinese comments to English across 25+ source files
(core/*.cuh, problems/*.cuh, Makefile, multi-GPU tests).
Verified on V100S×2 (sm_70, CUDA 12.8): e5 (12 problem types, all optimal),
e13 (multi-objective + multi-GPU, 9 configs, all passed).
2026-03-25 11:52:50 +08:00
|
|
|
test_multi_gpu: $(EXP_DIR)/e9_multi_gpu_b3/test_multi_gpu.cu $(ALL_HEADERS)
|
2026-03-20 00:33:45 +08:00
|
|
|
$(NVCC) $(ARCH) $(CFLAGS) $(INCLUDES) -o $@ $<
|
|
|
|
|
|
fix: harden CUDA safety checks and translate comments to English
Safety fixes (4 critical, 4 warning) from code review:
- qap.cuh: fix clone_to_device cross-device D2H by retaining host matrices
- types.cuh: add CUDA_CHECK to InjectBuffer, track owner_gpu for safe destroy
- types.cuh: add bounds check on lexicographic priority index
- solver.cuh: cap migrate_kernel islands to MAX_ISLANDS=64 to prevent stack overflow
- multi_gpu_solver.cuh: guard against 0 GPUs, propagate stop_reason from best GPU
- types.cuh: warn on SeqRegistry overflow
- solver.cuh: warn when constraint_directed/phased_search disabled without AOS
Translate all Chinese comments to English across 25+ source files
(core/*.cuh, problems/*.cuh, Makefile, multi-GPU tests).
Verified on V100S×2 (sm_70, CUDA 12.8): e5 (12 problem types, all optimal),
e13 (multi-objective + multi-GPU, 9 configs, all passed).
2026-03-25 11:52:50 +08:00
|
|
|
test_multi_gpu_b3: $(EXP_DIR)/e9_multi_gpu_b3/test_multi_gpu_b3.cu $(ALL_HEADERS)
|
2026-03-20 00:33:45 +08:00
|
|
|
$(NVCC) $(ARCH) $(CFLAGS) $(INCLUDES) -o $@ $<
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
rm -f $(foreach e,$(EXPERIMENTS),$(EXP_DIR)/$(e)/gpu) $(EXP_DIR)/e0_diagnosis/bench_diagnosis test_multi_gpu test_multi_gpu_b3
|
|
|
|
|
@echo "Cleaned all experiment binaries."
|