Skip to content

Commit

Permalink
RNGTest Charm++ port now fully functional
Browse files Browse the repository at this point in the history
Details:

* Update .dox pages with new footer, date with vim's autodate plugin

* Add to TODO: windows builds.

* Overhaul Exception: Take off ExceptType. Only FATAL made sense as that is when
  we want stack unwinding. Warnings are simple printfs and since they frequently
  happen in destructors, they are C-style printfs, not couts. Not having to pass
  ExceptType also significantly simplifies the call-sites, which touches a bunch
  of files.

* Make sure Print objects (references) are passed on and not recreated (whenever
  make sense). As a result Driver now takes a Print object reference instead of
  instantiating its own. Also as a result, Init.h's Main, now also templated on
  the Printer  class so it can be parameterized by the most derived (or later,
  if no inheritance but composition is used, the correct) printer class.

* Class Print now holds two ostream references: a verbose and a quiet stream.
  The verbose is used by default for output, and only certain selected outputs
  write to the quiet stream. By default the verbose stream is boost's equivalent
  of /dev/null. All off Print's member functions are now parameterized by the Style
  which allows to choose between the verbose and quiet streams. The default
  stream is the verbose one (which by default goes to /dev/null), i.e., no news is
  good news. As all member functions are now templated, for full customizability,
  Print.C is gone. The stream is parameterized via a compile-time template argument
  that is a C-style enum, i.e., the decision which stream is written is done at
  compile-time and thus there are no run-time if-tests. As there is no virtual
  dispatch among Print, RNGPrint, and RNGTestPrint, there is no need to employ
  inheritance for code-reuse -- composition will most likely be better, which will
  be fixed in the next round.
  • Loading branch information
jbakosi committed Jul 9, 2014
1 parent 7d7a713 commit c504a51
Show file tree
Hide file tree
Showing 75 changed files with 527 additions and 648 deletions.
7 changes: 4 additions & 3 deletions doc/README.build.dox
Expand Up @@ -30,7 +30,8 @@ Building quinoa requires the following steps
</ol>

<hr>
\date Wed 25 Jun 2014 08:41:52 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:27:15 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
15 changes: 9 additions & 6 deletions doc/TODO.dox
Expand Up @@ -14,6 +14,7 @@ Parser/Control
- Put in error trap if depvars are the same for two SDEs given
- Using the defaults for an RNG in the rngs - end block should not require
an 'end', as that is not so user-friendly
- Hook up -v command line option for verbose output (default stays quiet)

RNGTest
-------
Expand Down Expand Up @@ -61,11 +62,12 @@ Build
- Consider safe mode STL for development: -D_GLIBCXX_DEBUG, see STL 6.12.1
- Add support for PGI (if C++11 is complete)
- Platforms:
+ pinto-intel: fix noexcepts
+ darwin-gnu
+ helios-gnu
+ titan-gnu
+ mac-clang
+ win-gnu: http://tdm-gcc.tdragon.net/download
+ win-mingw: http://sourceforge.net/projects/mingwbuilds

MeshConv
--------
Expand All @@ -85,6 +87,8 @@ Documentation
Uncategorized
-------------

- Use composition in Print instead of inheritance

- As the estimation of statistics should be closer (i.e., immediately after)
updating the particle properties, the order of the particle properties in
memory should be use-selectable at compile time
Expand All @@ -96,8 +100,6 @@ Uncategorized
exception-specification is one that that would be used by the
implicitly-declared destructor. In most cases, this is noexcept(true).

- Are cout warnings in destructors' catch blocks exception-safe?

- Use noexcept and conditional noexcept. See STL 3.1.7.

- Also add clocks info to timer. See STL 5.7.3.
Expand All @@ -112,7 +114,8 @@ Uncategorized
- Pass strings and other function argument types that need copies and do not need to be modified by value, see http://stackoverflow.com/questions/16724657/why-do-we-copy-then-move

<hr>
\date Wed 25 Jun 2014 08:42:42 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 10:26:13 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/algorithm.dox
Expand Up @@ -78,7 +78,8 @@ Options for runtime power measurement
executable fails to compile.

<hr>
\date Wed 25 Jun 2014 08:43:42 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:25:58 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/concurrency.dox
Expand Up @@ -204,7 +204,8 @@ one-to-one communication required by a geometric concurrency strategy:
communication cost renders the all-to-all strategy not worthwhile.

