Tangle sources
This commit is contained in:
parent
32d66dc3f1
commit
d226cdc43e
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Include%20header][Include header:1]]
|
||||
// [[file:../atrip.org::*Include header][Include header:1]]
|
||||
#pragma once
|
||||
|
||||
#include <atrip/Atrip.hpp>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Atrip][Atrip:1]]
|
||||
// [[file:../../atrip.org::*Header][Header:1]]
|
||||
#pragma once
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@ -53,6 +53,7 @@ namespace atrip {
|
||||
ADD_ATTRIBUTE(bool, barrier, false)
|
||||
ADD_ATTRIBUTE(int, maxIterations, 0)
|
||||
ADD_ATTRIBUTE(int, iterationMod, -1)
|
||||
ADD_ATTRIBUTE(int, percentageMod, -1)
|
||||
ADD_ATTRIBUTE(TuplesDistribution, tuplesDistribution, NAIVE)
|
||||
|
||||
|
||||
@ -67,4 +68,4 @@ namespace atrip {
|
||||
}
|
||||
|
||||
#undef ADD_ATTRIBUTE
|
||||
// Atrip:1 ends here
|
||||
// Header:1 ends here
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Blas][Blas:1]]
|
||||
// [[file:../../atrip.org::*Blas][Blas:1]]
|
||||
#pragma once
|
||||
namespace atrip {
|
||||
extern "C" {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
// [[file:~/atrip/atrip.org::*Debug][Debug:1]]
|
||||
// [[file:../../atrip.org::*Macros][Macros:1]]
|
||||
#pragma once
|
||||
#include <functional>
|
||||
#define ATRIP_BENCHMARK
|
||||
//#define ATRIP_DONT_SLICE
|
||||
//#define ATRIP_WORKLOAD_DUMP
|
||||
@ -10,10 +11,6 @@
|
||||
#define ATRIP_DEBUG 1
|
||||
#endif
|
||||
|
||||
#ifndef LOG
|
||||
#define LOG(level, name) if (Atrip::rank == 0) std::cout << name << ": "
|
||||
#endif
|
||||
|
||||
#if ATRIP_DEBUG == 4
|
||||
# pragma message("WARNING: You have OCD debugging ABC triples " \
|
||||
"expect GB of output and consult your therapist")
|
||||
@ -60,4 +57,34 @@
|
||||
# define WITH_CRAZY_DEBUG if (false)
|
||||
# define DBG(...)
|
||||
#endif
|
||||
// Debug:1 ends here
|
||||
// Macros:1 ends here
|
||||
|
||||
// [[file:../../atrip.org::*Macros][Macros:2]]
|
||||
#ifndef LOG
|
||||
#define LOG(level, name) if (Atrip::rank == 0) std::cout << name << ": "
|
||||
#endif
|
||||
// Macros:2 ends here
|
||||
|
||||
// [[file:../../atrip.org::*Macros][Macros:3]]
|
||||
#ifdef ATRIP_NO_OUTPUT
|
||||
# undef LOG
|
||||
# define LOG(level, name) if (false) std::cout << name << ": "
|
||||
#endif
|
||||
// Macros:3 ends here
|
||||
|
||||
// [[file:../../atrip.org::IterationDescriptor][IterationDescriptor]]
|
||||
namespace atrip {
|
||||
|
||||
struct IterationDescription;
|
||||
using IterationDescriptor = std::function<void(IterationDescription const&)>;
|
||||
struct IterationDescription {
|
||||
static IterationDescriptor descriptor;
|
||||
size_t currentIteration;
|
||||
size_t totalIterations;
|
||||
double currentElapsedTime;
|
||||
};
|
||||
|
||||
void registerIterationDescriptor(IterationDescriptor);
|
||||
|
||||
}
|
||||
// IterationDescriptor ends here
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Equations][Equations:1]]
|
||||
// [[file:../../atrip.org::*Equations][Equations:1]]
|
||||
#pragma once
|
||||
|
||||
#include<atrip/Slice.hpp>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*The%20rank%20mapping][The rank mapping:1]]
|
||||
// [[file:../../atrip.org::*The rank mapping][The rank mapping:1]]
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Prolog][Prolog:1]]
|
||||
// [[file:../../atrip.org::*Prolog][Prolog:1]]
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
@ -16,11 +16,11 @@ struct Slice {
|
||||
using F = double;
|
||||
// Prolog:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Location][Location:1]]
|
||||
// [[file:../../atrip.org::*Location][Location:1]]
|
||||
struct Location { size_t rank; size_t source; };
|
||||
// Location:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Type][Type:1]]
|
||||
// [[file:../../atrip.org::*Type][Type:1]]
|
||||
enum Type
|
||||
{ A = 10
|
||||
, B
|
||||
@ -38,7 +38,7 @@ enum Type
|
||||
};
|
||||
// Type:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*State][State:1]]
|
||||
// [[file:../../atrip.org::*State][State:1]]
|
||||
enum State {
|
||||
Fetch = 0,
|
||||
Dispatched = 2,
|
||||
@ -49,7 +49,7 @@ enum State {
|
||||
};
|
||||
// State:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*The%20Info%20structure][The Info structure:1]]
|
||||
// [[file:../../atrip.org::*The Info structure][The Info structure:1]]
|
||||
struct Info {
|
||||
// which part of a,b,c the slice holds
|
||||
PartialTuple tuple;
|
||||
@ -73,7 +73,7 @@ struct Info {
|
||||
using Ty_x_Tu = std::pair< Type, PartialTuple >;
|
||||
// The Info structure:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Name][Name:1]]
|
||||
// [[file:../../atrip.org::*Name][Name:1]]
|
||||
enum Name
|
||||
{ TA = 100
|
||||
, VIJKA = 101
|
||||
@ -83,19 +83,19 @@ enum Name
|
||||
};
|
||||
// Name:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Database][Database:1]]
|
||||
// [[file:../../atrip.org::*Database][Database:1]]
|
||||
struct LocalDatabaseElement {
|
||||
Slice::Name name;
|
||||
Slice::Info info;
|
||||
};
|
||||
// Database:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Database][Database:2]]
|
||||
// [[file:../../atrip.org::*Database][Database:2]]
|
||||
using LocalDatabase = std::vector<LocalDatabaseElement>;
|
||||
using Database = LocalDatabase;
|
||||
// Database:2 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*MPI%20Types][MPI Types:1]]
|
||||
// [[file:../../atrip.org::*MPI Types][MPI Types:1]]
|
||||
struct mpi {
|
||||
|
||||
static MPI_Datatype vector(size_t n, MPI_Datatype const& DT) {
|
||||
@ -185,7 +185,7 @@ struct mpi {
|
||||
};
|
||||
// MPI Types:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Static%20utilities][Static utilities:1]]
|
||||
// [[file:../../atrip.org::*Static utilities][Static utilities:1]]
|
||||
static
|
||||
PartialTuple subtupleBySlice(ABCTuple abc, Type sliceType) {
|
||||
switch (sliceType) {
|
||||
@ -203,7 +203,7 @@ PartialTuple subtupleBySlice(ABCTuple abc, Type sliceType) {
|
||||
}
|
||||
// Static utilities:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Static%20utilities][Static utilities:2]]
|
||||
// [[file:../../atrip.org::*Static utilities][Static utilities:2]]
|
||||
static std::vector<Slice*> hasRecycledReferencingToIt
|
||||
( std::vector<Slice> &slices
|
||||
, Info const& info
|
||||
@ -220,7 +220,7 @@ static std::vector<Slice*> hasRecycledReferencingToIt
|
||||
}
|
||||
// Static utilities:2 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Static%20utilities][Static utilities:3]]
|
||||
// [[file:../../atrip.org::*Static utilities][Static utilities:3]]
|
||||
static Slice& findOneByType(std::vector<Slice> &slices, Slice::Type type) {
|
||||
const auto sliceIt
|
||||
= std::find_if(slices.begin(), slices.end(),
|
||||
@ -236,7 +236,7 @@ static Slice& findOneByType(std::vector<Slice> &slices, Slice::Type type) {
|
||||
}
|
||||
// Static utilities:3 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Static%20utilities][Static utilities:4]]
|
||||
// [[file:../../atrip.org::*Static utilities][Static utilities:4]]
|
||||
static Slice&
|
||||
findRecycledSource (std::vector<Slice> &slices, Slice::Info info) {
|
||||
const auto sliceIt
|
||||
@ -262,7 +262,7 @@ findRecycledSource (std::vector<Slice> &slices, Slice::Info info) {
|
||||
}
|
||||
// Static utilities:4 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Static%20utilities][Static utilities:5]]
|
||||
// [[file:../../atrip.org::*Static utilities][Static utilities:5]]
|
||||
static Slice& findByTypeAbc
|
||||
( std::vector<Slice> &slices
|
||||
, Slice::Type type
|
||||
@ -292,7 +292,7 @@ static Slice& findByTypeAbc
|
||||
}
|
||||
// Static utilities:5 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Static%20utilities][Static utilities:6]]
|
||||
// [[file:../../atrip.org::*Static utilities][Static utilities:6]]
|
||||
static Slice& findByInfo(std::vector<Slice> &slices,
|
||||
Slice::Info const& info) {
|
||||
const auto sliceIt
|
||||
@ -315,30 +315,30 @@ static Slice& findByInfo(std::vector<Slice> &slices,
|
||||
}
|
||||
// Static utilities:6 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Attributes][Attributes:1]]
|
||||
// [[file:../../atrip.org::*Attributes][Attributes:1]]
|
||||
Info info;
|
||||
// Attributes:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Attributes][Attributes:2]]
|
||||
// [[file:../../atrip.org::*Attributes][Attributes:2]]
|
||||
F *data;
|
||||
// Attributes:2 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Attributes][Attributes:3]]
|
||||
// [[file:../../atrip.org::*Attributes][Attributes:3]]
|
||||
MPI_Request request;
|
||||
// Attributes:3 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Attributes][Attributes:4]]
|
||||
// [[file:../../atrip.org::*Attributes][Attributes:4]]
|
||||
const size_t size;
|
||||
// Attributes:4 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Member%20functions][Member functions:1]]
|
||||
// [[file:../../atrip.org::*Member functions][Member functions:1]]
|
||||
void markReady() noexcept {
|
||||
info.state = Ready;
|
||||
info.recycling = Blank;
|
||||
}
|
||||
// Member functions:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Member%20functions][Member functions:2]]
|
||||
// [[file:../../atrip.org::*Member functions][Member functions:2]]
|
||||
bool isUnwrapped() const noexcept {
|
||||
return info.state == Ready
|
||||
|| info.state == SelfSufficient
|
||||
@ -346,7 +346,7 @@ bool isUnwrapped() const noexcept {
|
||||
}
|
||||
// Member functions:2 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Member%20functions][Member functions:3]]
|
||||
// [[file:../../atrip.org::*Member functions][Member functions:3]]
|
||||
bool isUnwrappable() const noexcept {
|
||||
return isUnwrapped()
|
||||
|| info.state == Recycled
|
||||
@ -379,7 +379,7 @@ inline bool isFree() const noexcept {
|
||||
}
|
||||
// Member functions:3 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Member%20functions][Member functions:4]]
|
||||
// [[file:../../atrip.org::*Member functions][Member functions:4]]
|
||||
inline bool isRecyclable() const noexcept {
|
||||
return ( info.state == Dispatched
|
||||
|| info.state == Ready
|
||||
@ -390,7 +390,7 @@ inline bool isRecyclable() const noexcept {
|
||||
}
|
||||
// Member functions:4 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Member%20functions][Member functions:5]]
|
||||
// [[file:../../atrip.org::*Member functions][Member functions:5]]
|
||||
inline bool hasValidDataPointer() const noexcept {
|
||||
return data != nullptr
|
||||
&& info.state != Acceptor
|
||||
@ -399,7 +399,7 @@ inline bool hasValidDataPointer() const noexcept {
|
||||
}
|
||||
// Member functions:5 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Member%20functions][Member functions:6]]
|
||||
// [[file:../../atrip.org::*Member functions][Member functions:6]]
|
||||
void unwrapAndMarkReady() {
|
||||
if (info.state == Ready) return;
|
||||
if (info.state != Dispatched)
|
||||
@ -431,7 +431,7 @@ void unwrapAndMarkReady() {
|
||||
}
|
||||
// Member functions:6 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Epilog][Epilog:1]]
|
||||
// [[file:../../atrip.org::*Epilog][Epilog:1]]
|
||||
Slice(size_t size_)
|
||||
: info({})
|
||||
, data(nullptr)
|
||||
@ -442,7 +442,7 @@ Slice(size_t size_)
|
||||
}; // struct Slice
|
||||
// Epilog:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Debug][Debug:1]]
|
||||
// [[file:../../atrip.org::*Debug][Debug:1]]
|
||||
std::ostream& operator<<(std::ostream& out, Slice::Location const& v) {
|
||||
// TODO: remove me
|
||||
out << "{.r(" << v.rank << "), .s(" << v.source << ")};";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*The%20slice%20union][The slice union:1]]
|
||||
// [[file:../../atrip.org::*The slice union][The slice union:1]]
|
||||
#pragma once
|
||||
#include <atrip/Debug.hpp>
|
||||
#include <atrip/Slice.hpp>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Prolog][Prolog:1]]
|
||||
// [[file:../../atrip.org::*Prolog][Prolog:1]]
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
@ -21,7 +21,7 @@
|
||||
namespace atrip {
|
||||
// Prolog:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Tuples%20types][Tuples types:1]]
|
||||
// [[file:../../atrip.org::*Tuples types][Tuples types:1]]
|
||||
using ABCTuple = std::array<size_t, 3>;
|
||||
using PartialTuple = std::array<size_t, 2>;
|
||||
using ABCTuples = std::vector<ABCTuple>;
|
||||
@ -30,14 +30,14 @@ constexpr ABCTuple FAKE_TUPLE = {0, 0, 0};
|
||||
constexpr ABCTuple INVALID_TUPLE = {1, 1, 1};
|
||||
// Tuples types:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Distributing%20the%20tuples][Distributing the tuples:1]]
|
||||
// [[file:../../atrip.org::*Distributing the tuples][Distributing the tuples:1]]
|
||||
struct TuplesDistribution {
|
||||
virtual ABCTuples getTuples(size_t Nv, MPI_Comm universe) = 0;
|
||||
virtual bool tupleIsFake(ABCTuple const& t) { return t == FAKE_TUPLE; }
|
||||
};
|
||||
// Distributing the tuples:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Node%20information][Node information:1]]
|
||||
// [[file:../../atrip.org::*Node information][Node information:1]]
|
||||
std::vector<std::string> getNodeNames(MPI_Comm comm){
|
||||
int rank, np;
|
||||
MPI_Comm_rank(comm, &rank);
|
||||
@ -77,7 +77,7 @@ std::vector<std::string> getNodeNames(MPI_Comm comm){
|
||||
}
|
||||
// Node information:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Node%20information][Node information:2]]
|
||||
// [[file:../../atrip.org::*Node information][Node information:2]]
|
||||
struct RankInfo {
|
||||
const std::string name;
|
||||
const size_t nodeId;
|
||||
@ -139,7 +139,7 @@ getClusterInfo(MPI_Comm comm) {
|
||||
}
|
||||
// Node information:2 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Naive%20list][Naive list:1]]
|
||||
// [[file:../../atrip.org::*Naive list][Naive list:1]]
|
||||
ABCTuples getTuplesList(size_t Nv, size_t rank, size_t np) {
|
||||
|
||||
const size_t
|
||||
@ -173,7 +173,7 @@ ABCTuples getTuplesList(size_t Nv, size_t rank, size_t np) {
|
||||
}
|
||||
// Naive list:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Naive%20list][Naive list:2]]
|
||||
// [[file:../../atrip.org::*Naive list][Naive list:2]]
|
||||
ABCTuples getAllTuplesList(const size_t Nv) {
|
||||
const size_t n = Nv * (Nv + 1) * (Nv + 2) / 6 - Nv;
|
||||
ABCTuples result(n);
|
||||
@ -189,7 +189,7 @@ ABCTuples getAllTuplesList(const size_t Nv) {
|
||||
}
|
||||
// Naive list:2 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Naive%20list][Naive list:3]]
|
||||
// [[file:../../atrip.org::*Naive list][Naive list:3]]
|
||||
struct NaiveDistribution : public TuplesDistribution {
|
||||
ABCTuples getTuples(size_t Nv, MPI_Comm universe) override {
|
||||
int rank, np;
|
||||
@ -200,11 +200,11 @@ struct NaiveDistribution : public TuplesDistribution {
|
||||
};
|
||||
// Naive list:3 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Prolog][Prolog:1]]
|
||||
// [[file:../../atrip.org::*Prolog][Prolog:1]]
|
||||
namespace group_and_sort {
|
||||
// Prolog:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Utils][Utils:1]]
|
||||
// [[file:../../atrip.org::*Utils][Utils:1]]
|
||||
// Provides the node on which the slice-element is found
|
||||
// Right now we distribute the slices in a round robin fashion
|
||||
// over the different nodes (NOTE: not mpi ranks but nodes)
|
||||
@ -229,7 +229,7 @@ struct Info {
|
||||
};
|
||||
// Utils:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Distribution][Distribution:1]]
|
||||
// [[file:../../atrip.org::*Distribution][Distribution:1]]
|
||||
ABCTuples specialDistribution(Info const& info, ABCTuples const& allTuples) {
|
||||
|
||||
ABCTuples nodeTuples;
|
||||
@ -410,7 +410,7 @@ ABCTuples specialDistribution(Info const& info, ABCTuples const& allTuples) {
|
||||
}
|
||||
// Distribution:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Main][Main:1]]
|
||||
// [[file:../../atrip.org::*Main][Main:1]]
|
||||
std::vector<ABCTuple> main(MPI_Comm universe, size_t Nv) {
|
||||
|
||||
int rank, np;
|
||||
@ -450,7 +450,7 @@ std::vector<ABCTuple> main(MPI_Comm universe, size_t Nv) {
|
||||
MPI_Comm_split(universe, color, key, &INTRA_COMM);
|
||||
// Main:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Main][Main:2]]
|
||||
// [[file:../../atrip.org::*Main][Main:2]]
|
||||
size_t const
|
||||
tuplesPerRankLocal
|
||||
= nodeTuples.size() / nodeInfos[rank].ranksPerNode
|
||||
@ -478,7 +478,7 @@ LOG(1,"Atrip") << "ranks per node " << nodeInfos[rank].ranksPerNode << "\n";
|
||||
LOG(1,"Atrip") << "#nodes " << nNodes << "\n";
|
||||
// Main:2 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Main][Main:3]]
|
||||
// [[file:../../atrip.org::*Main][Main:3]]
|
||||
size_t const totalTuples
|
||||
= tuplesPerRankGlobal * nodeInfos[rank].ranksPerNode;
|
||||
|
||||
@ -490,7 +490,7 @@ if (computeDistribution) {
|
||||
}
|
||||
// Main:3 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Main][Main:4]]
|
||||
// [[file:../../atrip.org::*Main][Main:4]]
|
||||
{
|
||||
// construct mpi type for abctuple
|
||||
MPI_Datatype MPI_ABCTUPLE;
|
||||
@ -514,13 +514,13 @@ if (computeDistribution) {
|
||||
}
|
||||
// Main:4 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Main][Main:5]]
|
||||
// [[file:../../atrip.org::*Main][Main:5]]
|
||||
return result;
|
||||
|
||||
}
|
||||
// Main:5 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Interface][Interface:1]]
|
||||
// [[file:../../atrip.org::*Interface][Interface:1]]
|
||||
struct Distribution : public TuplesDistribution {
|
||||
ABCTuples getTuples(size_t Nv, MPI_Comm universe) override {
|
||||
return main(universe, Nv);
|
||||
@ -528,10 +528,10 @@ struct Distribution : public TuplesDistribution {
|
||||
};
|
||||
// Interface:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Epilog][Epilog:1]]
|
||||
// [[file:../../atrip.org::*Epilog][Epilog:1]]
|
||||
} // namespace group_and_sort
|
||||
// Epilog:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Epilog][Epilog:1]]
|
||||
// [[file:../../atrip.org::*Epilog][Epilog:1]]
|
||||
}
|
||||
// Epilog:1 ends here
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Unions][Unions:1]]
|
||||
// [[file:../../atrip.org::*Unions][Unions:1]]
|
||||
#pragma once
|
||||
#include <atrip/SliceUnion.hpp>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Prolog][Prolog:1]]
|
||||
// [[file:../../atrip.org::*Prolog][Prolog:1]]
|
||||
#pragma once
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@ -11,7 +11,7 @@
|
||||
namespace atrip {
|
||||
// Prolog:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Pretty%20printing][Pretty printing:1]]
|
||||
// [[file:../../atrip.org::*Pretty printing][Pretty printing:1]]
|
||||
template <typename T>
|
||||
std::string pretty_print(T&& value) {
|
||||
std::stringstream stream;
|
||||
@ -22,7 +22,7 @@ template <typename T>
|
||||
}
|
||||
// Pretty printing:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Chrono][Chrono:1]]
|
||||
// [[file:../../atrip.org::*Chrono][Chrono:1]]
|
||||
#define WITH_CHRONO(__chrono_name, ...) \
|
||||
Atrip::chrono[__chrono_name].start(); \
|
||||
__VA_ARGS__ \
|
||||
@ -41,6 +41,6 @@ struct Timer {
|
||||
using Timings = std::map<std::string, Timer>;
|
||||
// Chrono:1 ends here
|
||||
|
||||
// [[file:~/atrip/atrip.org::*Epilog][Epilog:1]]
|
||||
// [[file:../../atrip.org::*Epilog][Epilog:1]]
|
||||
}
|
||||
// Epilog:1 ends here
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:~/atrip/atrip.org::*Main][Main:1]]
|
||||
// [[file:../../atrip.org::*Main][Main:1]]
|
||||
#include <iomanip>
|
||||
|
||||
#include <atrip/Atrip.hpp>
|
||||
@ -16,6 +16,12 @@ Timings Atrip::chrono;
|
||||
size_t Atrip::networkSend;
|
||||
size_t Atrip::localSend;
|
||||
|
||||
// user printing block
|
||||
IterationDescriptor IterationDescription::descriptor;
|
||||
void atrip::registerIterationDescriptor(IterationDescriptor d) {
|
||||
IterationDescription::descriptor = d;
|
||||
}
|
||||
|
||||
void Atrip::init() {
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &Atrip::rank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &Atrip::np);
|
||||
@ -111,7 +117,7 @@ Atrip::Output Atrip::run(Atrip::Input const& in) {
|
||||
WITH_CHRONO("tuples:build",
|
||||
auto const tuplesList = distribution->getTuples(Nv, universe);
|
||||
)
|
||||
size_t nIterations = tuplesList.size();
|
||||
const size_t nIterations = tuplesList.size();
|
||||
{
|
||||
const size_t _all_tuples = Nv * (Nv + 1) * (Nv + 2) / 6 - Nv;
|
||||
LOG(0,"Atrip") << "#iterations: "
|
||||
@ -121,6 +127,15 @@ Atrip::Output Atrip::run(Atrip::Input const& in) {
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
const size_t
|
||||
iterationMod = (in.percentageMod > 0)
|
||||
? nIterations * in.percentageMod / 100
|
||||
: in.iterationMod
|
||||
|
||||
, iteration1Percent = nIterations * 0.01
|
||||
;
|
||||
|
||||
|
||||
|
||||
auto const isFakeTuple
|
||||
= [&tuplesList, distribution](size_t const i) {
|
||||
@ -282,7 +297,15 @@ Atrip::Output Atrip::run(Atrip::Input const& in) {
|
||||
if (in.barrier) MPI_Barrier(universe);
|
||||
))
|
||||
|
||||
if (iteration % in.iterationMod == 0) {
|
||||
if (iteration % iterationMod == 0 || iteration == iteration1Percent) {
|
||||
|
||||
if (IterationDescription::descriptor) {
|
||||
IterationDescription::descriptor({
|
||||
iteration,
|
||||
nIterations,
|
||||
Atrip::chrono["iterations"].count()
|
||||
});
|
||||
}
|
||||
|
||||
size_t networkSend;
|
||||
MPI_Reduce(&Atrip::networkSend,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user