Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor tests to be independent of epoch and abstraction library used. #109

Merged
merged 6 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,42 @@ jobs:
defaults:
run:
working-directory: epoch1/cuda/ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum

steps:
- uses: actions/checkout@v2
- name: make gtest
working-directory: tools
- name: make
run: make
- name: make check
run: make check
epoch1_eemumu_debug:
runs-on: ubuntu-latest
defaults:
run:
working-directory: epoch1/cuda/ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum
steps:
- uses: actions/checkout@v2
- name: make
run: make debug
- name: make check
run: make check
epoch2_eemumu:
runs-on: ubuntu-latest
defaults:
run:
working-directory: epoch2/cuda/ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum
steps:
- uses: actions/checkout@v2
- name: make
run: make
- name: make check
run: make check
epoch2_eemumu_debug:
runs-on: ubuntu-latest
defaults:
run:
working-directory: epoch2/cuda/ee_mumu/SubProcesses/P1_Sigma_sm_epem_mupmum
steps:
- uses: actions/checkout@v2
- name: make
run: make debug
- name: make check
run: make check
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ profile_*
***/perf/params*.txt

# googletest
tools/googletest
test/googletest
26 changes: 17 additions & 9 deletions epoch1/cuda/ee_mumu/SubProcesses/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
LIBDIR = ../../lib
TOOLSDIR = ../../../../../tools
TESTDIR = ../../../../../test
INCFLAGS = -I. -I../../src -I$(TOOLSDIR)
MODELLIB = model_sm
OPTFLAGS = -O3
Expand Down Expand Up @@ -47,7 +48,7 @@ else
endif
endif

GTESTLIBDIR = $(TOOLSDIR)/googletest/build/lib/
GTESTLIBDIR = $(TESTDIR)/googletest/build/lib/
GTESTLIBS = $(GTESTLIBDIR)/libgtest.a $(GTESTLIBDIR)/libgtest_main.a
MAKEDEBUG=

Expand Down Expand Up @@ -88,20 +89,23 @@ $(cxx_main): check.o $(LIBDIR)/lib$(MODELLIB).a $(cxx_objects)

runTest.o: $(GTESTLIBS)
runTest.exe: $(GTESTLIBS)
runTest.exe: INCFLAGS += -I$(TOOLSDIR)/googletest/googletest/include/
runTest.exe: INCFLAGS += -I$(TESTDIR)/googletest/googletest/include/
runTest.exe: INCFLAGS += -I$(TESTDIR)/include/
runTest.exe: LIBFLAGS += -L$(GTESTLIBDIR)/ -lgtest -lgtest_main
runTest.exe: runTest.o $(TESTDIR)/src/MadgraphTest.o $(TESTDIR)/include/*.h
runTest.exe: cxx_objects += runTest.o $(TESTDIR)/src/MadgraphTest.o
runTest.exe: cu_objects += runTest_cu.o
ifeq ($(NVCC),)
runTest.exe: runTest.o $(LIBDIR)/lib$(MODELLIB).a $(cxx_objects) $(GTESTLIBS)
$(CXX) -o $@ $(cxx_objects) runTest.o $(CPPFLAGS) $(CXXFLAGS) -ldl -pthread $(LIBFLAGS) $(CULIBFLAGS)
runTest.exe: $(LIBDIR)/lib$(MODELLIB).a $(cxx_objects) $(GTESTLIBS)
$(CXX) -o $@ $(cxx_objects) $(CPPFLAGS) $(CXXFLAGS) -ldl -pthread $(LIBFLAGS) $(CULIBFLAGS)
else
runTest.exe: runTest.o $(LIBDIR)/lib$(MODELLIB).a $(cxx_objects) $(GTESTLIBS)
ln -sf runTest.cc runTest_tmp.cu
$(NVCC) -o $@ $(cxx_objects) runTest.o $(cu_objects) runTest_tmp.cu $(CPPFLAGS) $(CUFLAGS) -ldl $(LIBFLAGS) $(CULIBFLAGS) -lcuda -lgomp
unlink runTest_tmp.cu
runTest.exe runTest_cu.o &: runTest.cc $(LIBDIR)/lib$(MODELLIB).a $(cxx_objects) $(cu_objects) $(GTESTLIBS)
$(NVCC) -o runTest_cu.o -c -x cu runTest.cc $(CPPFLAGS) $(CUFLAGS)
$(NVCC) -o $@ $(cxx_objects) $(cu_objects) $(CPPFLAGS) $(CUFLAGS) -ldl $(LIBFLAGS) $(CULIBFLAGS) -lcuda -lgomp
endif

$(GTESTLIBS):
$(MAKE) -C $(TOOLSDIR)
$(MAKE) -C $(TESTDIR)

check: runTest.exe
./runTest.exe
Expand All @@ -112,6 +116,10 @@ clean:
make -C ../../src clean
rm -f *.o *.exe

distclean: clean
make -C $(TOOLSDIR) clean
make -C $(TESTDIR) clean

memcheck: $(cu_main)
/usr/local/cuda/bin/cuda-memcheck --check-api-memory-access yes --check-deprecated-instr yes --check-device-heap yes --demangle full --language c --leak-check full --racecheck-report all --report-api-errors all --show-backtrace yes --tool memcheck --track-unused-memory yes ./gcheck.exe 2 32 2

Expand Down
Loading