<hr>
\date Wed 25 Jun 2014 08:44:02 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:26:03 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/inhomogeneity.dox
Expand Up @@ -109,7 +109,8 @@ Disadvantages of a SPH-based strategy
tension instability

<hr>
\date Wed 25 Jun 2014 08:44:22 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:26:40 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/io.dox
Expand Up @@ -62,7 +62,8 @@ Input/Output requirements:
to write our own ParaView reader plugin(s).

<hr>
\date Wed 25 Jun 2014 08:44:40 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:26:28 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/layout.dox
Expand Up @@ -165,7 +165,8 @@ Policies of a MonteCarlo base class:
- Equation-major

<hr>
\date Wed 25 Jun 2014 08:45:12 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:25:32 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/layout_assembly.dox
Expand Up @@ -198,7 +198,8 @@ Excerpt from the Intel® 64 and IA-32 Architectures Software Developer Manual
> enabled.

<hr>
\date Wed 25 Jun 2014 08:44:51 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:26:51 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/layout_benchmark.dox
Expand Up @@ -200,7 +200,8 @@ at compile time. Access will be abstracted (and optimized) away.
For the implementation see the [layout policy](_layout_policy_8h_source.html).

<hr>
\date Wed 25 Jun 2014 08:45:00 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:27:01 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/rng.dox
Expand Up @@ -27,7 +27,8 @@ This certainly needs a little more explanation:
Nn = 1.6x10^4, Nctpn = 12, Nactpn = 3x61

<hr>
\date Wed 25 Jun 2014 08:45:22 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:26:19 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
11 changes: 6 additions & 5 deletions doc/design/rngtest.dox
Expand Up @@ -10,7 +10,7 @@ Requirements, features
Works with different libraries of RNGs: currently Intel's MKL's vector
statistical library (VSL) RNGs and RNGSSE's RNGs. References:
- MKL: https://software.intel.com/en-us/intel-mkl
- RNGSSE: http://dx.doi.org/10.1016/j.cpc.2011.03.022,
- RNGSSE: http://dx.doi.org/10.1016/j.cpc.2011.03.022 and
http://dx.doi.org/10.1016/j.cpc.2013.04.007

There are a large number of other RNG libraries available. An important
Expand Down Expand Up @@ -94,7 +94,7 @@ The RNGs, wrapped through the base 'RNG' and children 'MKLRNG' and 'RNGSSERNG',
are invoked via the polymorphic base. While the RNGs are instantiated via
RNGFactory (discussed above), to be able to call any of the instantiated RNGs at
the same time, we need as many base class pointers as the maximum number of RNGs
- currently 25. In principle, this requires 25 global-scope almost identical
-- currently 25. In principle, this requires 25 global-scope almost identical
wrappers so that we can pass them into TestU01. Note that the function signature
TestU01 accepts is the same for all RNGs. Templating the global-scope wrappers
on an integer, however, allows to write the wrapper only once and let the
Expand Down Expand Up @@ -150,7 +150,8 @@ containers exist, but some are not optimal and don't use the latest C++
standard.

<hr>
\date Wed 25 Jun 2014 08:45:39 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:27:08 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/design/sde.dox
Expand Up @@ -95,7 +95,8 @@ Requirements on SDE Dirichlet
define a spatially inhomogeneous Dirichlet SDE model.

<hr>
\date Wed 25 Jun 2014 08:45:48 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:25:40 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
7 changes: 4 additions & 3 deletions doc/mainpage.dox
Expand Up @@ -74,7 +74,8 @@ migration).
Acknowledgments ...

<hr>
\date Wed 25 Jun 2014 09:19:27 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:27:25 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
5 changes: 2 additions & 3 deletions doc/quinoa.css
Expand Up @@ -386,9 +386,8 @@ table.memberdecls {
}

.memtemplate {
font-size: 80%;
color: #4665A2;
font-weight: normal;
font-size: 100%;
font-weight: bold;
margin-left: 9px;
}

Expand Down
7 changes: 4 additions & 3 deletions doc/tpl.dox
Expand Up @@ -4,7 +4,8 @@
TPLs...

