Wrapper binary - Redmine #685
ls -1 $GMXBIN/g_* | wc -l
->142 (for single and double)
Already at this point it gets a little unmanageable to remember the names of all binaries. I think, it would be nice to have something like a global gmx binary, which has the program trunc as the first option (e.g. “gmx dist”, “gmx rdf”).
One could start with something like what git does. Install one binary in /usr/bin, which calls the others from /usr/libexec/. And for those user, who prefer the old way of calling the apps, one can create symlinks, (e.g. g_rdf ->gmx, like busybox does).
This is just an idea for gromacs 5.0 or later.
(from redmine: issue id 685, created on 2011-01-26 by junghans, closed on 2014-02-24)
- Relations:
- relates #219 (closed)
- relates #666 (closed)
- relates #672 (closed)
- relates #1410 (closed)
- Changesets:
- Revision ab300758 by Teemu Murtola on 2012-05-07T10:16:23Z:
Generic handling for multiple cmd-line modules.
Added generic methods for multiple independent modules within a single
command-line tool, and modified g_ana to use this.
By itself, does not change the external behavior significantly, but
makes it easier to implement parts of #666 and #672.
The wrapper binary in #685 should also be easy to implement using this
approach.
Change-Id: I3058bf5db2cbb7c7a1f9e4c87dd2db8f9727fe82
- Revision 1f1c7b66 by Teemu Murtola on 2012-11-10T20:16:42Z:
Option to create symlinks to g_ana.
Added an install rule that generates symlinks to g_ana using old
tool names. These symlinks directly run an individual module contained
in g_ana. These can make it easier to migrate users' old scripts.
For now, only added a link to g_select as a proof-of-concept. The list
can be easily extended, and depends on how we want to solve #685.
Related to #685.
Change-Id: I9ceda9aca98f28c3c905cbfd3f3d174b629016b1
- Revision ece6ea8b by Teemu Murtola on 2012-12-10T16:28:33Z:
Wrapper module to add old binaries into g_ana.
Implement a module class that allows including old binaries (basically,
anything that has a main()-like function and accepts a '-h' command-line
argument) into g_ana. As a proof-of-concept, move one tool (g_dist)
into g_ana. Will move most of the rest in a separate commit.
To try to keep old functionality working, symbolic links are now created
also into the build tree using the old binary names. Also added that on
Windows, copies of the g_ana binary are created instead of symbolic
links. Required some changes in the CreateLinks.cmake script.
Only man page generation should break with this change as the old
gmx_add_man_page() logic does not work as there is no target with the
correct name to which add the post-build rule.
Several TODO comments are left, but they can be resolved later.
Related to #685.
Change-Id: I7c826ab0604b2f3d9372f9962e0b0e30d655bcd6
- Revision 4c18882f by Teemu Murtola on 2012-12-10T18:27:34Z:
Replace most tools with symlinks to g_ana.
Improves link times and reduces the installation footprint with static
libraries significantly. Also removes a lot of dummy files. Should not
affect functionality.
To make 'g_ana help' more useful in this case, some grouping etc. for
the modules needs to be implemented, but is not done in this commit.
After this, programs.txt should also be auto-generated from g_ana
(this is simpler if/when remaining binaries also get included).
Part of #685.
Change-Id: Ifcd166dbd00fecc3b9a48d748926a7cbeebe76b9
- Revision 264847f5 by Teemu Murtola on 2012-12-10T19:03:17Z:
Rename g_ana to gmx.
Since all the modules contained in this wrapper binary are no longer
analysis tools, a more general name is needed.
Part of #685.
Change-Id: Iec0a0ee10daa283510127ce4c1db7b5290d50f58
- Revision bebc698f by Teemu Murtola on 2013-06-27T17:57:40Z:
More binaries into the wrapper binary.
Move most remaining binaries to be built into the 'gmx' wrapper binary.
Now, only mdrun and g_pme_error (which have a different initialization
sequence), and ngmx (and other X11 programs) remain outside.
Renamed a few headers to match the name of their implementation file.
Part of #685.
Change-Id: I3fb7e3de905c01d7564d809893390bbb9b8f8368
- Revision e45b119f by Teemu Murtola on 2013-07-30T04:10:42Z:
Handle wrapper binary options also for symlinks.
Now the -quiet, -version, and -copyright options also work when the
binary is invoked through a symlink (so, e.g., g_angle -quiet suppresses
the startup headers). They also work for the user tools, implemented
using the single-module wrapper.
Extended the command-line parser to support parsing only recognized
options and removing those from the command line while leaving the rest
untouched.
Related to #685 and #1209.
Change-Id: I740f70386d89694246c3e25ba0a1c1c4df17dc6b
- Revision fc034c1d by Teemu Murtola on 2013-08-24T17:50:15Z:
[RFC] Really uniform startup path for all binaries.
Main changes:
- Move MPI_Init() call from init_par() to a separate initialization
method that is now called from the beginning of the wrapper binary.
Similarly, make it the wrapper binary's responsibility to call
MPI_Finalize(). Also make this behave uniformly for the wrappers that
implement main().
- Call MPI_Abort() on exceptions.
- Move the LegacyCmdLineWrapper from legacymodules.cpp to
cmdlinemodulemanager.cpp, rename it, and add methods to access it in
other contexts as well.
- Merge g_pme_error into the wrapper binary. Make mdrun and other
remaining binaries to use this code path for initialization, even
though they still remain independent binaries.
- Remove unnecessary code from statutil.*, now that the common options
are handled by CommandLineModuleManager.
All executables now start up through CommandLineModuleManager::run(),
making it easy to adjust common behavior.
RFC because I don't have easy access to an environment where I could
test MPI or X11 code; thus I would appreciate it if someone could test
these parts (if Jenkins verification is not sufficient).
Part of #685.
Change-Id: I2cb9b0745c084b3d77f95ca163aa6745af01c1bc
- Revision 70421a8a by Teemu Murtola on 2013-09-13T19:16:06Z:
Move mdrun into the wrapper binary.
Part of #685.
Change-Id: I92d9ad5705356b2ab1e132383a5fee79ade0f4d0
- Revision 6603baa6 by Teemu Murtola on 2013-09-13T19:18:40Z:
Add option to build a standalone mdrun binary only.
This makes it again possible to build a leaner version of mdrun, without
the whole wrapper binary. Enabling the option also removes unnecessary
stuff from libgromacs, and suffixes it with _mdrun.
This also replaces install-mdrun: 'make' builds only mdrun and
'make install' installs only mdrun when the new option is enabled.
Part of #685.
Change-Id: I8d309fadebfcdabc484d632a213ac52c558bfbf4
- Revision f107cc6f by Teemu Murtola on 2013-09-19T03:16:37Z:
Framework for help export from wrapper binary.
- Add a separate CommandLineHelpContext. This class layers extra
information on top of a HelpWriterContext, specific for command-line
help export.
- Add a global instance of the above to be able to pass it into
write_man() through functions unaware of its existence. Make
write_man() use the instance if present.
- Add -export option for 'gmx help', and an interface that needs to be
implemented to export a particular format.
Related to #685 and #969.
Change-Id: Ica16895f8136a09bc5995812c4da5363d097c2b1
- Revision 1c73f59f by Teemu Murtola on 2013-09-19T03:28:15Z:
Uniform code path for writing out console help.
Now both 'gmx help <module>' and 'gmx <module> -h' trigger exactly the
same code path, making things a lot easier to work with.
Some notable things:
- Moved the responsibility to parse the -hidden argument into the
wrapper binary, from where it gets passed down in
CommandLineHelpContext. Quite a few files are touched by this.
- The -h option now causes all other options to the module get ignored.
g_tune_pme requires some other approach to deal with option
validation, but even adding a separate command-line option for only
this purpose is probably better than the multiple code paths that
were there before this change.
- Related to the above, the help output could be significantly
simplified, since it no longer depends on the command-line.
- Removed the -verbose option that caused the options to be printed
during a normal run. Possible to add back if people want it, but it
simplifies things if it isn't needed.
Related to #685 and #969.
Change-Id: Ibe735711f650eafaecf28ffb1ed92da97dcb81b6
- Revision 031d6d80 by Teemu Murtola on 2013-10-03T15:25:23Z:
Man page export from the wrapper binary.
Implement nroff output format for 'gmx help -export'.
Move the header/footer generation out of wman.cpp.
The generation is now off by default. Can be reinstantiated if someone
comes with a good approach for the case where the compiled binaries
don't run on the build host (e.g., compiling AVX256 binaries on a SSE4.1
host).
Related to #685 and #969.
Change-Id: I17725e3a487470bea8f6db2a59da31139e70621e
- Revision abc93fe9 by Teemu Murtola on 2013-10-07T14:31:49Z:
HTML export from the wrapper binary.
Implement HTML output format for 'gmx help -export'.
Fix an issue that caused 'mdrun -man html' to segfault.
Move the HTML header and footer generation out of wman.cpp and clean it
up (close incomplete tags, remove the date, etc.).
Clean up the layout of the online manual (on the file system) by putting
the generated files into a separate directory. Also generate an
alphabetical list of programs into its own file instead of directly on
the front page. By-topic list is currently missing.
Left out installation rules for now; can be reinstantiated once #1242
and the general approach to the whole online manual is clearer.
Will fix hyperlinks etc. in the generated output in separate change(s).
Related to #685, #969, and #1242.
Change-Id: Iaf8fc28d563f05a8e00c7c52d58b91cd1dabf369
- Revision caeb87ea by Teemu Murtola on 2013-10-07T15:07:02Z:
Improve markup substitution in HelpWriterContext.
- substituteMarkup() replaced with an interface that also does line
wrapping at the same time. Allows more complex line wrapping that
can also depend on the input markup, and clarifies responsibilities in
the code.
- Make TextTableFormatter use the new interface, removing explicit
substituteMarkup() calls from elsewhere in the code.
- Structure the substitution to allow easy addition of more output
formats.
Related to #685 and #969.
Change-Id: Id34be9489aa3a90d94cd87f8936b030bc21f1c98
- Revision 0b9fcab2 by Teemu Murtola on 2013-10-16T18:40:02Z:
Remove latex help export.
The decision in I7e56a011 was to drop Appendix D from the manual.
This commit removes the latex help export code that supported that.
This makes it easier to manage change in wman.cpp, since now all the
markup substitution code operates in the same environment.
Related to #685 and #969.
Change-Id: Iaeb5b82e288e3120ebe6ae38c0e5c3aca892194a
- Revision 5e4af5d1 by Teemu Murtola on 2013-10-30T15:45:11Z:
Markup substitution through HelpWriterContext.
Make all calls to process the in-source strings to help output go
through HelpWriterContext. This makes it easy to implement common
functionality using C++ mechanisms.
Moved all the HTML link processing stuff into HelpWriterContext as well
and cleaned up links.dat. The generated HTML pages should no longer
contain broken links (but links between program pages are not there
yet).
The markup substitution itself is still done by functions in wman.cpp;
will move those into private functions in helpwritercontext.cpp as a
separate change.
Related to #685 and #969.
Change-Id: I37d45549214e49a6edab82fb64ec7b38b9e72094
- Revision 88d213b1 by Teemu Murtola on 2013-11-16T22:31:54Z:
Add listing of programs by topic to HTML output.
Now the HTML-exported help contains also a list of programs by topic,
similar to what used to be generated from programs.txt. Removed the
mkhtml script, since it is now fully replaced by the mechanism in the
wrapper binary.
The same mechanism could also be used to replace the gromacs.7 man page,
but in its current form, it contains so much boilerplate code that I
didn't want to copy-paste that all into the source file. And it could
also be used to make the output of 'gmx help' more structured.
Related to #685, #969, and #1242.
Change-Id: I6c2efe10c53f10f7fde90b3386ddea7fbea34b89
- Revision 4c15f726 by Teemu Murtola on 2013-11-19T04:49:27Z:
Add back mechanism for cross-tool hyperlinks.
The exported HTML pages again can contain hyperlinks to other tools.
Instead of replicating the old functionality, made the links of the form
[gmx-distance] instead of recognizing plain text words. This requires
all the output formats to be aware of them (not a big deal in the
current code layout), and makes it possible to define the appearance of
the links centrally instead of relying on all links being wrapped in,
e.g., [TT]...[tt]. The new link syntax is similar to Markdown implicit
links (at least Doxygen accepts them without the second []).
Also added support for [THISMODULE] tag in the help text, which expands
to the name of the current module, again allowing the appearance to be
defined centrally.
Only changed the help text for gmx-mindist to take advantage of the new
mechanism as a proof-of-concept. Bulk work for other tools is better
done as a separate commit once the general approach is accepted.
Part of #685 and #1242.
Change-Id: Ibd263cc2c131dc18d2a5d9046fecc6b1c08734f9
- Revision 3676eb71 by Teemu Murtola on 2013-11-28T10:12:05Z:
Uniform headers in HTML pages
The version number is now also automatically updated in the page headers
for 'make html'. Also, fix most links in the file format pages.
If we in the future move into some proper HTML publishing system (e.g.,
based on Markdown), it should probably take care of this and also
cross-links between these pages and the generated pages, so not much
effort has been put to make the approach or the headers/footers
particularly elegant.
Related to #685 and #1242.
Change-Id: I083d1f9714ddf68dfc2977799378299a43a05b73
- Revision 3f495657 by Teemu Murtola on 2013-11-28T16:16:11Z:
Generate gromacs.7 from the wrapper binary
Use the same mechanism for generating gromacs.7 as with the by-topic
list of programs for the HTML pages. Now the man page content is
up-to-date, no longer requires programs.txt, and uses the new
gmx-something names for the referenced programs.
Part of #685
Change-Id: I070f88fd366b37d1ba287a3c2e8e26a846774002
- Revision 260a3b44 by Teemu Murtola on 2013-11-29T07:23:38Z:
Make help texts refer to gmx-something
Help text written by -h, as well as man pages and the HTML help now
refer to programs as gmx-something instead of the old names that are now
only symbolic links. Cross-references in the HTML pages should be there
again.
Related to #685.
Change-Id: I41ce99cc224aa2c13f94d61e625115a8c991daba
- Revision 2f14f668 by Teemu Murtola on 2013-12-02T14:55:40Z:
Uniform behavior for 'make man' and 'make html'
Both man and HTML pages are now generated and installed using similar
installation rules. GMX_BUILD_HELP controls automatic generation of
both. They are also put into the source distribution using the same
mechanism for both.
Part of #685 and #1242.
Change-Id: Id61e75623861b46f765da49c4b34047a6b327083
- Revision 493a9c5e by Teemu Murtola on 2013-12-02T14:56:22Z:
Remove remaining uses of programs.txt
Other uses have been replaced with direct generation from the wrapper
binary. Since the manual no longer has the program man pages, there is
no particular need to list the programs either, in particular since this
is potentially more maintenance. A reference to the online help and/or
'gmx help' should be sufficient.
Related to #685.
Change-Id: Ie865e955416cdc28f654cf2f988994bac7550ac6
- Revision 04cc4266 by Teemu Murtola on 2014-01-28T13:05:41Z:
Shell completion export from the wrapper binary
Bash completions now complete the arguments to the wrapper binary
itself, as well as the subcommand names. After a subcommand has been
specified, use the existing completion logic. Completions now work also
for arbitrarily suffixed binaries (which the old system didn't work at
all). No completion is generated for symlinks, but should be
straightforward to do if really required; approach would be the same as
for GMX_BUILD_MDRUN_ONLY.
Other completions are not working for the wrapper binary, and as far as
I can tell, require a completely different approach. Removed the
non-functional code.
Related to #685 and #1410.
Change-Id: I55b13a65c176dab6e2f4f41bf6e829112c99e6b3
- Revision 64d349b2 by Teemu Murtola on 2014-01-29T17:59:26Z:
Print common options to 'gmx -h'
The help shown for the wrapper binary now includes the command line
options it accepts. Remaining issues that will be fixed separately:
- Unlike other help output, this output is actually influenced by what
the user specifies on the command line.
- The information is not so easy to find, because of the long list of
subcommands that comes after it.
- The information should go to some man page as well.
Related to #685.
Change-Id: Iac72dd21d4a733016b331549e139d4184bd3e283
- Revision eda326a5 by Teemu Murtola on 2014-01-30T04:25:52Z:
Move command listing to 'gmx help commands'
Instead of printing the list of commands on 'gmx' or 'gmx help', print
it only when explicitly requested with 'gmx help commands'. This makes
it easier to see the help about the common command line options that
'gmx' accepts. The list of available help topics lists the 'commands'
topic, so it should be easy to find.
Related to #685.
Change-Id: I00e9ceae15ebd47d2ac129aae8e6e407f86c388a