madgraph5 / madgraph4gpu

GPU development for the Madgraph5_aMC@NLO event generator software package
28 stars 33 forks source link

Extend runTest to allow fortran-cpp comparisons (add Bridge::fortran_sequence) #876

Open valassi opened 1 week ago

valassi commented 1 week ago

From some ideas discussed at the meeting this week.

It would be nice to extend runTest to allow fortran-cpp comparisons

This is rather straight forward if one extends Bridge to add Bridge::fortran_sequence. The point is that Bridge provides a C++ API to run operations on some data which we assume in fortran format already. (And check.exe has an option to emulate bridge starting from data created on c++). So the fortran sequence should not do any copy or transposing, it can just call fortran.

One trick inside the bridge fortransequence is then calling an actual fortran function (which I guess is SMATRIX1: just look at the fortran/cpp switch inside autodsig1.f). The technicality of cross linking should be straight forward, Assuming that SMATRIX1 is the function, then we can call it from c as 'smatrix1' with the underscore. This is the same mechanism as for fbridgecreate for instance: fbridgecreate is a fortran name (actually it is defined as an INTERFACE in a .inc), then its implementation happens to be in c++, but it can be called both from fortran as fbridgecreate or from c as fbridgecreate. Maybe for clarity it is best to use an smatrix1wrapper or smatrix1bridge function/subroutine. The idea is the same as fbridgecreate, but with one difference: again we should have INTERFACE smatrix1wrapper, and again we can call it from fortran as smatrix1wrapper or from c as smatrix1wrapper, but the difference is that its actual implementation would be in fortran and not in c.