-
Notifications
You must be signed in to change notification settings - Fork 32
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
Test refactoring of Makefiles #753
base: master
Are you sure you want to change the base?
Conversation
23865af
to
366ddfc
Compare
will comment here (another?) issue with the makefile that we might want to handle at the same time. If I try to compile the pure fortran code (on my mac). First error is:
obviously having CUDACPP_BUILDDIR empty is reasonable in this particular case. second error (after removing such check by hand) is
which is related to avoid 'failed to convert GOTPCREL relocation' error #458 UPDATEproblem was a bash syntax not supported on all terminal/bash version |
Now that C++ and cuda build folders are separate, the test cases have to be instantiated on every compiler pass.
clang-format 16 was not accepting the macros at the end of runTest.cc
In order to generate a correct patch for madgraph4gpu, the generated code cannot be patched. Therefore, the pre-patch step is removed here. The desired change (-O3 -ffast-math -fbounds-check) is absorbed into patch.common
08ac94d
to
96f9ba7
Compare
…2py patching from generateAndCompare.sh to patchMad.sh Before this commit, codegen was now failing on itscrd90 as it was previously failing on itscrd80 (patchMd.sh fails due to f2py) After this commit, codegen is succeeding again on itscrd90, and now also on itscrd80 (fixing the issue in PR madgraph5#753)
Hi @hageboeck thanks for all this, I started having a look. The first thing that I think needs solving is that the CI fails. In the codegen, many of my new actions fail patchMad.sh. I actually realised that this was also happening across my nodes: on el9 the codegen was ok, but not on el8. So I added a fix in WIP PR #797. However in that PR my CI also fails, so I guess there is still more to be done. I will investigaete more |
Hi again, I think I fixed the make_opts issue. The CI however now fails because we need clang format 16 and this is not available in the CI. You have an easy way to do that (without external actions from outside official github, preferably)? Otherwise, do we really need clang format 16? You changed runTest.cc formatting for that, but I was using clang format 13 previously. (An alternative is to not require 16, and disable formatting in runTest.cc) |
Ok now clang-format-16 is fixed Next issues
(One more issue would be caching clang-16... but in the end I removed the need for clang-16, now 13 is ok, and I protected runTest.cc) |
Hi @hageboeck I will stop here, sorry. The main issue is that
I had a look, you removed those (ugly, I admit) .lib and replaced by explicit discretesampler.mod. Can you please have a look yourslef and try to fix |
Hello @valassi, I had a look. Long story short: In a bit more detail: The module that's missing above gets built in the following way: See this demonstration: $ make dsample.o
gfortran -I. -fPIC -w -ffixed-line-length-132 -O3 -ffast-math -fbounds-check -c DiscreteSampler.f -o DiscreteSampler.o
gfortran -I. -fPIC -w -ffixed-line-length-132 -O3 -ffast-math -fbounds-check -c dsample.f -o dsample.o The makefile implements the dependency via object files, and hopes that the modules drop out correctly. I never touched that part: It's just that ccache doesn't create modules. Since I don't use ccache for madgraph, I never saw any problems. I can clean and I don't know what the way forward is. You could disable ccache for Fortran, or you could add special make rules for Fortran compilations that also generate modules. |
Hi @hageboeck thanks. Various points.
Anyway: I agree, for clarity it is probably better to remove ccache from gfortran. I have done this in codegen in my branch.
Rephrasing:
What I miss here is (1) something that cleans also src and Source (distclean is too m,uch, it also cleans googletest) and (2) the fact that build.* are not removed for me on linux. And by the way I think we do not need cleanavx2? |
I am just comparing what these were doing before
I would keep something similar: a simple 'make cleanall' to clean also src/lib/Source. Or we can discuss it. It is clearly "ugly" that "make" also makes src/Source/lib while "make clean" does not clean that? And we maybe need a way to make all P* subdirectories too... |
It's doing the same now; just leaving the directories intact. Maybe you want me to remove the directories, too, but I didn't do that because you might have profiling results or other data in those. I just remove build artifacts, so it doesn't destroy something that you would like to keep. Can be discussed.
It does the same except for cleaning src/Source. For those, there is - cleanall:
+ cleanall: cleansrc Say it and I add this.
For that, there would be the meta-Makefile in cd gg_tt.mad
make -j cppavx2
make clean and this would build and clean all |
Zenny's and Filips work showed that the colour matrix can run in single precision without impact on the results. Make this the default in the makefiles now.
- clean will now also remove build directories when they are empty. - cleanall will also invoke cleansrc to clean the source directory.
96f9ba7
to
629d5aa
Compare
Hello @valassi, just pushed the following amendments:
|
Thanks Stefan I will have a look! Listen at least some of the patches I have in #797 are also needed, how do you prefer that we proceed? Maybe I make a subset and make them as a PR against your branch? Or I tell you which ones to cherry-pick? Thanks |
…2py patching from generateAndCompare.sh to patchMad.sh (This is an old commit from 9 Dec but the description is still valid on 14 Dec) Before this commit, codegen was now failing on itscrd90 as it was previously failing on itscrd80 (patchMd.sh fails due to f2py) After this commit, codegen is succeeding again on itscrd90, and now also on itscrd80 (fixing the issue in PR madgraph5#753)
@hageboeck thanks I am having a look. A couple of points
More later! |
Interesting. Of course I will wait, because I know what conflict resolution feels like in this project. Also interesting that you ask whether I tested that. Of course I tested! Both on mac and linux. I do nothing without testing it, but of course I might overlook specific workflows. In this case, this seems to be cleaning without having a build directory. The fix is easy, but I see that you are already doing that, so will wait now as promised. |
Thanks Stephan! Yes I imagine you tested... which is even more surprising. Maybe you tested only with a clean dir? The failure is only when build.* have already been deleted. This is because |
Based on Jorgen's work to separate builds with different vectorisation levels and cuda into dedicated targets and build folders, here we completely change the strategy how makefiles are used.
TODOs:
-mmacosx-version-min=11.3
patch. I tried to incorporate it as best as possible, but using this option now leads to the warning "ld: warning: dylib (../../lib/build.native_d_inl0_hrd0/libmg5amc_common.so) was built for newer macOS version (13.0) than being linked (11.3)", which is understandable if the link version is that old". I might have misunderstood what the patch was supposed to fix, but it's not removing the warning, it's adding one at the moment.General description (might need to be updated before merge):
--> Now, only one make is invoked to build both C++ and Fortran executables (or fortran+cuda for the cuda build)
--> Setup such as architecture selection and compiler things don't have to be repeated in each Makefile
flags are now called MG_CXXFLAGS, and CXXFLAGS are appended to the
compiler invocation. Similar flags exist for FC and NVCC.
make CXXFLAGS="-O0 -g" cppavx2
to debug C++ with avx2 (or export that variable for an entire session) without breaking the build system.directory. This includes the library, object files and all executables.
itself with the appropriate flags. This allows for parallel
architecture-specific builds, and greatly simplifies the Makefiles.
make cppavx2
will e.g. do something like$(make) AVX=avx2 AVXFLAGS=<...> cpp
-march=native
if the user doesn't specify anything else.make cuda
make cppall
for all of the abovemake ALL
for all cpp and cudamake cppnative