Skip to content
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

Adding a small header to the benchmark utility #1097

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/cltools/Benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ int Benchmark::main(FILE* in, FILE*out,Communicator& pc) {
log.link(log_dev_null.get());
}
log.setLinePrefix("BENCH: ");

log <<"Welcome to PLUMED benchmark\n";
std::vector<Kernel> kernels;

// perform comparative analysis
Expand Down Expand Up @@ -589,13 +589,15 @@ int Benchmark::main(FILE* in, FILE*out,Communicator& pc) {
{
std::string paths;
parse("--kernel",paths);
log <<"Using --kernel=" << paths << "\n";
allpaths=Tools::getWords(paths,":");
}

std::vector<std::string> allplumed;
{
std::string paths;
parse("--plumed",paths);
log <<"Using --plumed=" << paths << "\n";
allplumed=Tools::getWords(paths,":");
}

Expand Down Expand Up @@ -628,27 +630,36 @@ int Benchmark::main(FILE* in, FILE*out,Communicator& pc) {
// read other flags:
bool shuffled=false;
parseFlag("--shuffled",shuffled);
if (shuffled)
log << "Using --shuffled\n";
int nf; parse("--nsteps",nf);
log << "Using --nsteps=" << nf << "\n";
unsigned natoms; parse("--natoms",natoms);

log << "Using --natoms=" << natoms << "\n";
double maxtime; parse("--maxtime",maxtime);
log << "Using --maxtime=" << maxtime << "\n";

bool domain_decomposition=false;
parseFlag("--domain-decomposition",domain_decomposition);
if (domain_decomposition)
log << "Using --domain-decomposition\n";

if(pc.Get_size()>1) domain_decomposition=true;
if(domain_decomposition) shuffled=true;

double timeToSleep;
parse("--sleep",timeToSleep);
log << "Using --sleep=" << timeToSleep << "\n";

std::vector<int> shuffled_indexes;

{
std::string atomicDistr;
parse("--atom-distribution",atomicDistr);
distribution = getAtomDistribution(atomicDistr);
log << "Using --atom-distribution=" << atomicDistr << "\n";
}

log <<"Initializing the setup of the kernel(s)\n";
const auto initial_time=std::chrono::high_resolution_clock::now();

for(auto & k : kernels) {
Expand Down Expand Up @@ -690,7 +701,6 @@ int Benchmark::main(FILE* in, FILE*out,Communicator& pc) {
// trap signals:
SignalHandlerGuard sigIntGuard(SIGINT, signalHandler);


for(int step=0; nf<0 || step<nf; ++step) {
std::shuffle(kernels_ptr.begin(),kernels_ptr.end(),rng);
distribution->positions(pos,step,atomicGenerator);
Expand Down