Skip to content

Commit 90dd567

Browse files
committed
Merge remote-tracking branch 'upstream/master' (as of after HIP PR madgraph5#801 and gpucpp PR madgraph5#811) into makefiles
Fix conflicts in epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/gpu/cudacpp.mk
2 parents 7c28f76 + 94df524 commit 90dd567

1,301 files changed

Lines changed: 26619 additions & 19501 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MG5aMC/mg5amcnlo

Submodule mg5amcnlo updated 172 files

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/launch_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def default_setup(self):
103103
fct_mod=(self.reset_makeopts,(),{}),
104104
allowed=['auto', 'none', 'sse4', 'avx2','512y','512z'])
105105
self.add_param('cudacpp_backend', 'CPP', include=False, hidden=False,
106-
allowed=['Fortan', 'CPP', 'CUDA'])
106+
allowed=['Fortran', 'CPP', 'CUDA'])
107107
self['vector_size'] = 16 # already setup in default class (just change value)
108108
self['aloha_flag'] = '--fast-math'
109109
self['matrix_flag'] = '-O3'

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ generates includes the following authors:
1010
Stephan Hageboeck (CERN)
1111
Olivier Mattelaer (Universite Catholique de Louvain, original author)
1212
Stefan Roiser (CERN, original author)
13+
Jorgen Teig (CERN)
1314
Andrea Valassi (CERN, original author)
1415
Zenny Wettersten (CERN)
1516

@@ -28,5 +29,4 @@ acknowledged collaboration with the following collaborators:
2829
Taran Singhania (PES University Bangalore)
2930
David Smith (CERN)
3031
Carl Vuosalo (University of Wisconsin-Madison)
31-
Joergen Teig (CERN)
3232

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/COPYRIGHT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The full development team currently includes the following authors :
1515
Stephan Hageboeck (CERN)
1616
Olivier Mattelaer (Universite Catholique de Louvain, original author)
1717
Stefan Roiser (CERN, original author)
18+
Jorgen Teig (CERN)
1819
Andrea Valassi (CERN, original author)
1920
Zenny Wettersten (CERN)
2021
See https://github.com/madgraph5/madgraph4gpu for more details. For the full

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/cpp_model_parameters_cc.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Copyright (C) 2020-2023 CERN and UCLouvain.
55
// Licensed under the GNU Lesser General Public License (version 3 or later).
66
// Modified by: A. Valassi (Sep 2021) for the MG5aMC CUDACPP plugin.
7-
// Further modified by: A. Valassi (2021-2023) for the MG5aMC CUDACPP plugin.
7+
// Further modified by: J. Teig, A. Valassi (2021-2023) for the MG5aMC CUDACPP plugin.
88
//==========================================================================
99
// This file has been automatically generated for CUDA/C++ standalone by
1010
%(info_lines)s
@@ -15,7 +15,7 @@
1515
#include <iomanip>
1616
#include <iostream>
1717

18-
#ifdef __CUDACC__
18+
#ifdef MGONGPUCPP_GPUIMPL
1919
using namespace mg5amcGpu;
2020
#else
2121
using namespace mg5amcCpu;

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/cpp_model_parameters_h.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "read_slha.h"
2626

2727
// NB: namespaces mg5amcGpu and mg5amcCpu includes types which are defined in different ways for CPU and GPU builds (see #318 and #725)
28-
#ifdef __CUDACC__
28+
#ifdef MGONGPUCPP_GPUIMPL
2929
namespace mg5amcGpu
3030
#else
3131
namespace mg5amcCpu
@@ -85,7 +85,7 @@ namespace mg5amcCpu
8585
#include <limits>
8686

8787
// NB: namespaces mg5amcGpu and mg5amcCpu includes types which are defined in different ways for CPU and GPU builds (see #318 and #725)
88-
#ifdef __CUDACC__
88+
#ifdef MGONGPUCPP_GPUIMPL
8989
namespace mg5amcGpu
9090
#else
9191
namespace mg5amcCpu
@@ -155,7 +155,7 @@ namespace mg5amcCpu
155155
//==========================================================================
156156

