Skip to content

Commit 636e7f8

Browse files
authored
Merge pull request #57 from rfhaque/master
Add fom variables to adiak
2 parents e6bb418 + a4c03b9 commit 636e7f8

3 files changed

Lines changed: 36 additions & 16 deletions

File tree

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ MFEM_DIR2 := $(realpath $(MFEM_DIR))
6969
ifdef CALIPER_DIR
7070
CALIPER_DIR = $(spack location --install-dir caliper)
7171
ADIAK_DIR = $(spack location --install-dir adiak)
72-
CALIPER_FLAGS = -I${CALIPER_DIR}/include -DUSE_CALIPER
72+
CALIPER_FLAGS = -I${CALIPER_DIR}/include -DREMHOS_USE_CALIPER
7373
ADIAK_INCLUDE = -I${ADIAK_DIR}/include
7474
ADIAK_LDFLAGS = -L${ADIAK_DIR}/lib -ladiak
7575
CALIPER_LDFLAGS = -L${CALIPER_DIR}/lib64 -lcaliper

remhos.cpp

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454
#include <umpire/strategy/QuickPool.hpp>
5555
#endif
5656

57-
#ifdef USE_CALIPER
57+
#ifdef REMHOS_USE_CALIPER
5858
#include <caliper/cali.h>
5959
#include <caliper/cali-manager.h>
60-
//#include <adiak.hpp>
60+
#include <adiak.hpp>
6161
#ifdef HAVE_MPI
6262
#include <caliper/cali-mpi.h>
6363
#endif
@@ -351,16 +351,18 @@ MFEM_EXPORT int remhos(int argc, char *argv[], double &final_mass_u)
351351
#endif // REMHOS_USE_DEVICE_UMPIRE
352352

353353
//setup caliper config manager
354-
#ifdef USE_CALIPER
354+
#ifdef REMHOS_USE_CALIPER
355355
setupCaliper();
356356

357357
cali::ConfigManager calimgr;
358358
if (calimgr.error())
359359
std::cerr << "caliper config error: " << calimgr.error_msg() << std::endl;
360360
calimgr.start();
361-
//adiak::init(nullptr);
362-
//adiak::cmdline();
363-
//adiak::hostname();
361+
362+
MPI_Comm adiak_mpi_comm = MPI_COMM_WORLD;
363+
void* adiak_mpi_comm_ptr = &adiak_mpi_comm;
364+
adiak::init(adiak_mpi_comm_ptr);
365+
adiak::collect_all();
364366
#endif
365367

366368
// Enable hardware devices such as GPUs, and programming models such as
@@ -547,12 +549,12 @@ MFEM_EXPORT int remhos(int argc, char *argv[], double &final_mass_u)
547549
v.ProjectCoefficient(vcoeff);
548550

549551
double t = 0.0;
550-
#ifdef USE_CALIPER
552+
#ifdef REMHOS_USE_CALIPER
551553
CALI_CXX_MARK_LOOP_BEGIN(mainloop, "rem.mainloop");
552554
#endif
553555
while (t < t_final)
554556
{
555-
#ifdef USE_CALIPER
557+
#ifdef REMHOS_USE_CALIPER
556558
CALI_CXX_MARK_LOOP_ITERATION(mainloop, t);
557559
#endif
558560
t += dt;
@@ -561,7 +563,7 @@ MFEM_EXPORT int remhos(int argc, char *argv[], double &final_mass_u)
561563
// Update the node velocities.
562564
v.ProjectCoefficient(vcoeff);
563565
}
564-
#ifdef USE_CALIPER
566+
#ifdef REMHOS_USE_CALIPER
565567
CALI_CXX_MARK_LOOP_END(mainloop);
566568
#endif
567569

@@ -1313,6 +1315,11 @@ MFEM_EXPORT int remhos(int argc, char *argv[], double &final_mass_u)
13131315
}
13141316
}
13151317

1318+
#ifdef REMHOS_USE_CALIPER
1319+
adiak::value("steps", ti_total);
1320+
adiak::value("repeated_steps", ti_total-ti);
1321+
#endif
1322+
13161323
int steps = ti_total;
13171324
switch (ode_solver_type)
13181325
{
@@ -1479,7 +1486,8 @@ MFEM_EXPORT int remhos(int argc, char *argv[], double &final_mass_u)
14791486
delete lom.SubFes1;
14801487
delete lom.VolumeTerms;
14811488
}
1482-
#ifdef USE_CALIPER
1489+
#ifdef REMHOS_USE_CALIPER
1490+
adiak::fini();
14831491
calimgr.flush();
14841492
#endif
14851493
return 0;
@@ -1913,6 +1921,18 @@ void AdvectionOperator::PrintTimingData(int steps) const
19131921
<< "FOM FCT: " << 1e-6 * dofs_steps / T[3] << std::endl
19141922
<< "FOM: " << 1e-6 * dofs_steps / T[4] << std::endl;
19151923
std::cout << "(megadofs x time steps / second)\n---" << std::endl;
1924+
#ifdef REMHOS_USE_CALIPER
1925+
adiak::value("rhs", T[0]);
1926+
adiak::value("l2inv", T[1]);
1927+
adiak::value("lo", T[2]);
1928+
adiak::value("fct", T[3]);
1929+
adiak::value("total_time", T[4]);
1930+
adiak::value("fom_rhs", 1e-6 * dofs_steps / T[0]);
1931+
adiak::value("fom_inv", 1e-6 * dofs_steps / T[1]);
1932+
adiak::value("fom_lo", 1e-6 * dofs_steps / T[2]);
1933+
adiak::value("fom_fct", 1e-6 * dofs_steps / T[3]);
1934+
adiak::value("fom", 1e-6 * dofs_steps / T[4]);
1935+
#endif
19161936
}
19171937
}
19181938

@@ -2333,7 +2353,7 @@ double inflow_function(const Vector &x)
23332353

23342354
void setupCaliper()
23352355
{
2336-
#ifdef USE_CALIPER
2356+
#ifdef REMHOS_USE_CALIPER
23372357
#ifdef HAVE_MPI
23382358
cali_mpi_init();
23392359
#endif

remhos_lo.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ class MassBasedAvg : public LOSolver
9393
// Temporary HO solution, used only in the next call to CalcLOSolution().
9494
mutable const Vector *du_HO = nullptr;
9595

96-
void MassesAndVolumesAtPosition(const ParGridFunction &u,
97-
const GridFunction &x,
98-
Vector &el_mass, Vector &el_vol) const;
99-
10096
public:
10197
MassBasedAvg(ParFiniteElementSpace &space, HOSolver &hos,
10298
const GridFunction *mesh_vel)
@@ -105,6 +101,10 @@ class MassBasedAvg : public LOSolver
105101
// Temporary HO solution, used only in the next call to CalcLOSolution().
106102
void SetHOSolution(Vector &du) { du_HO = &du; }
107103

104+
void MassesAndVolumesAtPosition(const ParGridFunction &u,
105+
const GridFunction &x,
106+
Vector &el_mass, Vector &el_vol) const;
107+
108108
virtual void CalcLOSolution(const Vector &u, Vector &du) const;
109109
};
110110

0 commit comments

Comments
 (0)