Skip to content

Commit c54edbf

Browse files
committed
mpqc::Debugger -> ttg::Debugger
1 parent bf6028e commit c54edbf

7 files changed

Lines changed: 45 additions & 51 deletions

File tree

examples/floyd-warshall/floyd_warshall_df.cc

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ class Initiator : public TT<int,
103103
public:
104104
Initiator(Matrix<T>* adjacency_matrix_ttg, const std::string& name)
105105
: baseT(name, {}, {"outA", "outB", "outC", "outD"}), adjacency_matrix_ttg(adjacency_matrix_ttg) {
106-
/* Initiator should run on all ranks */
107-
auto rank = ttg::default_execution_context().rank();
108-
this->set_keymap([=](int i){ return rank; });
109-
}
106+
/* Initiator should run on all ranks */
107+
auto rank = ttg::default_execution_context().rank();
108+
this->set_keymap([=](int i) { return rank; });
109+
}
110110
Initiator(Matrix<T>* adjacency_matrix_ttg, const typename baseT::output_edges_type& outedges, const std::string& name)
111111
: baseT(edges(), outedges, name, {}, {"outA", "outB", "outC", "outD"})
112112
, adjacency_matrix_ttg(adjacency_matrix_ttg) {
113-
/* Initiator should run on all ranks */
114-
auto rank = ttg::default_execution_context().rank();
115-
this->set_keymap([=](int i){ return rank; });
116-
}
113+
/* Initiator should run on all ranks */
114+
auto rank = ttg::default_execution_context().rank();
115+
this->set_keymap([=](int i) { return rank; });
116+
}
117117

118118
~Initiator() {}
119119

