Skip to content

Commit

Permalink
[runcard] in CODEGEN, backport gg_tt.mad: fix/hardcode USEBUILDDIR=1 …
Browse files Browse the repository at this point in the history
…(and propagate FPTYPE from make_opts) in _link targets for madgraph5#945

The only files that still need to be patched are
- 3 in patch.common: Source/makefile, Source/genps.inc, SubProcesses/makefile
- 3 in patch.P1: auto_dsig1.f, driver.f, matrix1.f

./CODEGEN/generateAndCompare.sh gg_tt --mad --nopatch
git diff --no-ext-diff -R gg_tt.mad/Source/makefile gg_tt.mad/Source/genps.inc gg_tt.mad/SubProcesses/makefile > CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.common
git diff --no-ext-diff -R gg_tt.mad/SubProcesses/P1_gg_ttx/auto_dsig1.f gg_tt.mad/SubProcesses/P1_gg_ttx/driver.f gg_tt.mad/SubProcesses/P1_gg_ttx/matrix1.f > CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MG5aMC_patches/PROD/patch.P1
git checkout gg_tt.mad
  • Loading branch information
valassi committed Aug 5, 2024
1 parent 62cb706 commit 58d13bd
Showing 1 changed file with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ index 617f10b93..00c73099a 100644
+cleanall: cleanSource # THIS IS THE ONE
+ for i in `ls -d ../SubProcesses/P*`; do cd $$i; make cleanavxs; cd -; done;
diff --git b/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile a/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
index 348c283be..64b33c4f1 100644
index 348c283be..6642c9567 100644
--- b/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
+++ a/epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
@@ -1,6 +1,37 @@
Expand Down Expand Up @@ -101,7 +101,7 @@ index 348c283be..64b33c4f1 100644

LIBS = $(LIBDIR)libbias.$(libext) $(LIBDIR)libdhelas.$(libext) $(LIBDIR)libdsample.$(libext) $(LIBDIR)libgeneric.$(libext) $(LIBDIR)libpdf.$(libext) $(LIBDIR)libgammaUPC.$(libext) $(LIBDIR)libmodel.$(libext) $(LIBDIR)libcernlib.$(libext) $(MADLOOP_LIB) $(LOOP_LIBS)

@@ -43,41 +87,145 @@ ifeq ($(strip $(MATRIX_HEL)),)
@@ -43,41 +87,149 @@ ifeq ($(strip $(MATRIX_HEL)),)
endif


Expand Down Expand Up @@ -189,32 +189,36 @@ index 348c283be..64b33c4f1 100644
+ rm -f $(PROG)
+ ln -s $(PROG)_fortran $(PROG)
+
+madevent_cuda_link:
+ $(MAKE) USEGTEST=0 BACKEND=cuda $(CUDACPP_BUILDDIR)/$(PROG)_cuda
+madevent_cudacpp_link: all
+ rm -f $(PROG)
+ifeq ($(BACKEND),cuda)
+ ln -s $(CUDACPP_BUILDDIR)/$(PROG)_cuda $(PROG)
+
+madevent_hip_link:
+ $(MAKE) USEGTEST=0 BACKEND=hip $(CUDACPP_BUILDDIR)/$(PROG)_hip
+ rm -f $(PROG)
+else ifeq ($(BACKEND),hip)
+ ln -s $(CUDACPP_BUILDDIR)/$(PROG)_hip $(PROG)
+
+madevent_cpp_link:
+ $(MAKE) USEGTEST=0 BACKEND=cppauto $(CUDACPP_BUILDDIR)/$(PROG)_cpp
+ rm -f $(PROG)
+else
+ ln -s $(CUDACPP_BUILDDIR)/$(PROG)_cpp $(PROG)
+endif
+
+madevent_cuda_link:
+ $(MAKE) USEGTEST=0 USEBUILDDIR=1 BACKEND=cuda FPTYPE=$(FPTYPE) madevent_cudacpp_link
+
+madevent_hip_link:
+ $(MAKE) USEGTEST=0 USEBUILDDIR=1 BACKEND=hip FPTYPE=$(FPTYPE) madevent_cudacpp_link

-$(LIBDIR)libpdf.$(libext):
- cd ../../Source/PDF; make
+madevent_cpp_link:
+ $(MAKE) USEGTEST=0 USEBUILDDIR=1 BACKEND=cppauto FPTYPE=$(FPTYPE) madevent_cudacpp_link

-$(LIBDIR)libgammaUPC.$(libext):
- cd ../../Source/PDF/gammaUPC; make
+override SUPPORTED_AVXS = cppnone cppsse4 cppavx2 cpp512y cpp512z cppauto
+madevent_%_link:
+ @if [ '$(words $(filter $*, $(SUPPORTED_AVXS)))' != '1' ]; then echo "ERROR! Invalid target '$@' (supported madevent_cpp*_link targets are: $(foreach avx,$(SUPPORTED_AVXS),'madevent_$(avx)_link'))"; exit 1; fi
+ $(MAKE) USEGTEST=0 BACKEND=$* $(CUDACPP_BUILDDIR)/$(PROG)_cpp
+ $(MAKE) USEGTEST=0 USEBUILDDIR=1 BACKEND=$* FPTYPE=$(FPTYPE) madevent_cudacpp_link
+ rm -f $(PROG)
+ ln -s $(CUDACPP_BUILDDIR)/$(PROG)_cpp $(PROG)

-$(LIBDIR)libgammaUPC.$(libext):
- cd ../../Source/PDF/gammaUPC; make
+
+# Building $(PROG)_cpp no longer builds $(PROG)_cuda if CUDACPP_BACKENDLIB for cuda exists (this was the case in the past to allow cpp-only builds #503)
+$(CUDACPP_BUILDDIR)/$(PROG)_cpp: $(PROCESS) $(DSIG_cudacpp) auto_dsig.o $(LIBS) $(MATRIX) counters.o ompnumthreads.o $(CUDACPP_BUILDDIR)/.cudacpplibs
+ $(FC) -o $@ $(PROCESS) $(DSIG_cudacpp) auto_dsig.o $(MATRIX) $(LINKLIBS) $(BIASDEPENDENCIES) $(OMPFLAGS) counters.o ompnumthreads.o -L$(LIBDIR)/$(CUDACPP_BUILDDIR) -l$(CUDACPP_COMMONLIB) -l$(CUDACPP_BACKENDLIB) $(LIBFLAGSRPATH) $(LDFLAGS)
Expand Down Expand Up @@ -263,7 +267,7 @@ index 348c283be..64b33c4f1 100644

# Dependencies

@@ -97,5 +245,80 @@ unwgt.o: genps.inc nexternal.inc symswap.inc cluster.inc run.inc message.inc \
@@ -97,5 +249,80 @@ unwgt.o: genps.inc nexternal.inc symswap.inc cluster.inc run.inc message.inc \
run_config.inc
initcluster.o: message.inc

Expand Down

0 comments on commit 58d13bd

Please sign in to comment.