157157
// NB: namespaces mg5amcGpu and mg5amcCpu includes types which are defined in different ways for CPU and GPU builds (see #318 and #725)
158-
#ifdef __CUDACC__
158+
#ifdef MGONGPUCPP_GPUIMPL
159159
namespace mg5amcGpu
160160
#else
161161
namespace mg5amcCpu
@@ -172,7 +172,7 @@ namespace mg5amcCpu
172172
#pragma GCC diagnostic push
173173
#pragma GCC diagnostic ignored "-Wunused-variable" // e.g. <<warning: unused variable ‘mdl_G__exp__2’ [-Wunused-variable]>>
174174
#pragma GCC diagnostic ignored "-Wunused-parameter" // e.g. <<warning: unused parameter ‘G’ [-Wunused-parameter]>>
175-
#ifdef __CUDACC__
175+
#ifdef MGONGPUCPP_GPUIMPL
176176
#pragma nv_diagnostic push
177177
#pragma nv_diag_suppress 177 // e.g. <<warning #177-D: variable "mdl_G__exp__2" was declared but never referenced>>
178178
#endif
@@ -196,7 +196,7 @@ namespace mg5amcCpu
196196
%(eftspecial2)s
197197
return out;
198198
}
199-
#ifdef __CUDACC__
199+
#ifdef MGONGPUCPP_GPUIMPL
200200
#pragma GCC diagnostic pop
201201
#pragma nv_diagnostic pop
202202
#endif

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/gpu/Bridge.h

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2020-2023 CERN and UCLouvain.
22
// Licensed under the GNU Lesser General Public License (version 3 or later).
33
// Created by: S. Roiser (Nov 2021) for the MG5aMC CUDACPP plugin.
4-
// Further modified by: S. Roiser, A. Valassi (2021-2023) for the MG5aMC CUDACPP plugin.
4+
// Further modified by: S. Roiser, J. Teig, A. Valassi (2021-2023) for the MG5aMC CUDACPP plugin.
55

66
#ifndef BRIDGE_H
77
#define BRIDGE_H 1
@@ -14,16 +14,23 @@
1414
#include "MemoryAccessMomenta.h" // for MemoryAccessMomenta::neppM
1515
#include "MemoryBuffers.h" // for HostBufferMomenta, DeviceBufferMomenta etc
1616

17+
//#ifdef __HIPCC__
18+
//#include <experimental/filesystem> // see https://rocm.docs.amd.com/en/docs-5.4.3/CHANGELOG.html#id79
19+
//#else
20+
//#include <filesystem> // bypass this completely to ease portability on LUMI #803
21+
//#endif
22+
23+
#include <sys/stat.h> // bypass std::filesystem #803
24+
1725
#include <algorithm>
1826
#include <cassert>
1927
#include <cmath>
2028
#include <cstring>
21-
#include <filesystem>
2229
#include <iostream>
2330
#include <memory>
2431
#include <type_traits>
2532

26-
#ifdef __CUDACC__
33+
#ifdef MGONGPUCPP_GPUIMPL
2734
namespace mg5amcGpu
2835
#else
2936
namespace mg5amcCpu
@@ -83,7 +90,7 @@ namespace mg5amcCpu
8390
Bridge& operator=( const Bridge& ) = delete;
8491
Bridge& operator=( Bridge&& ) = delete;
8592

