-
Notifications
You must be signed in to change notification settings - Fork 33
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
tRex implementation #1025
base: master
Are you sure you want to change the base?
tRex implementation #1025
Changes from all commits
a3c2cde
89629da
ce4e536
9f798d6
77ee370
d3815b8
333bb5c
0050026
43ef2e8
fb7a254
d041b35
15a2a65
d5933a8
b5827c2
5433aac
e5a95d3
f755c17
8c78800
ad46244
0e4c680
77488e3
ff6b3e1
4b9b82e
12ae2f8
ad48bbc
6c00da5
506b2e8
52016c2
00a081c
c2a9e85
06bd58f
a166e74
4f68de8
55fdda9
4c01292
9a50131
ea796d0
2aeb8a3
9f7bc60
b4f1689
212a9e0
1358fcb
5ecc699
abb441e
cf602a1
47a15ab
07e0754
bed013d
07845c1
14ac1d9
35de4df
f111828
4244662
305c781
b4a7b35
15df2e6
9ccc0d7
c0a3dc6
c6c6234
55dcb6b
a647b4b
5439b7d
1b67e65
a45dcb5
4416181
3cc0280
c4164fe
6eea889
85b185f
0ba830d
c48fc6c
052b61b
23d504b
36b7139
e442637
eaa2a3b
deb07ae
910bfce
63bbbfc
d9fefe6
3f08dc4
bc74e37
89545ec
eda824f
f3063fc
f6969fe
f12ed00
8785101
1a04413
2af839d
68406a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../../../../../tools/REX/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright (C) 2020-2024 CERN and UCLouvain. | ||
// Licensed under the GNU Lesser General Public License (version 3 or later). | ||
// Created by: S. Roiser (Nov 2021) for the MG5aMC CUDACPP plugin. | ||
// Further modified by: S. Roiser, J. Teig, A. Valassi (2021-2024) for the MG5aMC CUDACPP plugin. | ||
// Further modified by: S. Roiser, J. Teig, A. Valassi, Z. Wettersten (2021-2024) for the MG5aMC CUDACPP plugin. | ||
|
||
#ifndef BRIDGE_H | ||
#define BRIDGE_H 1 | ||
|
@@ -255,18 +255,22 @@ namespace mg5amcCpu | |
throw std::logic_error( "Bridge constructor: FIXME! cannot choose gputhreads" ); // this should never happen! | ||
m_gpublocks = m_nevt / m_gputhreads; | ||
} | ||
#ifdef MGONGPU_VERBOSE_BRIDGE | ||
std::cout << "WARNING! Instantiate device Bridge (nevt=" << m_nevt << ", gpublocks=" << m_gpublocks << ", gputhreads=" << m_gputhreads | ||
<< ", gpublocks*gputhreads=" << m_gpublocks * m_gputhreads << ")" << std::endl; | ||
#endif | ||
m_pmek.reset( new MatrixElementKernelDevice( m_devMomentaC, m_devGs, m_devRndHel, m_devRndCol, m_devChannelIds, m_devMEs, m_devSelHel, m_devSelCol, m_gpublocks, m_gputhreads ) ); | ||
#else | ||
#ifdef MGONGPU_VERBOSE_BRIDGE | ||
std::cout << "WARNING! Instantiate host Bridge (nevt=" << m_nevt << ")" << std::endl; | ||
#endif | ||
m_pmek.reset( new MatrixElementKernelHost( m_hstMomentaC, m_hstGs, m_hstRndHel, m_hstRndCol, m_hstChannelIds, m_hstMEs, m_hstSelHel, m_hstSelCol, m_nevt ) ); | ||
#endif // MGONGPUCPP_GPUIMPL | ||
// Create a process object, read param card and set parameters | ||
// FIXME: the process instance can happily go out of scope because it is only needed to read parameters? | ||
// FIXME: the CPPProcess should really be a singleton? what if fbridgecreate is called from several Fortran threads? | ||
CPPProcess process( /*verbose=*/false ); | ||
std::string paramCard = "../../Cards/param_card.dat"; | ||
std::string paramCard = "../Cards/param_card.dat"; // ZW: change default param_card.dat location to one dir down | ||
/* | ||
#ifdef __HIPCC__ | ||
if( !std::experimental::filesystem::exists( paramCard ) ) paramCard = "../" + paramCard; | ||
|
@@ -278,7 +282,12 @@ namespace mg5amcCpu | |
//if( !( stat( paramCard.c_str(), &dummyBuffer ) == 0 ) ) paramCard = "../" + paramCard; // | ||
auto fileExists = []( std::string& fileName ) | ||
{ struct stat buffer; return stat( fileName.c_str(), &buffer ) == 0; }; | ||
if( !fileExists( paramCard ) ) paramCard = "../" + paramCard; // bypass std::filesystem #803 | ||
size_t paramCardCheck = 2; // ZW: check for paramCard up to 2 directories up | ||
for( size_t k = 0; k < paramCardCheck; ++k ) | ||
{ | ||
if( fileExists( paramCard ) ) break; // bypass std::filesystem #803 | ||
paramCard = "../" + paramCard; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok This makes sense (I guess) But is this only for HIP? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is just a way to generalise our previous method, which checked if the param_card was two directories up and otherwise assumed it was 3 (such as if we have a build directory). this is general, i believe |
||
process.initProc( paramCard ); | ||
} | ||
|
||
|
@@ -347,7 +356,9 @@ namespace mg5amcCpu | |
if( goodHelOnly ) return; | ||
m_pmek->computeMatrixElements( useChannelIds ); | ||
copyHostFromDevice( m_hstMEs, m_devMEs ); | ||
#ifdef MGONGPU_VERBOSE_BRIDGE | ||
flagAbnormalMEs( m_hstMEs.data(), m_nevt ); | ||
#endif | ||
copyHostFromDevice( m_hstSelHel, m_devSelHel ); | ||
copyHostFromDevice( m_hstSelCol, m_devSelCol ); | ||
if constexpr( std::is_same_v<FORTRANFPTYPE, fptype> ) | ||
|
@@ -400,7 +411,9 @@ namespace mg5amcCpu | |
} | ||
if( goodHelOnly ) return; | ||
m_pmek->computeMatrixElements( useChannelIds ); | ||
#ifdef MGONGPU_VERBOSE_BRIDGE | ||
flagAbnormalMEs( m_hstMEs.data(), m_nevt ); | ||
#endif | ||
if constexpr( std::is_same_v<FORTRANFPTYPE, fptype> ) | ||
{ | ||
memcpy( mes, m_hstMEs.data(), m_hstMEs.bytes() ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds dangerous...
Can you comment more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should not be an issue --- basically, our previous path assumed that the param_card was at least two subdirectories up, but since i'm running tRex from Subprocesses, it will only be one directory up. this would only cause an issue if there exists a file /Cards/param_card.dat IN Subprocesses, which i see no reason why anyone would add?