15 #ifdef HAVE_TEUCHOS_MPI
17 #endif // HAVE_TEUCHOS_MPI
37 void allocationLoggerHook () {
46 std::ostringstream os;
47 os << prefix_ <<
"Teuchos allocation tracking: "
48 <<
"Maximum allocation (B): "
49 << AllocationLogger::maxAllocInBytes ()
50 <<
", Current allocation (B): "
51 << AllocationLogger::curAllocInBytes () << endl;
57 #ifdef HAVE_TEUCHOS_MPI
58 int main (
int argc,
char* argv[])
61 #endif // HAVE_TEUCHOS_MPI
63 typedef std::vector<float, Teuchos::Details::Allocator<float> > float_vec_type;
64 typedef std::vector<long, Teuchos::Details::Allocator<long> > long_vec_type;
66 #ifdef HAVE_TEUCHOS_MPI
67 (void) MPI_Init (&argc, &argv);
69 (void) MPI_Comm_rank (MPI_COMM_WORLD, &myRank);
74 iPrint_ = (myRank == 0);
77 #endif // HAVE_TEUCHOS_MPI
78 prefix_ = std::string (
"Proc 0: ");
89 (void) atexit (allocationLoggerHook);
91 const float_vec_type::size_type numEntries = 10;
92 float_vec_type x_f (numEntries, 42.0);
93 long_vec_type x_l (numEntries);
94 std::copy (x_f.begin (), x_f.end (), x_l.begin ());
96 #ifdef HAVE_TEUCHOS_MPI
97 (void) MPI_Finalize ();
98 #endif // HAVE_TEUCHOS_MPI
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
Logging implementation used by Allocator (see below).
int main(int argc, char *argv[])
Declaration of Teuchos::Details::Allocator, a tracking and logging implementation of the C++ Standard...