<div dir="ltr">Even reading the first couple of chapters of Radovan Bast&#39;s book, &quot;CMake Cookbook&quot; could help give a clear understanding of the basics of CMake. If you can&#39;t get access, you can at least look at a few of the examples <a href="https://github.com/dev-cafe/cmake-cookbook">https://github.com/dev-cafe/cmake-cookbook</a>.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 13, 2020 at 9:11 AM Mark Abraham &lt;<a href="mailto:mark.j.abraham@gmail.com">mark.j.abraham@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Jan,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 12 Apr 2020 at 14:59, jan &lt;<a href="mailto:rtm443x@googlemail.com" target="_blank">rtm443x@googlemail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br>
I&#39;ve been trying to get profiling working, although I understand<br>
that&#39;s not what gromacs needs. I&#39;m using bit as a way of getting used<br>
to everything. I&#39;m also aware the manual says gprof probably won&#39;t be<br>
that useful - Pall says there&#39;ll be too much overhead to get useful<br>
timings. That&#39;s ok.<br>
Nonetheless, I can&#39;t get it working. If I enable gprof using<br>
<br>
 -DCMAKE_BUILD_TYPE=Profile<br>
<br>
then gmon.out is about 20K and<br>
<br>
gprof gmx<br>
<br>
gets me only a longish output describing labels (such as self, % time<br>
etc) but no actual profiling data.<br></blockquote><div><br></div><div>By default, the build makes a wrapper binary gmx, with almost all the functionality pushed into libgromacs.so. gprof often does not do a good job of profiling shared libraries. Configure with cmake -DBUILD_SHARED_LIBRARIES=off and gprof has more chance.</div><div><br></div><div>Also, just running gmx only returns the usage, so doesn&#39;t take any time. So maybe gprof doesn&#39;t report anything because there&#39;s not enough time analyzed for it to say anything? Mostly gmx mdrun is the only thing interesting for profiling, although sometimes other tools are of interest, like grompp. You will need a rather long mdrun for gprof&#39;s sampling approach to do a good job - as an uninformed guess, nothing under 10 minutes.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Looking at the GCC docs it needs to be compiled with -pg, and linked<br>
with the same flags. Digging through the makefile stuff it *seems*,<br>
AFAICT, that both flags are being passed for compilation and linking.<br>
But no gprof output. Could well be I broke the build somehow, but I<br>
don&#39;t know.<br></blockquote><div><br></div><div>Wildly unlikely</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
About the build process, I don&#39;t understand even how to make sense of<br>
it. For example Cmake makes makefiles, ok, but many such generated<br>
makefiles seem to themselves call back to Cmake, eg. copied from a<br>
makefile produced by Cmake:<br>
<br>
<br>
# The CMake executable.<br>
CMAKE_COMMAND = /usr/bin/cmake<br>
<br>
# Special rule for the target install/strip<br>
install/strip: preinstall<br>
        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan<br>
&quot;Installing the project stripped...&quot;<br>
        /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake<br>
.PHONY : install/strip<br>
<br>
<br>
So cmake calls on make which calls on cmake?<br></blockquote><div><br></div><div>The cmake binary bundles multiple functionalities, including for supporting functionality that works across platforms, such as one might use during file copying during install stages, or pretty-printing to terminals during the build. See its man page.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I really need to get a feeling of how the build is structured, so<br>
could anyone drop some useful hints or pointers please.<br></blockquote><div><br></div><div>cmake&#39;s tutorial material is a useful start if you&#39;re just not familiar with it at all. It&#39;s a build system generator, not a build system. As such, there are CMakeLists.txt files in most GROMACS directories that direct the process. Some general functionality is found in the top-level cmake directory too. By the way, there&#39;s lots of useful documentation at <a href="http://jenkins.gromacs.org/job/Documentation_Nightly_master/javadoc/dev-manual/index.html" target="_blank">http://jenkins.gromacs.org/job/Documentation_Nightly_master/javadoc/dev-manual/index.html</a> but if you spot something missing, please let us know!</div><div><br></div><div>Mark</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Pall has given me pointers to other profiling tools (again with the<br>
caveat that it&#39;s not what gmx needs, but this is part of my learning<br>
curve).<br>
<br>
cheers<br>
<br>
jan<br>
-- <br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.<br>
</blockquote></div></div>
-- <br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.</blockquote></div>