Skip to content

Commit

Permalink
Command line arguments for dpotri, more cleanups. Enable profiling if…
Browse files Browse the repository at this point in the history
… the user has enabled it via MCA.
  • Loading branch information
therault committed Apr 4, 2022
1 parent bb85c67 commit 1d53756
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 21 deletions.
6 changes: 3 additions & 3 deletions examples/potrf/potrf.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
namespace potrf {

/* FLOP macros taken from DPLASMA */
#define FMULS_POTRF(__n) ((double)(__n) * (((1. / 6.) * (double)(__n) + 0.5) * (double)(__n) + (1. / 3.)))
#define FADDS_POTRF(__n) ((double)(__n) * (((1. / 6.) * (double)(__n) ) * (double)(__n) - (1. / 6.)))
#define FLOPS_DPOTRF(__n) ( FMULS_POTRF((__n)) + FADDS_POTRF((__n)) )
double FMULS_POTRF(double __n) { return (__n * (((1. / 6.) * __n + 0.5) * __n + (1. / 3.))); }
double FADDS_POTRF(double __n) { return (__n * (((1. / 6.) * __n ) * __n - (1. / 6.))); }
double FLOPS_DPOTRF(double __n) { return FMULS_POTRF(__n) + FADDS_POTRF(__n); }

template <typename T>
auto make_potrf(MatrixT<T>& A,
Expand Down
8 changes: 4 additions & 4 deletions examples/potrf/potri.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace potri {

/* FLOP macros taken from DPLASMA */
#define FMULS_POTRI(__n) ((double)(__n) * (((1. / 6.) * (double)(__n) + 0.5) * (double)(__n) + (1. / 3.)))
#define FADDS_POTRI(__n) ((double)(__n) * (((1. / 6.) * (double)(__n) ) * (double)(__n) - (1. / 6.)))
#define FLOPS_DPOTRI(__n) ( FMULS_POTRI((__n)) + FADDS_POTRI((__n)) )
/* FLOP macros taken from DPLASMA */
double FMULS_POTRI(double __n) { return ( __n * ((2. / 3.) + __n * ((1. / 3.) * __n + 1. )) ); }
double FADDS_POTRI(double __n) { return ( __n * ((1. / 6.) + __n * ((1. / 3.) * __n - 0.5)) ); }
double FLOPS_DPOTRI(double __n) { return FMULS_POTRI(__n) + FADDS_POTRI(__n); }

auto make_potri_ttg(MatrixT<double> &A, ttg::Edge<Key2, MatrixTile<double>>&input, ttg::Edge<Key2, MatrixTile<double>>&output ) {
ttg::Edge<Key2, MatrixTile<double>> trtri_to_lauum("trtri_to_lauum");
Expand Down
2 changes: 1 addition & 1 deletion examples/potrf/testing_dpotrf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int main(int argc, char **argv)
auto elapsed = (std::chrono::duration_cast<std::chrono::microseconds>(end - beg).count());
end = std::chrono::high_resolution_clock::now();
std::cout << "TTG Execution Time (milliseconds) : "
<< elapsed / 1E3 << " : Flops " << (FLOPS_DPOTRF(N)) << " " << (FLOPS_DPOTRF(N)/1e9)/(elapsed/1e6) << " GF/s" << std::endl;
<< elapsed / 1E3 << " : Flops " << (potrf::FLOPS_DPOTRF(N)) << " " << (potrf::FLOPS_DPOTRF(N)/1e9)/(elapsed/1e6) << " GF/s" << std::endl;
}

world.impl().stop_tracing_dag_of_tasks();
Expand Down
38 changes: 25 additions & 13 deletions examples/potrf/testing_dpotri.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@
#include <dplasma.h>
#endif

char* getCmdOption(char ** begin, char ** end, const std::string & option)
{
char ** itr = std::find(begin, end, option);
if (itr != end && ++itr != end)
{
return *itr;
}
return nullptr;
}

bool cmdOptionExists(char** begin, char** end, const std::string& option)
{
return std::find(begin, end, option) != end;
}

int main(int argc, char **argv)
{

Expand All @@ -30,25 +45,22 @@ int main(int argc, char **argv)
int check = 0;
int nthreads = -1;
const char* prof_filename = nullptr;
char *opt = nullptr;

if (argc > 1) {
N = M = atoi(argv[1]);
}

if (argc > 2) {
NB = atoi(argv[2]);
if( (opt = getCmdOption(argv+1, argv+argc, "-N")) != nullptr ) {
N = M = atoi(opt);
}

if (argc > 3) {
check = atoi(argv[3]);
if( (opt = getCmdOption(argv+1, argv+argc, "-t")) != nullptr ) {
NB = atoi(opt);
}

if (argc > 4) {
nthreads = atoi(argv[4]);
if( (opt = getCmdOption(argv+1, argv+argc, "-c")) != nullptr ) {
nthreads = atoi(opt);
}

if (argc > 5) {
prof_filename = argv[5];
if( (opt = getCmdOption(argv+1, argv+argc, "-dag")) != nullptr ) {
prof_filename = opt;
}

ttg::initialize(argc, argv, nthreads);
Expand Down Expand Up @@ -133,7 +145,7 @@ int main(int argc, char **argv)
auto elapsed = (std::chrono::duration_cast<std::chrono::microseconds>(end - beg).count());
end = std::chrono::high_resolution_clock::now();
std::cout << "TTG Execution Time (milliseconds) : "
<< elapsed / 1E3 << " : Flops " << (FLOPS_DPOTRF(N)) << " " << (FLOPS_DPOTRF(N)/1e9)/(elapsed/1e6) << " GF/s" << std::endl;
<< elapsed / 1E3 << " : Flops " << (potri::FLOPS_DPOTRI(N)) << " " << (potri::FLOPS_DPOTRI(N)/1e9)/(elapsed/1e6) << " GF/s" << std::endl;
}

world.impl().stop_tracing_dag_of_tasks();
Expand Down
7 changes: 7 additions & 0 deletions ttg/ttg/parsec/ttg.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ namespace ttg_parsec {
{
ttg::detail::register_world(*this);
ctx = parsec_init(ncores, argc, argv);

#if defined(PARSEC_PROF_TRACE)
if(parsec_profile_enabled) {
ttg::profile_on();
}
#endif

es = ctx->virtual_processes[0]->execution_streams[0];

parsec_ce.tag_register(_PARSEC_TTG_TAG, &detail::static_unpack_msg, this, PARSEC_TTG_MAX_AM_SIZE);
Expand Down

0 comments on commit 1d53756

Please sign in to comment.