86-
#ifdef __CUDACC__
93+
#ifdef MGONGPUCPP_GPUIMPL
8794
/**
8895
* Set the gpublocks and gputhreads for the gpusequence - throws if evnt != gpublocks*gputhreads
8996
* (this is needed for BridgeKernel tests rather than for actual production use in Fortran)
@@ -150,7 +157,7 @@ namespace mg5amcCpu
150157
unsigned int m_nevt; // number of events
151158
int m_nGoodHel; // the number of good helicities (-1 initially when they have not yet been calculated)
152159

153-
#ifdef __CUDACC__
160+
#ifdef MGONGPUCPP_GPUIMPL
154161
int m_gputhreads; // number of gpu threads (default set from number of events, can be modified)
155162
int m_gpublocks; // number of gpu blocks (default set from number of events, can be modified)
156163
DeviceBuffer<FORTRANFPTYPE, sizePerEventMomenta> m_devMomentaF;
@@ -187,12 +194,12 @@ namespace mg5amcCpu
187194
// Forward declare transposition methods
188195
//
189196

190-
#ifdef __CUDACC__
197+
#ifdef MGONGPUCPP_GPUIMPL
191198

192199
template<typename Tin, typename Tout>
193200
__global__ void dev_transposeMomentaF2C( const Tin* in, Tout* out, const unsigned int nevt );
194201

195-
#endif // __CUDACC__
202+
#endif // MGONGPUCPP_GPUIMPL
196203

197204
template<typename Tin, typename Tout>
198205
void hst_transposeMomentaF2C( const Tin* in, Tout* out, const unsigned int nevt );
@@ -209,7 +216,7 @@ namespace mg5amcCpu
209216
Bridge<FORTRANFPTYPE>::Bridge( unsigned int nevtF, unsigned int nparF, unsigned int np4F )
210217
: m_nevt( nevtF )
211218
, m_nGoodHel( -1 )
212-
#ifdef __CUDACC__
219+
#ifdef MGONGPUCPP_GPUIMPL
213220
, m_gputhreads( 256 ) // default number of gpu threads
214221
, m_gpublocks( m_nevt / m_gputhreads ) // this ensures m_nevt <= m_gpublocks*m_gputhreads
215222
, m_devMomentaF( m_nevt )
@@ -233,7 +240,7 @@ namespace mg5amcCpu
233240
{
234241
if( nparF != CPPProcess::npar ) throw std::runtime_error( "Bridge constructor: npar mismatch" );
235242
if( np4F != CPPProcess::np4 ) throw std::runtime_error( "Bridge constructor: np4 mismatch" );
236-
#ifdef __CUDACC__
243+
#ifdef MGONGPUCPP_GPUIMPL
237244
if( ( m_nevt < s_gputhreadsmin ) || ( m_nevt % s_gputhreadsmin != 0 ) )
238245
throw std::runtime_error( "Bridge constructor: nevt should be a multiple of " + std::to_string( s_gputhreadsmin ) );
239246
while( m_nevt != m_gpublocks * m_gputhreads )
@@ -249,20 +256,28 @@ namespace mg5amcCpu
249256
#else
250257
std::cout << "WARNING! Instantiate host Bridge (nevt=" << m_nevt << ")" << std::endl;
251258
m_pmek.reset( new MatrixElementKernelHost( m_hstMomentaC, m_hstGs, m_hstRndHel, m_hstRndCol, m_hstMEs, m_hstSelHel, m_hstSelCol, m_nevt ) );
252-
#endif // __CUDACC__
259+
#endif // MGONGPUCPP_GPUIMPL
253260
// Create a process object, read param card and set parameters
254261
// FIXME: the process instance can happily go out of scope because it is only needed to read parameters?
255262
// FIXME: the CPPProcess should really be a singleton? what if fbridgecreate is called from several Fortran threads?
256263
CPPProcess process( /*verbose=*/false );
257264
std::string paramCard = "../../Cards/param_card.dat";
258-
if( !std::filesystem::exists( paramCard ) )
259-
{
260-
paramCard = "../" + paramCard;
261-
}
265+
/*
266+
#ifdef __HIPCC__
267+
if( !std::experimental::filesystem::exists( paramCard ) ) paramCard = "../" + paramCard;
268+
#else
269+
if( !std::filesystem::exists( paramCard ) ) paramCard = "../" + paramCard;
270+
#endif
271+
*/
272+
//struct stat dummybuffer; // bypass std::filesystem #803
273+
//if( !( stat( paramCard.c_str(), &dummyBuffer ) == 0 ) ) paramCard = "../" + paramCard; //
274+
auto fileExists = []( std::string& fileName )
275+
{ struct stat buffer; return stat( fileName.c_str(), &buffer ) == 0; };
276+
if( !fileExists( paramCard ) ) paramCard = "../" + paramCard; // bypass std::filesystem #803
262277
process.initProc( paramCard );
263278
}
264279

