Skip to content
New issue

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

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

Already on GitHub? # to your account

Clean up interaction of Subprocess and src Makefile (export, override etc) #414

Open
valassi opened this issue Apr 2, 2022 · 1 comment
Assignees

Comments

@valassi
Copy link
Member

valassi commented Apr 2, 2022

Low priority reminder.

Currently the cudacpp plugin drives builds from the Subprocess/P1 directory (by the way, what will happen with pp, with several subprocesses?). A 'make' in Subprocess/P1 triggers a 'make' in src too. The 'override' command is used extensively in both Makefiles (needed? I added this to be insensitive to extetnal env variables I think). Some default values if variables are not set (eg for AVX) are set in Subprocess Makefile, then 'export' is used to propagate them to src too.

This normally works fine, but I realised that for instance 'make AVX=' fails, because AVX is then set with override in Subprocess, 'export AVX' is called too, but then actually src builds still using 'AVX=' from the command line. This is because of MAKEOVERRIDES, see https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html. In practice:

[avalassi@itscrd70 gcc10.2/cvmfs] /data/avalassi/GPU2020/madgraph4gpuTer/epochX/cudacpp/gg_tt/SubProcesses/P1_Sigma_sm_gg_ttx> make AVX=
OMPFLAGS=
AVX=512y
FPTYPE=d
HELINL=0
HRDCOD=0
RNDGEN=hasCurand
Building in BUILDDIR=. for tag=512y_d_inl0_hrd0_hasCurand (USEBUILDDIR is not set)
make -C ../../src 
AVX=
make[1]: Entering directory `/data/avalassi/GPU2020/madgraph4gpuTer/epochX/cudacpp/gg_tt/src'
Makefile:93: *** Unknown AVX='': only 'none', 'sse4', 'avx2', '512y' and '512z' are supported.  Stop.
make[1]: Leaving directory `/data/avalassi/GPU2020/madgraph4gpuTer/epochX/cudacpp/gg_tt/src'
make: *** [../../lib/libmg5amc_common.so] Error 2

One workaround is to reset MAKEOVERRIDES. I have done this in a WIP PR, but it may have bad side effects
5a223bf
Another option might be to use 'make -e' but this is even worse as IIUC it would take precedence over all overrides.

I guess that for the moment I will just stay as it was (without resetting MAKEOVERRIDES). It is not a problem if 'make AVX=' fails, this is not meant to be used anyway.

Note: I am investigating all these issues as part of #400, because there I am calling the cudacpp Subprocess/P1 Makefile from the madevent makefile in the same directory.

@valassi valassi self-assigned this Apr 2, 2022
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2022
Revert "[v311] in gg_tt.mad cudacpp Makefile, reset MAKEOVERRIDES"
This reverts commit 5a223bf.
@valassi
Copy link
Member Author

valassi commented Jul 21, 2023

Note: in MR #723 I reintroduced CUDA builds in src because Parameters.cc must be built twoce, for c++ and cuda. I implemented this using export NVCC and it seems a good idea.

(I actually forgot also export CUFLAGS which I later added to fix #731).

I think that using export may be a good idea to simplify the src makefile, for instance one could remove the duplication of the handling of AVX flags.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant