-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[builds] in CODEGEN, backport cudand changes from gg_tt.mad madgraph5…
…/madgraph4gpu#679, include small formatting fixes
- Loading branch information
Showing
7 changed files
with
95 additions
and
56 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
madgraph/iolibs/template_files/gpu/CommonRandomNumberKernel.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (C) 2020-2023 CERN and UCLouvain. | ||
// Licensed under the GNU Lesser General Public License (version 3 or later). | ||
// Created by: A. Valassi (Dec 2021) for the MG5aMC CUDACPP plugin. | ||
// Further modified by: A. Valassi (2021-2023) for the MG5aMC CUDACPP plugin. | ||
|
||
#include "CommonRandomNumbers.h" | ||
#include "MemoryBuffers.h" | ||
#include "RandomNumberKernels.h" | ||
|
||
#include <cassert> | ||
|
||
#ifdef __CUDACC__ | ||
namespace mg5amcGpu | ||
#else | ||
namespace mg5amcCpu | ||
#endif | ||
{ | ||
//-------------------------------------------------------------------------- | ||
|
||
CommonRandomNumberKernel::CommonRandomNumberKernel( BufferRndNumMomenta& rnarray ) | ||
: RandomNumberKernelBase( rnarray ) | ||
, m_seed( 20211220 ) | ||
{ | ||
if( m_rnarray.isOnDevice() ) | ||
throw std::runtime_error( "CommonRandomNumberKernel on host with a device random number array" ); | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
|
||
void CommonRandomNumberKernel::generateRnarray() | ||
{ | ||
std::vector<double> rnd = CommonRandomNumbers::generate<double>( m_rnarray.size(), m_seed ); // NB: generate as double (HARDCODED) | ||
std::copy( rnd.begin(), rnd.end(), m_rnarray.data() ); // NB: copy may imply a double-to-float conversion | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters