Skip to content

Commit d313bfe

Browse files
committed
Explicit specification of tests per driver, driver-specific flags.
1 parent 8806987 commit d313bfe

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

tests/Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,16 @@ TESTS ?= $(patsubst $(TEST_DIR)/Test%.hpp,%,$(TEST_FILES))
7878
DRIVER_FILES = $(wildcard $(DRIVER_DIR)/Driver**.hpp)
7979
DRIVERS ?= $(patsubst $(DRIVER_DIR)/Driver%.hpp,%,$(DRIVER_FILES))
8080

81-
# without surrounding parallel directives, privatized variables are not recognized as shared and sections are considered orphaned; hence, they need to be filtered out
82-
getDriverTests = $(if $(filter FirstOrderReverseNoParallel, $1), $(filter-out ParallelSections ForReduction ForReductionNowait ForReductionMultiple ForFirstprivate ForLastprivate OrderedReduction SectionsReduction SectionsReductionMultiple SectionsFirstprivate SectionsLastprivate ReductionNested SingleFirstprivate, $(TESTS)), $(TESTS))
81+
# exclude specific tests on a per-driver basis
82+
DRIVERS_USING_ALL_TESTS = FirstOrderReverse FirstOrderReverseNestedParallel FirstOrderReverseNoOpenMP FirstOrderReversePassive FirstOrderReverseSingleThread SecondOrderReverseForward
83+
$(DRIVERS_USING_ALL_TESTS) $(patsubst %,run%,$(DRIVERS_USING_ALL_TESTS)): DRIVER_TESTS = $(TESTS)
8384

84-
DRIVER_TESTS =
85+
# without surrounding parallel constructs, privatized variables are not recognized as shared and sections are considered orphaned; hence, they need to be filtered out
86+
FirstOrderReverseNoParallel runFirstOrderReverseNoParallel: DRIVER_TESTS = $(filter-out ParallelSections ForReduction ForReductionNowait ForReductionMultiple ForFirstprivate ForLastprivate OrderedReduction SectionsReduction SectionsReductionMultiple SectionsFirstprivate SectionsLastprivate ReductionNested SingleFirstprivate, $(TESTS))
87+
88+
# driver-specific compilation flags
89+
REVERSE_DRIVERS = FirstOrderReverse FirstOrderReverseNestedParallel FirstOrderReverseNoOpenMP FirstOrderReverseNoParallel FirstOrderReversePassive FirstOrderReverseSingleThread SecondOrderReverseForward
90+
$(REVERSE_DRIVERS): DRIVER_FLAGS = -DREVERSE_DRIVER
8591

8692
# export directories for usage in shell scripts
8793
export DRIVER_DIR
@@ -98,14 +104,12 @@ export MODE
98104
# default target
99105
all:
100106

101-
102107
prepareGenerate:
103108
@ mkdir -p build; \
104109
rm -r -f tempmakefile; \
105110
printf "# auto generated by OpDiLib\n" >> tempmakefile;
106111

107112
# process each driver with its associated tests
108-
$(DRIVERS): DRIVER_TESTS = $(call getDriverTests, $@)
109113
$(DRIVERS):
110114
@ echo $@": "${DRIVER_TESTS}; \
111115
BUILD_CASES=; \
@@ -118,17 +122,17 @@ $(DRIVERS):
118122
LINK_CASES=$$LINK_CASES" "$$driver$$test; \
119123
printf "$$driver$$test.o:\n" >> tempmakefile; \
120124
if [ $(EXPLICIT_PREPROCESSOR) = "no" ] ; then \
121-
printf "\t$(CXX) $(BUILD_DIR)/$$driver$$test.cpp -c -o $(BUILD_DIR)/$$driver$$test.o $(FLAGS) -I $(CODI_DIR) -I $(OPDI_DIR)\n" >> tempmakefile; \
125+
printf "\t$(CXX) $(BUILD_DIR)/$$driver$$test.cpp -c -o $(BUILD_DIR)/$$driver$$test.o $(FLAGS) $(DRIVER_FLAGS) -I $(CODI_DIR) -I $(OPDI_DIR)\n" >> tempmakefile; \
122126
else \
123-
printf "\t$(CXX) -E $(BUILD_DIR)/$$driver$$test.cpp -o $(BUILD_DIR)/$$driver$$test.temp $(FLAGS) -I $(CODI_DIR) -I $(OPDI_DIR)\n" >> tempmakefile; \
127+
printf "\t$(CXX) -E $(BUILD_DIR)/$$driver$$test.cpp -o $(BUILD_DIR)/$$driver$$test.temp $(FLAGS) $(DRIVER_FLAGS) -I $(CODI_DIR) -I $(OPDI_DIR)\n" >> tempmakefile; \
124128
printf "\tcat $(BUILD_DIR)/$$driver$$test.temp | grep -v \"# \" > $(BUILD_DIR)/$$driver$$(test)Pre.cpp\n" >> tempmakefile; \
125129
printf "\t"$(CXX)" "$(BUILD_DIR)"/"$$driver$$test"Pre.cpp -c -o "$(BUILD_DIR)"/"$$driver$$test"Pre.o "$(FLAGS)" -I "$(CODI_DIR)" -I "$(OPDI_DIR)"\n" >> tempmakefile; \
126130
fi; \
127131
printf "$$driver$$test: $$driver$$test.o\n" >> tempmakefile; \
128132
if [ $(EXPLICIT_PREPROCESSOR) = "no" ] ; then \
129-
printf "\t$(CXX) $(BUILD_DIR)/$$driver$$test.o -o $(BUILD_DIR)/$$driver$$test $(FLAGS) $(LDFLAGS)\n" >> tempmakefile; \
133+
printf "\t$(CXX) $(BUILD_DIR)/$$driver$$test.o -o $(BUILD_DIR)/$$driver$$test $(FLAGS) $(DRIVER_FLAGS) $(LDFLAGS)\n" >> tempmakefile; \
130134
else \
131-
printf "\t$(CXX) $(BUILD_DIR)/$$driver$$(test)Pre.o -o $(BUILD_DIR)/$$driver$$(test)Pre $(FLAGS) $(LDFLAGS)\n" >> tempmakefile; \
135+
printf "\t$(CXX) $(BUILD_DIR)/$$driver$$(test)Pre.o -o $(BUILD_DIR)/$$driver$$(test)Pre $(FLAGS) $(DRIVER_FLAGS) $(LDFLAGS)\n" >> tempmakefile; \
132136
fi \
133137
done; \
134138
printf "build_all:$$BUILD_CASES\n" >> tempmakefile; \
@@ -148,7 +152,6 @@ compile:
148152
link:
149153
$(MAKE) -f tempmakefile link_all -j12
150154

151-
$(patsubst %,run%,$(DRIVERS)): DRIVER_TESTS = $(call getDriverTests, $(subst run,,$@))
152155
$(patsubst %,run%,$(DRIVERS)): DRIVER = $(subst run,,$@)
153156
$(patsubst %,run%,$(DRIVERS)):
154157
@rm -f testresults; \

0 commit comments

Comments
 (0)