Add static chrono

This commit is contained in:
Alejandro Gallo 2021-10-19 17:34:28 +02:00
parent fec33b3bb9
commit da714d3b7f
6 changed files with 25 additions and 5 deletions

View File

@ -407,7 +407,7 @@ static Slice& findOneByType(std::vector<Slice> &slices, Slice::Type type) {
}); });
WITH_CRAZY_DEBUG WITH_CRAZY_DEBUG
WITH_RANK WITH_RANK
<< "\t__ looking for " << type << "\n"; << "__slice__:find:looking for " << type << "\n";
if (sliceIt == slices.end()) if (sliceIt == slices.end())
throw std::domain_error("Slice by type not found!"); throw std::domain_error("Slice by type not found!");
return *sliceIt; return *sliceIt;
@ -1546,6 +1546,10 @@ struct NaiveDistribution : public TuplesDistribution {
, tuplesPerRank * (rank + 1) - 1 , tuplesPerRank * (rank + 1) - 1
}; };
WITH_RANK << "range = "
<< range.first << " -> " << range.second
<< std::endl;
std::vector<ABCTuple> result(range.second - range.first, FAKE_TUPLE); std::vector<ABCTuple> result(range.second - range.first, FAKE_TUPLE);
std::copy(all.begin() + range.first, std::copy(all.begin() + range.first,
range.second >= all.size() range.second >= all.size()
@ -2682,10 +2686,11 @@ namespace atrip {
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <map> #include <map>
#include <chrono>
#include <ctf.hpp> #include <ctf.hpp>
#include <atrip/Utils.hpp>
#define ADD_ATTRIBUTE(_type, _name, _default) \ #define ADD_ATTRIBUTE(_type, _name, _default) \
_type _name = _default; \ _type _name = _default; \
Input& with_ ## _name(_type i) { \ Input& with_ ## _name(_type i) { \
@ -2699,6 +2704,7 @@ namespace atrip {
static int rank; static int rank;
static int np; static int np;
static Timings chrono;
static void init(); static void init();
struct Input { struct Input {
@ -2758,6 +2764,7 @@ using namespace atrip;
int Atrip::rank; int Atrip::rank;
int Atrip::np; int Atrip::np;
Timings Atrip::chrono;
void Atrip::init() { void Atrip::init() {
MPI_Comm_rank(MPI_COMM_WORLD, &Atrip::rank); MPI_Comm_rank(MPI_COMM_WORLD, &Atrip::rank);

View File

@ -1,6 +1,11 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvla"
#pragma GCC diagnostic ignored "-Wint-in-bool-context"
#include <ctf.hpp>
#pragma GCC diagnostic pop
#include <iostream> #include <iostream>
#include <atrip.hpp> #include <atrip.hpp>
#include <ctf.hpp>
#include <bench/CLI11.hpp> #include <bench/CLI11.hpp>
#define _print_size(what, size) \ #define _print_size(what, size) \
@ -22,6 +27,7 @@ int main(int argc, char** argv) {
CLI::App app{"Main bench for atrip"}; CLI::App app{"Main bench for atrip"};
app.add_option("--no", no, "Occupied orbitals"); app.add_option("--no", no, "Occupied orbitals");
app.add_option("--nv", nv, "Virtual orbitals"); app.add_option("--nv", nv, "Virtual orbitals");
app.add_option("--mod", itMod, "Iteration modifier");
app.add_flag("--nochrono", nochrono, "Do not print chrono"); app.add_flag("--nochrono", nochrono, "Do not print chrono");
app.add_flag("--barrier", barrier, "Use the first barrier"); app.add_flag("--barrier", barrier, "Use the first barrier");
app.add_option("--dist", tuplesDistributionString, "Which distribution"); app.add_option("--dist", tuplesDistributionString, "Which distribution");

View File

@ -3,10 +3,11 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <map> #include <map>
#include <chrono>
#include <ctf.hpp> #include <ctf.hpp>
#include <atrip/Utils.hpp>
#define ADD_ATTRIBUTE(_type, _name, _default) \ #define ADD_ATTRIBUTE(_type, _name, _default) \
_type _name = _default; \ _type _name = _default; \
Input& with_ ## _name(_type i) { \ Input& with_ ## _name(_type i) { \
@ -20,6 +21,7 @@ namespace atrip {
static int rank; static int rank;
static int np; static int np;
static Timings chrono;
static void init(); static void init();
struct Input { struct Input {

View File

@ -229,7 +229,7 @@ static Slice& findOneByType(std::vector<Slice> &slices, Slice::Type type) {
}); });
WITH_CRAZY_DEBUG WITH_CRAZY_DEBUG
WITH_RANK WITH_RANK
<< "\t__ looking for " << type << "\n"; << "__slice__:find:looking for " << type << "\n";
if (sliceIt == slices.end()) if (sliceIt == slices.end())
throw std::domain_error("Slice by type not found!"); throw std::domain_error("Slice by type not found!");
return *sliceIt; return *sliceIt;

View File

@ -110,6 +110,10 @@ struct NaiveDistribution : public TuplesDistribution {
, tuplesPerRank * (rank + 1) - 1 , tuplesPerRank * (rank + 1) - 1
}; };
WITH_RANK << "range = "
<< range.first << " -> " << range.second
<< std::endl;
std::vector<ABCTuple> result(range.second - range.first, FAKE_TUPLE); std::vector<ABCTuple> result(range.second - range.first, FAKE_TUPLE);
std::copy(all.begin() + range.first, std::copy(all.begin() + range.first,
range.second >= all.size() range.second >= all.size()

View File

@ -11,6 +11,7 @@ using namespace atrip;
int Atrip::rank; int Atrip::rank;
int Atrip::np; int Atrip::np;
Timings Atrip::chrono;
void Atrip::init() { void Atrip::init() {
MPI_Comm_rank(MPI_COMM_WORLD, &Atrip::rank); MPI_Comm_rank(MPI_COMM_WORLD, &Atrip::rank);