Skip to content

Commit c794502

Browse files
committed
Update UMAMI with flavor indices
1 parent 2243a54 commit c794502

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

  • madgraph/iolibs/template_files/madmatrix

madgraph/iolibs/template_files/madmatrix/umami.cc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace
2525
void* initialize_impl(
2626
const fptype* momenta,
2727
const fptype* couplings,
28+
const unsigned int* flavor_indices,
2829
fptype* matrix_elements,
2930
#ifdef MGONGPUCPP_GPUIMPL
3031
fptype* color_jamps,
@@ -35,7 +36,7 @@ namespace
3536
{
3637
bool is_good_hel[CPPProcess::ncomb];
3738
sigmaKin_getGoodHel(
38-
momenta, couplings, matrix_elements, numerators, denominators,
39+
momenta, couplings, flavor_indices, matrix_elements, numerators, denominators,
3940
#ifdef MGONGPUCPP_GPUIMPL
4041
color_jamps,
4142
#endif
@@ -48,6 +49,7 @@ namespace
4849
void initialize(
4950
const fptype* momenta,
5051
const fptype* couplings,
52+
const unsigned int* flavor_indices,
5153
fptype* matrix_elements,
5254
#ifdef MGONGPUCPP_GPUIMPL
5355
fptype* color_jamps,
@@ -57,7 +59,7 @@ namespace
5759
std::size_t count )
5860
{
5961
// static local initialization is called exactly once in a thread-safe way
60-
static void* dummy = initialize_impl( momenta, couplings, matrix_elements,
62+
static void* dummy = initialize_impl( momenta, couplings, flavor_indices, matrix_elements,
6163
#ifdef MGONGPUCPP_GPUIMPL
6264
color_jamps,
6365
#endif
@@ -94,11 +96,13 @@ namespace
9496
const double* color_random_in,
9597
const double* diagram_random_in,
9698
const double* alpha_s_in,
99+
const unsigned int* flavor_indices_in,
97100
fptype* momenta,
98101
fptype* helicity_random,
99102
fptype* color_random,
100103
fptype* diagram_random,
101104
fptype* g_s,
105+
unsigned int* flavor_indices,
102106
std::size_t count,
103107
std::size_t stride,
104108
std::size_t offset )
@@ -111,6 +115,7 @@ namespace
111115
helicity_random[i_event] = helicity_random_in ? helicity_random_in[i_event + offset] : 0.5;
112116
color_random[i_event] = color_random_in ? color_random_in[i_event + offset] : 0.5;
113117
g_s[i_event] = alpha_s_in ? sqrt( 4 * M_PI * alpha_s_in[i_event + offset] ) : 1.2177157847767195;
118+
flavor_indices[i_event] = flavor_indices_in ? flavor_indices_in[i_event + offset] : 0;
114119
}
115120

116121
__global__ void copy_outputs(
@@ -242,7 +247,7 @@ extern "C"
242247
{
243248
const double* momenta_in = nullptr;
244249
const double* alpha_s_in = nullptr;
245-
const int* flavor_in = nullptr; // TODO: unused
250+
const unsigned int* flavor_indices_in = nullptr;
246251
const double* random_color_in = nullptr;
247252
const double* random_helicity_in = nullptr;
248253
const double* random_diagram_in = nullptr;
@@ -260,7 +265,7 @@ extern "C"
260265
alpha_s_in = static_cast<const double*>( input );
261266
break;
262267
case UMAMI_IN_FLAVOR_INDEX:
263-
flavor_in = static_cast<const int*>( input );
268+
flavor_indices_in = static_cast<const unsigned int*>( input );
264269
break;
265270
case UMAMI_IN_RANDOM_COLOR:
266271
random_color_in = static_cast<const double*>( input );
@@ -328,12 +333,13 @@ extern "C"
328333
fptype *momenta, *couplings, *g_s, *helicity_random, *color_random, *diagram_random, *color_jamps;
329334
fptype *matrix_elements, *numerators, *denominators, *ghel_matrix_elements, *ghel_jamps;
330335
int *helicity_index, *color_index;
331-
unsigned int* diagram_index;
336+
unsigned int *flavor_indices, *diagram_index;
332337

333338
std::size_t n_coup = mg5amcGpu::Parameters_dependentCouplings::ndcoup;
334339
gpuMallocAsync( &momenta, rounded_count * CPPProcess::npar * 4 * sizeof( fptype ), gpu_stream );
335340
gpuMallocAsync( &couplings, rounded_count * n_coup * 2 * sizeof( fptype ), gpu_stream );
336341
gpuMallocAsync( &g_s, rounded_count * sizeof( fptype ), gpu_stream );
342+
gpuMallocAsync( &flavor_indices, rounded_count * sizeof( unsigned int ), gpu_stream );
337343
gpuMallocAsync( &helicity_random, rounded_count * sizeof( fptype ), gpu_stream );
338344
gpuMallocAsync( &color_random, rounded_count * sizeof( fptype ), gpu_stream );
339345
gpuMallocAsync( &diagram_random, rounded_count * sizeof( fptype ), gpu_stream );
@@ -353,11 +359,13 @@ extern "C"
353359
random_color_in,
354360
random_diagram_in,
355361
alpha_s_in,
362+
flavor_indices_in,
356363
momenta,
357364
helicity_random,
358365
color_random,
359366
diagram_random,
360367
g_s,
368+
flavor_indices,
361369
count,
362370
stride,
363371
offset );
@@ -371,13 +379,14 @@ extern "C"
371379
if( !instance->initialized )
372380
{
373381
initialize(
374-
momenta, couplings, matrix_elements, color_jamps, numerators, denominators, rounded_count );
382+
momenta, couplings, flavor_indices, matrix_elements, color_jamps, numerators, denominators, rounded_count );
375383
instance->initialized = true;
376384
}
377385

378386
sigmaKin(
379387
momenta,
380388
couplings,
389+
flavor_indices,
381390
helicity_random,
382391
color_random,
383392
nullptr,
@@ -417,6 +426,7 @@ extern "C"
417426

418427
gpuFreeAsync( momenta, gpu_stream );
419428
gpuFreeAsync( couplings, gpu_stream );
429+
gpuFreeAsync( flavor_indices, gpu_stream );
420430
gpuFreeAsync( g_s, gpu_stream );
421431
gpuFreeAsync( helicity_random, gpu_stream );
422432
gpuFreeAsync( color_random, gpu_stream );
@@ -438,6 +448,7 @@ extern "C"
438448
HostBufferBase<fptype, false> momenta( rounded_count * CPPProcess::npar * 4 );
439449
HostBufferBase<fptype, false> couplings( rounded_count * mg5amcCpu::Parameters_dependentCouplings::ndcoup * 2 );
440450
HostBufferBase<fptype, false> g_s( rounded_count );
451+
HostBufferBase<unsigned int, false> flavor_indices( rounded_count );
441452
HostBufferBase<fptype, false> helicity_random( rounded_count );
442453
HostBufferBase<fptype, false> color_random( rounded_count );
443454
HostBufferBase<fptype, false> diagram_random( rounded_count );
@@ -463,6 +474,7 @@ extern "C"
463474
initialize(
464475
momenta.data(),
465476
couplings.data(),
477+
flavor_indices.data(),
466478
matrix_elements.data(),
467479
numerators.data(),
468480
denominators.data(),
@@ -473,6 +485,7 @@ extern "C"
473485
sigmaKin(
474486
momenta.data(),
475487
couplings.data(),
488+
flavor_indices.data(),
476489
helicity_random.data(),
477490
color_random.data(),
478491
nullptr,

0 commit comments

Comments
 (0)