Skip to content

Commit

Permalink
[epochX3] final cosmetic cleanup of manual - fix all files with (LHCb…
Browse files Browse the repository at this point in the history
…) emacs MX clean
  • Loading branch information
valassi committed Oct 20, 2021
1 parent b7d2a48 commit 5f4c2b9
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ int main(int argc, char **argv)
<< "], no SIMD)" << std::endl
#elif defined __AVX512VL__
#ifdef MGONGPU_PVW512
<< "Internal loops fptype_sv = VECTOR[" << neppV
<< "Internal loops fptype_sv = VECTOR[" << neppV
<< "] ('512z': AVX512, 512bit)" << cxtref << std::endl
#else
<< "Internal loops fptype_sv = VECTOR[" << neppV
Expand Down Expand Up @@ -942,15 +942,15 @@ int main(int argc, char **argv)
#if defined MGONGPU_COMMONRAND_ONHOST
<< "\"COMMON RANDOM HOST (CUDA code)\"," << std::endl;
#elif defined MGONGPU_CURAND_ONDEVICE
<< "\"CURAND DEVICE (CUDA code)\"," << std::endl;
<< "\"CURAND DEVICE (CUDA code)\"," << std::endl;
#elif defined MGONGPU_CURAND_ONHOST
<< "\"CURAND HOST (CUDA code)\"," << std::endl;
<< "\"CURAND HOST (CUDA code)\"," << std::endl;
#endif
#else
#if defined MGONGPU_COMMONRAND_ONHOST
<< "\"COMMON RANDOM (C++ code)\"," << std::endl;
<< "\"COMMON RANDOM (C++ code)\"," << std::endl;
#else
<< "\"CURAND (C++ code)\"," << std::endl;
<< "\"CURAND (C++ code)\"," << std::endl;
#endif
#endif
jsonFile << "\"NumberOfEntries\": " << niter << "," << std::endl
Expand Down
10 changes: 5 additions & 5 deletions epochX/cudacpp/ee_mumu/SubProcesses/runTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct CUDA_CPU_TestBase : public TestDriverBase<fptype> {
const std::size_t nMEs { nevt };

CUDA_CPU_TestBase() :
TestDriverBase()
TestDriverBase()
{
TestDriverBase::nparticle = mgOnGpu::npar;
}
Expand All @@ -62,8 +62,8 @@ struct CPUTest : public CUDA_CPU_TestBase {
// The CPPProcess constructor has side effects on the globals Proc::cHel, which is needed in ME calculations.
// Don't remove!
CPUTest() :
CUDA_CPU_TestBase(),
process(niter, gpublocks, gputhreads, /*verbose=*/false)
CUDA_CPU_TestBase(),
process(niter, gpublocks, gputhreads, /*verbose=*/false)
{
process.initProc("../../Cards/param_card.dat");
}
Expand Down Expand Up @@ -155,8 +155,8 @@ struct CUDATest : public CUDA_CPU_TestBase {
// The CPPProcess constructor has side effects on the globals Proc::cHel, which is needed in ME calculations.
// Don't remove!
CUDATest() :
CUDA_CPU_TestBase(),
process(niter, gpublocks, gputhreads, /*verbose=*/false)
CUDA_CPU_TestBase(),
process(niter, gpublocks, gputhreads, /*verbose=*/false)
{
process.initProc("../../Cards/param_card.dat");
}
Expand Down
38 changes: 19 additions & 19 deletions epochX/cudacpp/ee_mumu/SubProcesses/testxxx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ TEST( XTESTID_CPU( MG_EPOCH_PROCESS_ID ), testxxx )
// Fill in the input momenta
const int nMomenta = np4 * npar * nevt;
auto hstMomenta = hstMakeUnique<fptype_sv>( nMomenta ); // AOSOA[npagM][npar=4][np4=4][neppM]
const fptype par0[np4 * nevt]{ // AOS[nevt][np4]
500, 0, 0, 500, // #0 (m=0 pT=0 E=pz>0)
500, 0, 0, -500, // #1 (m=0 pT=0 -E=pz<0)
500, 300, 400, 0, // #2 (m=0 pT>0 pz=0)
500, 180, 240, 400, // #3 (m=0 pT>0 pz>0)
500, 180, 240, -400, // #4 (m=0 pT>0 pz<0)
500, 0, 0, 0, // #5 (m=50>0 pT=0 pz=0)
500, 0, 0, 300, // #6 (m=40>0 pT=0 pz>0)
500, 0, 0, -300, // #7 (m=40>0 pT=0 pz<0)
500, 180, 240, 0, // #8 (m=40>0 pT>0 pz=0)
500, -240, -180, 0, // #9 (m=40>0 pT>0 pz=0)
500, 180, 192, 144, // #10 (m=40>0 pT>0 pz>0)
500, 180, 192, -144, // #11 (m=40>0 pT>0 pz<0)
500, 0, 0, 500, // DUPLICATE #12 == #0 (m=0 pT=0 E=pz>0)
500, 0, 0, -500, // DUPLICATE #13 == #1 (m=0 pT=0 -E=pz<0)
500, 300, 400, 0, // DUPLICATE #14 == #2 (m=0 pT>0 pz=0)
500, 180, 240, 400 // DUPLICATE #15 == #3 (m=0 pT>0 pz>0)
};
const fptype par0[np4 * nevt] = // AOS[nevt][np4]
{ 500, 0, 0, 500, // #0 (m=0 pT=0 E=pz>0)
500, 0, 0, -500, // #1 (m=0 pT=0 -E=pz<0)
500, 300, 400, 0, // #2 (m=0 pT>0 pz=0)
500, 180, 240, 400, // #3 (m=0 pT>0 pz>0)
500, 180, 240, -400, // #4 (m=0 pT>0 pz<0)
500, 0, 0, 0, // #5 (m=50>0 pT=0 pz=0)
500, 0, 0, 300, // #6 (m=40>0 pT=0 pz>0)
500, 0, 0, -300, // #7 (m=40>0 pT=0 pz<0)
500, 180, 240, 0, // #8 (m=40>0 pT>0 pz=0)
500, -240, -180, 0, // #9 (m=40>0 pT>0 pz=0)
500, 180, 192, 144, // #10 (m=40>0 pT>0 pz>0)
500, 180, 192, -144, // #11 (m=40>0 pT>0 pz<0)
500, 0, 0, 500, // DUPLICATE #12 == #0 (m=0 pT=0 E=pz>0)
500, 0, 0, -500, // DUPLICATE #13 == #1 (m=0 pT=0 -E=pz<0)
500, 300, 400, 0, // DUPLICATE #14 == #2 (m=0 pT>0 pz=0)
500, 180, 240, 400 // DUPLICATE #15 == #3 (m=0 pT>0 pz>0)
};
fptype mass0[nevt]{};
bool ispzgt0[nevt]{};
bool ispzlt0[nevt]{};
Expand Down Expand Up @@ -155,7 +155,7 @@ TEST( XTESTID_CPU( MG_EPOCH_PROCESS_ID ), testxxx )
auto testwf6two = [&]( const cxtype_sv wf[6], const cxtype_sv expwf[6], const char* xxx, int ievt ) {
if ( testEvents )
{
const std::string xxxFull( xxx[0] == 'i' ? "ixxxxx" : "oxxxxx" );
const std::string xxxFull( xxx[0] == 'i' ? "ixxxxx" : "oxxxxx" );
//std::cout << "Testing " << std::setw(3) << itest << ": ";
//std::cout << xxx << " #" << ievt << " against " << xxxFull << std::endl;
////for ( int iw6 = 0; iw6<nw6; iw6++ ) std::cout << wf[iw6] << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion epochX/cudacpp/ee_mumu/src/Parameters_sm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,5 @@ void Parameters_sm::printDependentParameters()
void Parameters_sm::printDependentCouplings()
{
std::cout << "sm model couplings dependent on event kinematics:" << std::endl;

}
16 changes: 8 additions & 8 deletions epochX/cudacpp/ee_mumu/src/mgOnGpuConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,22 @@ using mgOnGpu::fptype;
// Cuda nsight compute (ncu) debug: add dummy lines to ease SASS program flow navigation
// Arguments (not used so far): text is __FUNCTION__, code is 0 (start) or 1 (end)
#if defined __CUDACC__ && defined MGONGPU_NSIGHT_DEBUG
#define mgDebugDeclare() \
#define mgDebugDeclare() \
__shared__ float mgDebugCounter[mgOnGpu::ntpbMAX];
#define mgDebugInitialise() \
#define mgDebugInitialise() \
{ mgDebugCounter[threadIdx.x]=0; }
#define mgDebug( code, text ) \
#define mgDebug( code, text ) \
{ mgDebugCounter[threadIdx.x] += 1; }
#define mgDebugFinalise() \
#define mgDebugFinalise() \
{ if ( blockIdx.x == 0 && threadIdx.x == 0 ) printf( "MGDEBUG: counter=%f\n", mgDebugCounter[threadIdx.x] ); }
#else
#define mgDebugDeclare() \
#define mgDebugDeclare() \
/*noop*/
#define mgDebugInitialise() \
#define mgDebugInitialise() \
{ /*noop*/ }
#define mgDebug( code, text ) \
#define mgDebug( code, text ) \
{ /*noop*/ }
#define mgDebugFinalise() \
#define mgDebugFinalise() \
{ /*noop*/ }
#endif

Expand Down
120 changes: 60 additions & 60 deletions epochX/cudacpp/ee_mumu/src/read_slha.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ void SLHABlock::set_entry(std::vector<int> indices, double value)
_indices = indices.size();
else if(indices.size() != _indices)
throw "Wrong number of indices in set_entry";

_entries[indices] = value;
}

double SLHABlock::get_entry(std::vector<int> indices, double def_val)
{
if (_entries.find(indices) == _entries.end()){
std::cout << "Warning: No such entry in " << _name << ", using default value "
<< def_val << std::endl;
std::cout << "Warning: No such entry in " << _name << ", using default value "
<< def_val << std::endl;
return def_val;
}
return _entries[indices];
Expand Down Expand Up @@ -70,56 +70,56 @@ void SLHAReader::read_slha_file(std::string file_name, bool verbose)
transform(line.begin(), line.end(), line.begin(), (int(*)(int)) tolower);
if(line != "" && line[0] != '#'){
if(block != ""){
// Look for double index blocks
double dindex1, dindex2;
double value;
std::stringstream linestr2(line);
if (linestr2 >> dindex1 >> dindex2 >> value &&
dindex1 == int(dindex1) and dindex2 == int(dindex2))
{
std::vector<int> indices;
indices.push_back(int(dindex1));
indices.push_back(int(dindex2));
set_block_entry(block, indices, value);
// Done with this line, read next
continue;
}
std::stringstream linestr1(line);
// Look for single index blocks
if(linestr1 >> dindex1 >> value && dindex1 == int(dindex1))
{
std::vector<int> indices;
indices.push_back(int(dindex1));
set_block_entry(block, indices, value);
// Done with this line, read next
continue;
}
// Look for double index blocks
double dindex1, dindex2;
double value;
std::stringstream linestr2(line);
if (linestr2 >> dindex1 >> dindex2 >> value &&
dindex1 == int(dindex1) and dindex2 == int(dindex2))
{
std::vector<int> indices;
indices.push_back(int(dindex1));
indices.push_back(int(dindex2));
set_block_entry(block, indices, value);
// Done with this line, read next
continue;
}
std::stringstream linestr1(line);
// Look for single index blocks
if(linestr1 >> dindex1 >> value && dindex1 == int(dindex1))
{
std::vector<int> indices;
indices.push_back(int(dindex1));
set_block_entry(block, indices, value);
// Done with this line, read next
continue;
}
}
// Look for block
if(line.find("block ") != line.npos){
line = line.substr(6);
// Get rid of spaces between block and block name
while (line[0] == ' ')
line = line.substr(1);
// Now find end of block name
int space_pos = line.find(' ');
if(space_pos != ((int) line.npos))
line = line.substr(0, space_pos);
block = line;
continue;
line = line.substr(6);
// Get rid of spaces between block and block name
while (line[0] == ' ')
line = line.substr(1);
// Now find end of block name
int space_pos = line.find(' ');
if(space_pos != ((int) line.npos))
line = line.substr(0, space_pos);
block = line;
continue;
}
// Look for decay
if(line.find("decay ") == 0){
line = line.substr(6);
block = "";
std::stringstream linestr(line);
int pdg_code;
double value;
if(linestr >> pdg_code >> value)
set_block_entry("decay", pdg_code, value);
else
std::cout << "Warning: Wrong format for decay block " << line << std::endl;
continue;
line = line.substr(6);
block = "";
std::stringstream linestr(line);
int pdg_code;
double value;
if(linestr >> pdg_code >> value)
set_block_entry("decay", pdg_code, value);
else
std::cout << "Warning: Wrong format for decay block " << line << std::endl;
continue;
}
}
}
Expand All @@ -130,42 +130,42 @@ void SLHAReader::read_slha_file(std::string file_name, bool verbose)
param_card.close();
}

double SLHAReader::get_block_entry(std::string block_name, std::vector<int> indices,
double def_val)
double SLHAReader::get_block_entry(std::string block_name, std::vector<int> indices,
double def_val)
{
if (_blocks.find(block_name) == _blocks.end()){
std::cout << "No such block " << block_name << ", using default value "
<< def_val << std::endl;
std::cout << "No such block " << block_name << ", using default value "
<< def_val << std::endl;
return def_val;
}
return _blocks[block_name].get_entry(indices);
return _blocks[block_name].get_entry(indices);
}

double SLHAReader::get_block_entry(std::string block_name, int index,
double def_val)
double SLHAReader::get_block_entry(std::string block_name, int index,
double def_val)
{
std::vector<int> indices;
indices.push_back(index);
return get_block_entry(block_name, indices, def_val);
}


void SLHAReader::set_block_entry(std::string block_name, std::vector<int> indices,
double value)
void SLHAReader::set_block_entry(std::string block_name, std::vector<int> indices,
double value)
{
if (_blocks.find(block_name) == _blocks.end()){
SLHABlock block(block_name);
_blocks[block_name] = block;
}
_blocks[block_name].set_entry(indices, value);
_blocks[block_name].set_entry(indices, value);
/* cout << "Set block " << block_name << " entry ";
for (int i=0;i < indices.size();i++)
for (int i=0;i < indices.size();i++)
cout << indices[i] << " ";
cout << "to " << _blocks[block_name].get_entry(indices) << endl;*/
}

void SLHAReader::set_block_entry(std::string block_name, int index,
double value)
void SLHAReader::set_block_entry(std::string block_name, int index,
double value)
{
std::vector<int> indices;
indices.push_back(index);
Expand Down
48 changes: 24 additions & 24 deletions epochX/cudacpp/ee_mumu/src/read_slha.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,39 @@

class SLHABlock
{
public:
SLHABlock(std::string name = ""){_name = name;}
~SLHABlock(){}
public:
SLHABlock(std::string name = ""){_name = name;}
~SLHABlock(){}

void set_entry(std::vector<int> indices, double value);
double get_entry(std::vector<int> indices, double def_val = 0);
void set_name(std::string name) {_name = name;}
std::string get_name(){return _name;}
int get_indices() { return _indices;}
void set_entry(std::vector<int> indices, double value);
double get_entry(std::vector<int> indices, double def_val = 0);
void set_name(std::string name) {_name = name;}
std::string get_name(){return _name;}
int get_indices() { return _indices;}

private:
std::string _name;
std::map<std::vector<int>, double> _entries;
unsigned int _indices;
private:
std::string _name;
std::map<std::vector<int>, double> _entries;
unsigned int _indices;
};

class SLHAReader
{
public:
public:
SLHAReader(std::string file_name = "", bool verbose=true)
{if(file_name != "") read_slha_file(file_name, verbose);}

void read_slha_file(std::string file_name, bool verbose);
double get_block_entry(std::string block_name, std::vector<int> indices,
double def_val = 0);
double get_block_entry(std::string block_name, int index,
double def_val = 0);
void set_block_entry(std::string block_name, std::vector<int> indices,
double value);
void set_block_entry(std::string block_name, int index,
double value);
private:
std::map<std::string, SLHABlock> _blocks;
void read_slha_file(std::string file_name, bool verbose);
double get_block_entry(std::string block_name, std::vector<int> indices,
double def_val = 0);
double get_block_entry(std::string block_name, int index,
double def_val = 0);
void set_block_entry(std::string block_name, std::vector<int> indices,
double value);
void set_block_entry(std::string block_name, int index,
double value);
private:
std::map<std::string, SLHABlock> _blocks;
};

#endif
Loading

0 comments on commit 5f4c2b9

Please sign in to comment.