<hr>
\date Wed 25 Jun 2014 08:43:17 AM MDT
\author J. Bakosi
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
<div><small>
<em>Page last updated:</em> Tue 08 Jul 2014 03:25:21 PM MDT
<em>Copyright &copy; 2005-2012, Jozsef Bakosi, All rights reserved.</em>
</small></div>
*/
1 change: 0 additions & 1 deletion src/Base/CMakeLists.txt
Expand Up @@ -8,7 +8,6 @@ add_library(Base
Exception.C
Handler.C
Timer.C
Print.C
RNGPrint.C
QuinoaPrint.C
# Msg.C
Expand Down
82 changes: 18 additions & 64 deletions src/Base/Exception.C
Expand Up @@ -2,7 +2,7 @@
/*!
\file src/Base/Exception.C
\author J. Bakosi
\date Wed Mar 26 13:52:12 2014
\date Sat 05 Jul 2014 09:24:32 PM MDT
\copyright Copyright 2005-2012, Jozsef Bakosi, All rights reserved.
\brief Exception base class definition
\details Exception base class definition
Expand All @@ -20,26 +20,24 @@

using tk::Exception;

Exception::Exception(ExceptType except,
const std::string& message,
const std::string& file,
const std::string& function,
unsigned int line) noexcept
Exception::Exception( std::string&& message,
std::string&& file,
std::string&& function,
unsigned int line ) noexcept
//******************************************************************************
// Constructor: generate error message
//! \details No-throw guarantee: this member function never throws exceptions.
//! \author J. Bakosi
//******************************************************************************
try :
m_except(std::move(except)),
#ifdef NDEBUG
m_trace(false),
m_trace( false ),
#else
m_trace(true),
m_trace( true ),
#endif
m_file(std::move(file)),
m_func(std::move(function)),
m_line(std::move(line)),
m_file( std::move(file) ),
m_func( std::move(function) ),
m_line( std::move(line) ),
m_message(std::move(message)),
m_addrLength(0),
m_symbolList(nullptr)
Expand All @@ -61,13 +59,12 @@ try :
} // Catch std::exception
catch (exception& se) {
// Emit warning and continue
std::cout << "RUNTIME ERROR in Exception constructor: " << se.what()
<< std::endl;
printf( "RUNTIME ERROR in Exception constructor: %s\n", se.what() );
}
// Catch uncaught exceptions
catch (...) {
// Emit warning and continue
std::cout << "UNKNOWN EXCEPTION in Exception constructor" << std::endl;
printf( "UNKNOWN EXCEPTION in Exception constructor\n" );
}

Exception::~Exception() noexcept
Expand Down Expand Up @@ -182,15 +179,15 @@ Exception::echoTrace() noexcept
free(funcname);
}

void
Exception::echo(const char* msg) noexcept
tk::ErrCode
Exception::handleException() noexcept
//******************************************************************************
// Echo message
// Handle Exception: Print cumulative message
//! \details No-throw guarantee: this member function never throws exceptions.
//! \author J. Bakosi
//******************************************************************************
{
printf("\n>>> %s: %s\n", msg, what());
printf("\n>>> %s\n", what());

if (m_trace) {
printf(">>> CALL TRACE: (turn off: CMAKE_BUILD_TYPE=RELEASE) =============="
Expand All @@ -199,49 +196,6 @@ Exception::echo(const char* msg) noexcept
printf(">>> END OF CALL TRACE (turn off: CMAKE_BUILD_TYPE=RELEASE) ========"
"=============\n");
}
}

using tk::ErrCode;

ErrCode
Exception::handleException() noexcept
//******************************************************************************
// Handle Exception: Print cumulative message
//! \details No-throw guarantee: this member function never throws exceptions.
//! \author J. Bakosi
//******************************************************************************
{
if (m_except == ExceptType::WARNING) {

echo("WARNING");
return ErrCode::FAILURE;

} else if (m_except == ExceptType::CUMULATIVE) {

echo("CUMULATIVE ERROR");
return ErrCode::FAILURE;

} else if (m_except == ExceptType::ERROR) {

echo("ERROR");
return ErrCode::FAILURE;

} else if (m_except == ExceptType::FATAL) {

echo("FATAL ERROR");
return ErrCode::FAILURE;

} else if (m_except == ExceptType::RUNTIME) {

echo("RUNTIME ERROR");
return ErrCode::FAILURE;

} else if (m_except == ExceptType::UNCAUGHT) {

echo("UNKNOWN ERROR");
return ErrCode::FAILURE;

} else {
return ErrCode::FAILURE;
}

return tk::ErrCode::FAILURE;
}

0 comments on commit c504a51

Please sign in to comment.