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

Add SM gq to ttq (and gq to ttllq) - example of a process with DSIG1 and DSIG2 #626

Merged
merged 30 commits into from
Apr 6, 2023

Conversation

valassi
Copy link
Member

@valassi valassi commented Apr 3, 2023

This is a WIP PR adding SM gq to ttq and gq to ttllq.

The first is a deminstrator for the need of split_nonidentical_grouping upstream #619

The second is another test I had made before I understood that gq to ttq was enough for #272 and #619. It is a demonstrator of another issue that I need to file (FFV should not include "-COUP")

Note that both of these processes I had initially included as SUSY rather than SM (inspired from the cards of @nscottnichols in https://github.com/nscottnichols/madgraph4gpu/blob/f9689784390e2975a055711b3a8d79f7b7688860/epochX/sycl/CODEGEN/generateAndCompare2.sh#L58). But in the end a SM process is enough

Copying @oliviermattelaer and @zeniheisser for info

I will add even more issues for SUSY

@valassi
Copy link
Member Author

valassi commented Apr 4, 2023

Notes from trying to reverse engineer DSIG2.

The 2 in DSIG2 is proc_id from https://github.com/mg5amcnlo/mg5amcnlo/blob/60fae94f7aafbe8b3a2e2a0cff322bb65fa8d3df/madgraph/iolibs/template_files/auto_dsig_v4.inc#L1

That proc_id comes IIUC from ProcessExporterFortranME.write_auto_dsig_file in https://github.com/mg5amcnlo/mg5amcnlo/blob/60fae94f7aafbe8b3a2e2a0cff322bb65fa8d3df/madgraph/iolibs/export_v4.py#L4857

In particular proc_id is ime+1 from https://github.com/mg5amcnlo/mg5amcnlo/blob/60fae94f7aafbe8b3a2e2a0cff322bb65fa8d3df/madgraph/iolibs/export_v4.py#L6175

where ime is for ime, matrix_element in enumerate(matrix_elements): in https://github.com/mg5amcnlo/mg5amcnlo/blob/60fae94f7aafbe8b3a2e2a0cff322bb65fa8d3df/madgraph/iolibs/export_v4.py#L6107

and higher up matrix_elements = subproc_group.get('matrix_elements') from ProcessExporterFortranMEGroup.generate_subprocess_directory(self, subproc_group, ...)

Lower down in the same file

self.write_maxamps_file(writers.FortranWriter(filename),
                           maxamps,
                           maxflows,
                           max([len(me.get('processes')) for me in \
                                matrix_elements]),
                           len(matrix_elements))

where

    def write_maxamps_file(self, writer, maxamps, maxflows,
                           maxproc,maxsproc):
        """Write the maxamps.inc file for MG4."""

        file = "       integer    maxamps, maxflow, maxproc, maxsproc\n"
        file = file + "parameter (maxamps=%d, maxflow=%d)\n" % \
               (maxamps, maxflows)
        file = file + "parameter (maxproc=%d, maxsproc=%d)" % \
               (maxproc, maxsproc)

So, as I was suspecting, the number of DSIG functions (and auto_dsigN files) is MAXSPROC in maxamps.inc

NB this has two P1 subdirectories gu_ttxu/gux_ttxux! (but nprocesses=1 in each see madgraph5#272)
The code builds and runs successfully in each of the two subdirectories
NB this has a single P1 subdirectory gq_ttxq! (but nprocesses=1 in each see madgraph5#272)

The Fortran code has DSIG1 and also DSIG2.
Clearly the DSIG2 code is not correctly interfaced to our cudacpp

The code fails to build:
...
ccache g++  -O3  -std=c++17 -I. -I../../src -I../../../../../tools -DUSE_NVTX -Wall -Wshadow -Wextra -ffast-math  -fopenmp -march=skylake-avx512 -mprefer-vector-width=256  -DMGONGPU_FPTYPE_DOUBLE -DMGONGPU_FPTYPE2_DOUBLE -I/usr/local/cuda-12.0/include/ -fPIC -c CPPProcess.cc -o CPPProcess.o
In file included from CPPProcess.cc:25:
coloramps.h:18:3: error: too many initializers for ‘const bool [5][4]’
   18 |   };
      |   ^
...
ccache /usr/local/cuda-12.0/bin/nvcc  -O3  -lineinfo -I. -I../../src -I../../../../../tools -I/usr/local/cuda-12.0/include/ -DUSE_NVTX -gencode arch=compute_70,code=compute_70 -gencode arch=compute_70,code=sm_70 -use_fast_math -std=c++17  -ccbin /usr/lib64/ccache/g++ -DMGONGPU_FPTYPE_DOUBLE -DMGONGPU_FPTYPE2_DOUBLE -Xcompiler -fPIC -c gCPPProcess.cu -o gCPPProcess.o
coloramps.h(13): error: too many initializer values

NB this is still using the old upstream mg5amcnlo before Olivier's split_nonidentical_grouping (see madgraph5#619)
I have previewed that after merging that, there will be two separate P1 subdirectories also in .mad (as in .sa)
This is
  cmd="define q = u c d s u~ c~ d~ s~; generate g q > t t~ l- l+ q"
This currently generates successfully, but has some formatting issues in codegen

Note: this has several DSIG1, DSIG2, DSIG3, DSIG4 in the Fortran for .mad, but still nprocesses=1 in the CUDACPP
I had initially tested this for madgraph5#272, but in the end gq_ttq is enough (I will keep it in codegen anyway)

Note: this has four separate directories in the .sa. The build fails, eg in the first one
[avalassi@itscrd90 gcc11/usr] /data/avalassi/GPU2023/madgraph4gpuX/epochX/cudacpp/gq_ttllq.sa/SubProcesses/P1_Sigma_sm_gu_ttxemepu> make -j
ccache g++  -O3  -std=c++17 -I. -I../../src -I../../../../../tools -DUSE_NVTX -Wall -Wshadow -Wextra -ffast-math  -fopenmp -march=skylake-avx512 -mprefer-vector-width=256  -DMGONGPU_FPTYPE_DOUBLE -DMGONGPU_FPTYPE2_DOUBLE -I/usr/local/cuda-12.0/include/ -fPIC -c CPPProcess.cc -o CPPProcess.o
CPPProcess.cc: In function ‘void mg5amcCpu::calculate_wavefunctions(int, const fptype*, const fptype*, mgOnGpu::fptype*, fptype_sv*, int)’:
CPPProcess.cc:286:85: error: wrong type argument to unary minus
  286 |       FFV2_5_0<W_ACCESS, A_ACCESS, CI_ACCESS>( w_fp[10], w_fp[6], w_fp[11], -COUPs[3], COUPs[5], &amp_fp[0] );
      |                                                                              ~~~~~~~^

(I initially thought this only hapened in SUSY processes, but actually it also happens in this SM process...)
…SM gq_ttllq, fixing its clang formatting

(But the build in .sa was already failing due to other issues, so I cannot test if this specific "quarter" patch builds ok)
…N, code is unchanged (reduce later changes in codegen logs)
…neProcessExporter (0 in standalone, 1,2... in madevent+cudacpp)

This will later be forced to be always equal to 0 or 1 (there must be a single DSIG1!)

This is essentially what the 'nprocesses=1' assumption of madgraph5#272 is about.
But it seems that nprocesses already is always 1 in generated code (will keep that too).
…es process_id which will fail an assert!

Indeed this fails the builds with
In file included from CPPProcess.cc:25:
coloramps.h:18:3: error: too many initializers for ‘const bool [5][4]’
   18 |   };
      |   ^
CPPProcess.cc: In function ‘void mg5amcCpu::sigmaKin(const fptype*, const fptype*, const fptype*, const fptype*, mgOnGpu::fptype*, unsigned int, mgOnGpu::fptype*, mgOnGpu::fptype*, int*, int*, int)’:
CPPProcess.cc:860:33: error: static assertion failed: Assume process_id == 1
  860 |       static_assert( process_id == 1, "Assume process_id == 1" );
      |                      ~~~~~~~~~~~^~~~
… (prepare to regenerate with Olivier's madgraph5#619 patch that splits in in two)

git mv gq_ttq.mad/SubProcesses/P1_gq_ttxq gq_ttq.mad/SubProcesses/P1_gu_ttxu
cp -dpr gq_ttq.mad/SubProcesses/P1_gu_ttxu gq_ttq.mad/SubProcesses/P1_gux_ttxux/
git add gq_ttq.mad/SubProcesses/P1_gux_ttxux/
This merges the contents of MR madgraph5#619 "split_nonidentical_grouping"
I will now regenerate gq_ttq with the new upstream code by Olivier, which removes DSIG2 and fixes the issues
…tical_grouping madgraph5#619

Two (different) P1 subdirectories are now generated, each with only one DSIG1 (i.e. with MAXSPROC=1).
Previously a single P1 was generated, with DSIG1 and DSIG2 (i.e. with MAXSPROC=2).

Note also that a single LOGICAL ICOLAMP(4,5,2) is now replaced by two separate LOGICAL ICOLAMP(4,5,1)

Note however that nprocesses is always 1 in the cudacpp code in all P1 before and after.

The code builds and check.exe runs successfully in the two P1 directories (previously the build was failing)
@valassi
Copy link
Member Author

valassi commented Apr 5, 2023

I have tested that Olivier's "split_nonidentical_grouping" #619 fixes the issues with DSIG2 in gq_ttq.mad (I generated it before the patch, with DSIG2 and build errors, and after the patch, with two P1 directpries and no build errors).

I will now also remove all other 'nprocesses' comments for #272

… test continues to fail (madgraph5#630)

Will revert this commit and the previous one
…1_gux_ttxux to P1_gu_ttxu

The gqttq tests fail anyway and will need to be fixed (madgraph5#630).
However, this completes the addition of gq_ttq as a new process to the repo.
In particular it includes proof that Olivier's "split_nonidentical_grouping" madgraph5#619 fixes the gqttq builds.
It also includes a lot of cleanup for "nprocesses" (madgraph5#272 and madgraph5#343)

Revert "[gqttq] retry the tmad gqttq test with the P1_gu_ttxu directory - the test continues to fail (madgraph5#630)"
This reverts commit 2dea1f7.

Revert "[gqttq] temporarely use P1_gu_ttxu instead of P1_gux_ttxux for gqttq tmad tests"
This reverts commit ea23a9a.
@valassi valassi self-assigned this Apr 6, 2023
@valassi valassi marked this pull request as ready for review April 6, 2023 17:37
@valassi valassi changed the title WIP: add SM gq to ttq and gq to ttllq Add SM gq to ttq (and gq to ttllq) - example of a process with DSIG1 and DSIG2 Apr 6, 2023
@valassi
Copy link
Member Author

valassi commented Apr 6, 2023

After merging #619 yesterday, I will now self-merge this one, which is complete.

This adds gq_ttq, which is one example of a process where, BEFORE MR 619, there was only one P1 with DSIG1 and DSIG2. The patches I merge here include code before and code before MR 619. Conversely, AFTER MR 619, there are two P1 each with a single DSIG1. This is (I think) what the "nprocesses>1" of #272 was about. I have also cleaned up all comments about "nprocesses>1". See also #343" that is related.

Note, I have modified tput and tmad scripts to handle also gqttq (for the moment, using only oine of the two P1 directories). ne problem is that the fortran and cpp xsecs differ: this however will be handled in a separate issue #630.

Self-merging. And copying @oliviermattelaer @roiser @zeniheisser

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

Successfully merging this pull request may close these issues.

1 participant