@@ -122,8 +122,7 @@ class Initiator : public TT<int,
122122
// This triggers for the immediate execution of function A at tile [0, 0]. But
123123
// functions B, C, and D have other dependencies to meet before execution; They wait
124124
std::for_each(adjacency_matrix_ttg->get().begin(), adjacency_matrix_ttg->get().end(),
125-
[&out](const std::pair<std::pair<int, int>, BlockMatrix<T>>& kv)
126-
{
125+
[&out](const std::pair<std::pair<int, int>, BlockMatrix<T>>& kv) {
127126
auto [i, j] = kv.first;
128127
if (i == 0 && j == 0) { // A function call
129128
::send<0>(Key(std::make_pair(std::make_pair(i, j), 0)), kv.second, out);
@@ -288,8 +287,8 @@ class FuncA : public TT<Key,
288287
}
289288

290289
// making x_ready for the computation on the SAME block in the NEXT iteration
291-
if (K < (blocking_factor - 1)) { // if there is a NEXT iteration
292-
std::get<0>(bcast_keys)[0] = {I, J, K+1};
290+
if (K < (blocking_factor - 1)) { // if there is a NEXT iteration
291+
std::get<0>(bcast_keys)[0] = {I, J, K + 1};
293292
if (I == K + 1 && J == K + 1) { // in the next iteration, we have A function call
294293
// cout << "Send " << I << " " << J << " " << K << endl;
295294
//::send<0>(Key(std::make_pair(std::make_pair(I, J), K + 1)), m_ij, out);
@@ -378,8 +377,8 @@ class FuncB : public TT<Key,
378377
}
379378

380379
// making x_ready for the computation on the SAME block in the NEXT iteration
381-
if (K < (blocking_factor - 1)) { // if there is a NEXT iteration
382-
std::get<0>(bcast_keys)[0] = {I, J, K+1};
380+
if (K < (blocking_factor - 1)) { // if there is a NEXT iteration
381+
std::get<0>(bcast_keys)[0] = {I, J, K + 1};
383382
if (I == K + 1 && J == K + 1) { // in the next iteration, we have A function call
384383
// cout << "Send " << I << " " << J << " " << K << endl;
385384
//::send<0>(Key(std::make_pair(std::make_pair(I, J), K + 1)), m_ij, out);
@@ -467,8 +466,8 @@ class FuncC : public TT<Key,
467466
}
468467

469468
// making x_ready for the computation on the SAME block in the NEXT iteration
470-
if (K < (blocking_factor - 1)) { // if there is a NEXT iteration
471-
std::get<0>(bcast_keys)[0] = {I, J, K+1};
469+
if (K < (blocking_factor - 1)) { // if there is a NEXT iteration
470+
std::get<0>(bcast_keys)[0] = {I, J, K + 1};
472471
if (I == K + 1 && J == K + 1) { // in the next iteration, we have A function call
473472
// cout << "Send " << I << " " << J << " " << K << endl;
474473
//::send<0>(Key(std::make_pair(std::make_pair(I, J), K + 1)), m_ij, out);
@@ -580,10 +579,10 @@ class FloydWarshall {
580579
int blocking_factor;
581580

582581
public:
583-
template<typename Keymap>
582+
template <typename Keymap>
584583
FloydWarshall(Matrix<T>* adjacency_matrix_ttg, Matrix<T>* result_matrix_ttg, int problem_size, int blocking_factor,
585-
const std::string& kernel_type, int recursive_fan_out, int base_size, T* adjacency_matrix_serial, Keymap&& keymap,
586-
bool verify_results = false)
584+
const std::string& kernel_type, int recursive_fan_out, int base_size, T* adjacency_matrix_serial,
585+
Keymap&& keymap, bool verify_results = false)
587586
: initiator(adjacency_matrix_ttg, "initiator")
588587
, funcA(adjacency_matrix_ttg, problem_size, blocking_factor, kernel_type, recursive_fan_out, base_size, "funcA")
589588
, funcB(adjacency_matrix_ttg, problem_size, blocking_factor, kernel_type, recursive_fan_out, base_size, "funcB")
@@ -677,7 +676,7 @@ int main(int argc, char** argv) {
677676

678677
ttg::World world = ttg::default_execution_context();
679678

680-
using mpqc::Debugger;
679+
using ttg::Debugger;
681680
auto debugger = std::make_shared<Debugger>();
682681
Debugger::set_default_debugger(debugger);
683682
debugger->set_exec(argv[0]);
@@ -721,15 +720,15 @@ int main(int argc, char** argv) {
721720
int n_bcols = n_brows;
722721

723722
int rank = world.rank();
724-
int P = std::sqrt(world.size());
725-
int Q = world.size() / P;
726-
auto keymap = [=](const Key &key) {
723+
int P = std::sqrt(world.size());
724+
int Q = world.size() / P;
725+
auto keymap = [=](const Key& key) {
727726
int I = key.execution_info.first.first;
728727
int J = key.execution_info.first.second;
729-
return ((I%P) + (J%Q)*P);
728+
return ((I % P) + (J % Q) * P);
730729
};
731730

732-
auto predicate = [=](int i, int j){ return keymap(Key{i, j, 0}) == rank; };
731+
auto predicate = [=](int i, int j) { return keymap(Key{i, j, 0}) == rank; };
733732

734733
Matrix<double>* m = new Matrix<double>(n_brows, n_bcols, block_size, block_size, predicate);
735734
Matrix<double>* r = new Matrix<double>(n_brows, n_bcols, block_size, block_size, predicate);
@@ -738,13 +737,12 @@ int main(int argc, char** argv) {
738737
adjacency_matrix_serial = (double*)malloc(sizeof(double) * problem_size * problem_size);
739738
}
740739

741-
//double start = madness::wall_time();
740+
// double start = madness::wall_time();
742741
m->fill();
743-
if (verify_results)
744-
init_square_matrix(problem_size, blocking_factor, adjacency_matrix_serial);
745-
//std::cout << "Init took: " << madness::wall_time() - start << std::endl;
746-
// Run in every process to be able to verify? Is there another way?
747-
// Calling the iterative fw-apsp
742+
if (verify_results) init_square_matrix(problem_size, blocking_factor, adjacency_matrix_serial);
743+
// std::cout << "Init took: " << madness::wall_time() - start << std::endl;
744+
// Run in every process to be able to verify? Is there another way?
745+
// Calling the iterative fw-apsp
748746
if (verify_results) {
749747
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
750748
floyd_iterative(adjacency_matrix_serial, problem_size);
@@ -830,11 +828,11 @@ void init_square_matrix(int problem_size, int blocking_factor, double* adjacency
830828
for (int nc = 0; nc < n_brows; nc++) {
831829
for (int i = 0; i < block_size; ++i) {
832830
int row = (i + nr * block_size) * problem_size;
833-
//int blockX = i / block_size;
834-
//int x = i % block_size;
831+
// int blockX = i / block_size;
832+
// int x = i % block_size;
835833
for (int j = 0; j < block_size; ++j) {
836-
//int blockY = j / block_size;
837-
//int y = j % block_size;
834+
// int blockY = j / block_size;
835+
// int y = j % block_size;
838836
/*if (i != j) {
839837
double value = i * blocking_factor + j; // rand() % 100 + 1;
840838
((*m)(blockX, blockY))(x, y, value);

examples/spmm/spmm.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ int main(int argc, char **argv) {
12771277
auto debug = (unsigned int)parseOption(debugStr, 0);
12781278

12791279
if (debug & (1 << 1)) {
1280-
using mpqc::Debugger;
1280+
using ttg::Debugger;
12811281
auto debugger = std::make_shared<Debugger>();
12821282
Debugger::set_default_debugger(debugger);
12831283
debugger->set_exec(argv[0]);

examples/test/test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class BroadcastTest {
438438
int try_main(int argc, char **argv) {
439439
ttg::initialize(argc, argv, 2);
440440

441-
// using mpqc::Debugger;
441+
// using ttg::Debugger;
442442
// auto debugger = std::make_shared<Debugger>();
443443
// Debugger::set_default_debugger(debugger);
444444
// debugger->set_exec(argv[0]);

ttg/ttg/run.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace ttg {
3030
inline void initialize(int argc, char** argv, int num_threads, RestOfArgs&&... args) {
3131
// if requested by user, create a Debugger object
3232
if (auto debugger_cstr = std::getenv("TTG_DEBUGGER")) {
33-
using mpqc::Debugger;
33+
using ttg::Debugger;
3434
auto debugger = std::make_shared<Debugger>();
3535
Debugger::set_default_debugger(debugger);
3636
debugger->set_exec(argv[0]);
@@ -41,8 +41,8 @@ namespace ttg {
4141
TTG_IMPL_NS::ttg_initialize(argc, argv, num_threads, std::forward<RestOfArgs>(args)...);
4242

4343
// finish setting up the Debugger, if needed
44-
if (mpqc::Debugger::default_debugger())
45-
mpqc::Debugger::default_debugger()->set_prefix(ttg::default_execution_context().rank());
44+
if (ttg::Debugger::default_debugger())
45+
ttg::Debugger::default_debugger()->set_prefix(ttg::default_execution_context().rank());
4646
}
4747

4848
/// Finalizes the TTG runtime
@@ -91,7 +91,7 @@ namespace ttg {
9191
/// @param tt a template task to invoke
9292
/// @note \c invoke_once may be called by all processes and must at least be
9393
/// called by the process returned by \c tt.keymap()
94-
template<typename TT>
94+
template <typename TT>
9595
inline void invoke_once(TT& tt) {
9696
if (tt.keymap() == tt.get_world().rank()) {
9797
tt.invoke();
@@ -104,7 +104,7 @@ namespace ttg {
104104
/// @param key the to invoke the \c tt on
105105
/// @note \c invoke_once may be called by all processes and must at least be
106106
/// called by the process returned by \c tt.keymap(key)
107-
template<typename TT, typename Key>
107+
template <typename TT, typename Key>
108108
inline void invoke_once(TT&& tt, Key&& key) {
109109
if (tt.keymap(key) == tt.get_world().rank()) {
110110
tt.invoke(std::forward<Key>(key));

ttg/ttg/util/backtrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace mpqc {
3838
* @code
3939
* void make_omelet(int num_eggs) {
4040
* if (num_eggs < 1) {
41-
* mpqc::detail::Backtrace bt("breakfast fail:");
41+
* ttg::detail::Backtrace bt("breakfast fail:");
4242
* throw std::runtime_error(bt.str());
4343
* }
4444
* stove.on();

ttg/ttg/util/bug.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#endif
4545

4646
using namespace std;
47-
using namespace mpqc;
47+
using namespace ttg;
4848

4949
//////////////////////////////////////////////////////////////////////
5050
// static variables
@@ -251,8 +251,7 @@ void Debugger::debug(const char *reason) {
251251
;
252252
}
253253
}
254-
}
255-
else { // empty command = wait for the user to attach manually
254+
} else { // empty command = wait for the user to attach manually
256255
std::cout << prefix_ << ": waiting for the user to attach a debugger to process " << getpid() << " ... " << endl;
257256
debugger_ready_ = 0;
258257
while (!debugger_ready_)
@@ -346,7 +345,7 @@ void Debugger::__traceback(const std::string &prefix, const char *reason) {
346345

347346
namespace ttg {
348347
void launch_debugger(int rank, const char *exec_name, const char *cmd) {
349-
using mpqc::Debugger;
348+
using ttg::Debugger;
350349
auto debugger = std::make_shared<Debugger>();
351350
Debugger::set_default_debugger(debugger);
352351
debugger->set_exec(exec_name);

ttg/ttg/util/bug.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,6 @@ namespace ttg {
243243
};
244244

245245
} // namespace detail
246-
} // namespace ttg
247-
248-
namespace mpqc {
249246

250247
/**
251248
* The Debugger class describes what should be done when a catastrophic
@@ -349,7 +346,7 @@ namespace mpqc {
349346
void resolve_cmd_alias();
350347
};
351348

352-
} // namespace mpqc
349+
} // namespace ttg
353350

354351
namespace ttg {
355352
void launch_debugger(int rank, const char *exec_name, const char *cmd);

0 commit comments

Comments
 (0)