47 #ifdef HAVE_TEUCHOS_MPI 49 #endif // HAVE_TEUCHOS_MPI 69 void allocationLoggerHook () {
78 std::ostringstream os;
79 os << prefix_ <<
"Teuchos allocation tracking: " 80 <<
"Maximum allocation (B): " 81 << AllocationLogger::maxAllocInBytes ()
82 <<
", Current allocation (B): " 83 << AllocationLogger::curAllocInBytes () << endl;
89 #ifdef HAVE_TEUCHOS_MPI 90 int main (
int argc,
char* argv[])
93 #endif // HAVE_TEUCHOS_MPI 95 typedef std::vector<float, Teuchos::Details::Allocator<float> > float_vec_type;
96 typedef std::vector<long, Teuchos::Details::Allocator<long> > long_vec_type;
98 #ifdef HAVE_TEUCHOS_MPI 99 (void) MPI_Init (&argc, &argv);
101 (void) MPI_Comm_rank (MPI_COMM_WORLD, &myRank);
106 iPrint_ = (myRank == 0);
109 #endif // HAVE_TEUCHOS_MPI 110 prefix_ = std::string (
"Proc 0: ");
121 (void) atexit (allocationLoggerHook);
123 const float_vec_type::size_type numEntries = 10;
124 float_vec_type x_f (numEntries, 42.0);
125 long_vec_type x_l (numEntries);
126 std::copy (x_f.begin (), x_f.end (), x_l.begin ());
128 #ifdef HAVE_TEUCHOS_MPI 129 (void) MPI_Finalize ();
130 #endif // HAVE_TEUCHOS_MPI
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
Logging implementation used by Allocator (see below).
Declaration of Teuchos::Details::Allocator, a tracking and logging implementation of the C++ Standard...