Skip to content

Commit

Permalink
[jtmk] in gg_tt.mad, finally get rid of 'make -f cudacpp -pn' to dete…
Browse files Browse the repository at this point in the history
…rmine CUDACPP_BUILDDIR in madevent makefile madgraph5#829
  • Loading branch information
valassi committed Mar 26, 2024
1 parent fd30351 commit d0c59f2
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions epochX/cudacpp/gg_tt.mad/SubProcesses/makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
SHELL := /bin/bash

include ../../Source/make_opts

# Determine CUDACPP_BUILDDIR based on the user-defined choices of BACKEND, FPTYPE, HELINL, HRDCOD and USEBUILDDIR (#829)
# Stop with an error if BACKEND=cuda and nvcc is missing or if BACKEND=hip and hipcc is missing
include ../../src/cudacpp_builddir.mk
ifeq ($(CUDACPP_BUILDDIR),)
$(error CUDACPP_BUILDDIR='$(CUDACPP_BUILDDIR)' should not be empty!)
endif

# Disable all Fortran warnings?
FFLAGS+= -w

# Enable the C preprocessor https://gcc.gnu.org/onlinedocs/gfortran/Preprocessing-Options.html
Expand Down Expand Up @@ -48,22 +57,9 @@ endif

LINKLIBS = $(LINK_MADLOOP_LIB) $(LINK_LOOP_LIBS) -L$(LIBDIR) -ldhelas -ldsample -lmodel -lgeneric -lpdf -lcernlib $(llhapdf) -lbias

processid_short=$(shell basename $(CURDIR) | awk -F_ '{print $$(NF-1)"_"$$NF}')
CUDACPP_MAKEFILE=cudacpp.mk
# NB1 Using ":=" below instead of "=" is much faster (it only runs the subprocess once instead of many times)
# NB2 Use '|&' in CUDACPP_BUILDDIR to avoid confusing errors about googletest #507
# NB3 Do not add a comment inlined "CUDACPP_BUILDDIR=$(shell ...) # comment" as otherwise a trailing space is included...
# NB4 The variables relevant to the cudacpp Makefile must be explicitly passed to $(shell...)
CUDACPP_MAKEENV:=$(shell echo '$(.VARIABLES)' | tr " " "\n" | egrep "(USEBUILDDIR|BACKEND|FPTYPE|HELINL|HRDCOD)")
###$(info CUDACPP_MAKEENV=$(CUDACPP_MAKEENV))
###$(info $(foreach v,$(CUDACPP_MAKEENV),$(v)="$($(v))"))
CUDACPP_BUILDDIR:=$(shell $(MAKE) $(foreach v,$(CUDACPP_MAKEENV),$(v)="$($(v))") -f $(CUDACPP_MAKEFILE) -pn 2>&1 | awk '/Building/{print $$3}' | sed s/BUILDDIR=//)
ifeq ($(CUDACPP_BUILDDIR),)
$(error CUDACPP_BUILDDIR='$(CUDACPP_BUILDDIR)' should not be empty!)
else
$(info CUDACPP_BUILDDIR='$(CUDACPP_BUILDDIR)')
endif
CUDACPP_COMMONLIB=mg5amc_common
processid_short=$(shell basename $(CURDIR) | awk -F_ '{print $$(NF-1)"_"$$NF}')
ifeq ($(BACKEND),cuda)
CUDACPP_BACKENDLIB=mg5amc_$(processid_short)_cuda
else ifeq ($(BACKEND),hip)
Expand Down

0 comments on commit d0c59f2

Please # to comment.