265-
#ifdef __CUDACC__
280+
#ifdef MGONGPUCPP_GPUIMPL
266281
template<typename FORTRANFPTYPE>
267282
void Bridge<FORTRANFPTYPE>::set_gpugrid( const int gpublocks, const int gputhreads )
268283
{
@@ -276,7 +291,7 @@ namespace mg5amcCpu
276291
}
277292
#endif
278293

279-
#ifdef __CUDACC__
294+
#ifdef MGONGPUCPP_GPUIMPL
280295
template<typename FORTRANFPTYPE>
281296
void Bridge<FORTRANFPTYPE>::gpu_sequence( const FORTRANFPTYPE* momenta,
282297
const FORTRANFPTYPE* gs,
@@ -291,14 +306,14 @@ namespace mg5amcCpu
291306
constexpr int neppM = MemoryAccessMomenta::neppM;
292307
if constexpr( neppM == 1 && std::is_same_v<FORTRANFPTYPE, fptype> )
293308
{
294-
checkCuda( cudaMemcpy( m_devMomentaC.data(), momenta, m_devMomentaC.bytes(), cudaMemcpyHostToDevice ) );
309+
gpuMemcpy( m_devMomentaC.data(), momenta, m_devMomentaC.bytes(), gpuMemcpyHostToDevice );
295310
}
296311
else
297312
{
298-
checkCuda( cudaMemcpy( m_devMomentaF.data(), momenta, m_devMomentaF.bytes(), cudaMemcpyHostToDevice ) );
313+
gpuMemcpy( m_devMomentaF.data(), momenta, m_devMomentaF.bytes(), gpuMemcpyHostToDevice );
299314
const int thrPerEvt = CPPProcess::npar * CPPProcess::np4; // AV: transpose alg does 1 element per thread (NOT 1 event per thread)
300315
//const int thrPerEvt = 1; // AV: try new alg with 1 event per thread... this seems slower
301-
dev_transposeMomentaF2C<<<m_gpublocks * thrPerEvt, m_gputhreads>>>( m_devMomentaF.data(), m_devMomentaC.data(), m_nevt );
316+
gpuLaunchKernel( dev_transposeMomentaF2C, m_gpublocks * thrPerEvt, m_gputhreads, m_devMomentaF.data(), m_devMomentaC.data(), m_nevt );
302317
}
303318
if constexpr( std::is_same_v<FORTRANFPTYPE, fptype> )
304319
{
@@ -341,7 +356,7 @@ namespace mg5amcCpu
341356
}
342357
#endif
343358

344-
#ifndef __CUDACC__
359+
#ifndef MGONGPUCPP_GPUIMPL
345360
template<typename FORTRANFPTYPE>
346361
void Bridge<FORTRANFPTYPE>::cpu_sequence( const FORTRANFPTYPE* momenta,
347362
const FORTRANFPTYPE* gs,
@@ -396,7 +411,7 @@ namespace mg5amcCpu
396411
// - C++ array: momenta[npagM][npar][np4][neppM] with nevt=npagM*neppM (AOSOA)
397412
//
398413

399-
#ifdef __CUDACC__
414+
#ifdef MGONGPUCPP_GPUIMPL
400415
template<typename Tin, typename Tout>
401416
__global__ void dev_transposeMomentaF2C( const Tin* in, Tout* out, const unsigned int nevt )
402417
{

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/gpu/BridgeKernels.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
// Copyright (C) 2020-2023 CERN and UCLouvain.
22
// Licensed under the GNU Lesser General Public License (version 3 or later).
33
// Created by: A. Valassi (Jan 2022) for the MG5aMC CUDACPP plugin.
4-
// Further modified by: A. Valassi (2022-2023) for the MG5aMC CUDACPP plugin.
4+
// Further modified by: J. Teig, A. Valassi (2022-2023) for the MG5aMC CUDACPP plugin.
55

66
#include "BridgeKernels.h"
77

8+
#include "GpuAbstraction.h"
89
#include "MemoryAccessMomenta.h"
910

1011
#include <sstream>
1112

1213
//============================================================================
1314

14-
#ifdef __CUDACC__
15+
#ifdef MGONGPUCPP_GPUIMPL
1516
namespace mg5amcGpu
1617
#else
1718
namespace mg5amcCpu
@@ -45,7 +46,7 @@ namespace mg5amcCpu
4546

4647
//============================================================================
4748

48-
#ifndef __CUDACC__
49+
#ifndef MGONGPUCPP_GPUIMPL
4950
namespace mg5amcCpu
5051
{
5152

@@ -96,7 +97,7 @@ namespace mg5amcCpu
9697

9798
//============================================================================
9899

99-
#ifdef __CUDACC__
100+
#ifdef MGONGPUCPP_GPUIMPL
100101
namespace mg5amcGpu
101102
{
102103

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/gpu/BridgeKernels.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2020-2023 CERN and UCLouvain.
22
// Licensed under the GNU Lesser General Public License (version 3 or later).
33
// Created by: A. Valassi (Jan 2022) for the MG5aMC CUDACPP plugin.
4-
// Further modified by: A. Valassi (2022-2023) for the MG5aMC CUDACPP plugin.
4+
// Further modified by: J. Teig, A. Valassi (2022-2023) for the MG5aMC CUDACPP plugin.
55

66
#ifndef BRIDGEKERNELS_H
77
#define BRIDGEKERNELS_H 1
@@ -12,7 +12,7 @@
1212
#include "MatrixElementKernels.h"
1313
#include "MemoryBuffers.h"
1414

15-
#ifdef __CUDACC__
15+
#ifdef MGONGPUCPP_GPUIMPL
1616
namespace mg5amcGpu
1717
#else
1818
namespace mg5amcCpu
@@ -49,7 +49,7 @@ namespace mg5amcCpu
4949

5050
//--------------------------------------------------------------------------
5151

52-
#ifndef __CUDACC__
52+
#ifndef MGONGPUCPP_GPUIMPL
5353
// A Bridge wrapper class encapsulating matrix element calculations on a CPU host
5454
class BridgeKernelHost final : public BridgeKernelBase
5555
{
@@ -89,7 +89,7 @@ namespace mg5amcCpu
8989

9090
//--------------------------------------------------------------------------
9191

92-
#ifdef __CUDACC__
92+
#ifdef MGONGPUCPP_GPUIMPL
9393
// A Bridge wrapper class encapsulating matrix element calculations on a GPU device
9494
class BridgeKernelDevice : public BridgeKernelBase
9595
{

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/gpu/CommonRandomNumberKernel.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
// Copyright (C) 2020-2023 CERN and UCLouvain.
22
// Licensed under the GNU Lesser General Public License (version 3 or later).
33
// Created by: A. Valassi (Dec 2021) for the MG5aMC CUDACPP plugin.
4-
// Further modified by: A. Valassi (2021-2023) for the MG5aMC CUDACPP plugin.
4+
// Further modified by: J. Teig, A. Valassi (2021-2023) for the MG5aMC CUDACPP plugin.
55

66
#include "CommonRandomNumbers.h"
7+
#include "GpuAbstraction.h"
78
#include "MemoryBuffers.h"
89
#include "RandomNumberKernels.h"
910

1011
#include <cassert>
1112

12-
#ifdef __CUDACC__
13+
#ifdef MGONGPUCPP_GPUIMPL
1314
namespace mg5amcGpu
1415
#else
1516
namespace mg5amcCpu

0 commit comments

Comments
 (0)