When to use avtDatabase::OnlyServeUpMetaData() vs. ifdef MDSERVER…endif

Revision as of 20:07, 4 June 2014 by BradWhitlock (talk | contribs) (More information)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Sometimes, source code that is shared between the engine and mdserver nonetheless needs to be handled differently on each component.

For example, in the Silo database plugin, the mdserver need know only about the existence of adpative meshes, not the details of how individual patches in an AMR hierarchy interrelate to each other. However, the engine does need to know these details.

To affect this, database plugin Makefiles are designed to compile database plugins separately for mdserver and engine. When the files are compiled for the mdserver, the additional compile-time flag -DMDSERVER is passed. When the file is compiled for the engine, the additional compile-time flag -DENGINE is passed.

This allows a database plugin to be designed with code-blocks that are specific for either the mdserver or the engine. In turn, this allows greater control over dependencies needed to link the mdserver or engine executables.

However, not all source files in VisIt are intended to be compiled separately for mdserver and engine. In fact, that tends to be true of only database, plot and operator plugin source files. So, elsewhere in VisIt, attempting to use conditionally compiled code blocks to handle code that is specific to the mdserver or engine will not work. In this case, there is a run-time check provided by avtDatabase::OnlyServeUpMetaData(). This method returns true for code that is executing on the mdserver and false otherwise.

So, the guidance on when to use either of these approaches is

  • For plugins, use the #ifdef MDSERVER…#endif conditionally compiled code block approach.
    • This will ensure the mdserver does no work that is specific to the engine and will minimize link-time dependencies in mdserver
  • Elsewhere, use avtDatabase::OnlyServeUpMetaData(). This is a run-time check to avoid doing engine specific work on mdserver.

At the time this was written, it appears there are several cases where database plugins use, probably incorrectly, avtDatabase::OnlyServeUpMetaData() and should, instead, be modified to all consistently use #ifdef MDSERVER approach.

More information

The avtDatabase::OnlyServeUpMetaData() function predates the *MDSERVER* conditional compilation flag. The MDSERVER conditional compilation flag can be used to reduce the size of libM database plugins relative to their libE counterparts.

Some of the database plugins for the mdserver used to limit the libraries to which they were linked in an effort to reduce load time. For example, certain mdserver programs used to not link with AVT libraries since those were also linked to modules such as vtkIO. This is no longer really the case, at least since the CMake build system was introduced and VTK was modularized. Current mdserver plugins will link to the full list of libraries on which they depend. The benefit of using MDSERVER conditional compilation remains simply to reduce the size of the libM binaries since those binaries never need working GetMesh, GetVar methods.

Question: Why not simply eliminate libM plugins at this point and make the mdserver load the libE_ser plugins?

  • That would eliminate about 120 shared libraries that VisIt currently has to build
  • Presumably, the OS would let the engine and mdserver share the libE_ser dynamic libraries so the overall memory footprint could go down