potfit wiki

open source force-matching

User Tools

Site Tools


compiling:main

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
compiling [2013/02/28 13:20] – created danielcompiling:main [2020/10/12 15:51] (current) – [Advanced options] print -- as --, not ndash pbro
Line 1: Line 1:
-''potfit'' is compiled with GNU make, which we call gmake in the following. Note that on most systems, GNU make is called make. Most other implementations of make won't work.+~~NOTOC~~ 
 +====== Compiling potfit ====== 
 +----
  
-<syntaxhighlight lang="bash">gmake [FLAGS="some flags"potfit-target</syntaxhighlight>+//potfit// uses the [[https://waf.io/|waf]] build system, which is fast, easy to use and very flexible. It is written in Python and requires a Python runtime to be available on the system. 
  
-The compiler and compilation flags are determined according to the <tt>SYSTEM</tt> variable, which has to be set once in the Makefile on line 125 or 126+The old [[compiling:make|Makefile-based build system]] is still available for compatibility reasons. It may not support all features and will be removed eventually.
  
-Further compile or link flags, in addition to those determined by the <tt>SYSTEM</tt> variable, can be passed on the command line with the help of the <tt>FLAGS</tt> variable.+===== Basics =====
  
-After compiling, the potfit executable is moved to the directory <tt>$HOME/bin</tt>, if this exists. Otherwise it is not moved. The location where executables are put can also be customized in the Makefile (line 130).+The //potfit// source tree contains the waf binary in its root folder. It is used for all build related operations like configuration, building and cleanup. It provides an exhaustive help page when called with the --help argument: 
 +<code>./waf --help</code>
  
 +Building //potfit// is split up into two stages: first a configuration stage and then a build stage. The configuration stage checks if all requirements for building a //potfit// binary with the requested options is possible and the build stage then invokes the compiler to create the binary.
  
-<tt>potfit-target</tt> consists of several components and has the following structure:+=== 1. Configuration ===
  
-   potfit[_parallelization][_option][_option]...+The configuration uses the ''configure'' command from waf:
  
-Most features of potfit must be activated with the corresponding compilation option in the make target. The most important option is the interaction you want to use. +<code>./waf configure <additional arguments></code>
-Most options can coexist with each other.+
  
-Here are some [[Compiling/Examples|examples]] that might help you compile potfit.+A minimal configuration needs to specify at least the interaction (-i) and the potential model (-m):
  
-==== Compilation Options ====+<code>./waf configure -i pair -m apot</code>
  
-The compilation options are described together with the simulation features they enable. For details, see the [[:Category:Options]]. +After the configuration stage is complete a summary of selected options will be shown: 
 +<code> 
 +potfit has been configured with the following options: 
 +potential model      = apot 
 +interaction          = pair 
 +math library         = mkl 
 +</code>
  
-==== Supported values of the <tt>SYSTEM</tt> variable ====+=== 2. Build ===
  
-Currently, the following values of the <tt>SYSTEM</tt> variable are supported and properly tested:+The build process can be start with the ''build'' command from waf:
  
- x86_64-gcc All recent 64 bit processors, gcc +<code>./waf build</code>
- x86_64-icc All recent 64 bit processors, icc+
  
-The following values of the <tt>SYSTEM</tt> variable are also available but not very well tested:+Since ''build'' is the default command it can also be omitted for brevity.
  
- i686-gcc 32 bit processorgcc +Once the build process is completethere will be a line indicating the name of the created binary:
- i686-icc 32 bit processor, icc+
  
-Support for different values of <tt>SYSTEM</ttis easily added. The Makefile contains a detailed decsription of how the compile and link flags are determined from a number of Makefile variables, which has to be set for each supported value of <tt>SYSTEM</tt>. There is a template from which one can start.+<code> 
 +---Successfully moved potfit_apot_pair_mkl to bin/ folder <--- 
 +</code>
  
-==== Problems with the Intel Math Kernel Library ====+===== Setting options =====
  
-If you are having trouble linking potfit with the Intel MKL, please take a look at the [http://software.intel.com/en-us/articles/intel-mkl-link-line-advisorMKL Link Line Advisor]. Replace the <tt>LIBS</ttvariable in your profile by the output of the advisor.+Special options when compiling //potfit// can be set using the ''--enable-'' command line options during the configure stage. All available options are listed in the ''--help'' page from waf. 
 + 
 +To enable support from stress, provide the ''--enable-stress'' option like this: 
 + 
 +<code>./waf configure -i pair -m apot --enable-stress</code> 
 + 
 +All enabled options will also be listed on the summary of the configuration stage: 
 + 
 +<code> 
 +potfit has been configured with the following options: 
 +potential model      = apot 
 +interaction          = pair 
 +math library         = mkl 
 +options              = stress 
 +</code> 
 + 
 +Some examples for compiling //potfit// with the waf build system are shown [[compiling:examples|here]]. 
 + 
 +===== Advanced options ===== 
 + 
 +Most issues with the waf build systems can be resolved using the information provided on the ''--help'' page. 
 +Here are some common issues and their recommended solution: 
 + 
 +=== Setting MKL path === 
 + 
 +The default path for the MKL libraries is ''/opt/intel/mkl''. If your installation resides in a different location you can use the ''--math-lib-base-dir'' option like this: 
 + 
 +<code>./waf configure -i pair -m apot --math-lib-base-dir=/my/custom/location</code> 
 + 
 +=== Setting compiler === 
 + 
 +By default waf will search for the following compilers (in the same order as provided here): 
 +  * Intel Compiler Collection 
 +  * Clang 
 +  * GCC 
 +To select a particular compiler use the ''--check-c-compiler'' option like this: 
 + 
 +<code>./waf configure -i pair -m apot --check-c-compiler=clang</code> 
 + 
 +Waf will search for the compiler in the default paths. 
 + 
 +Additionally it is possible to use the ''CC'' environment variable to override the compiler during the configuration phase of waf. 
 + 
 +=== Setting debug options === 
 + 
 +Depending on the selected compiler the following debug options are available: 
 + 
 +  * ''%%--debug%%'' Adds debug information to the potfit binary for debugging potfit 
 +  * ''%%--asan%%'' Enable the [[https://github.com/google/sanitizers/wiki/AddressSanitizer|address sanitizer]
 +  * ''%%--profile%%'' Add profiling information to the //potfit// binary 
 + 
 +===== Troubleshooting ===== 
 + 
 +When waf encounters an error there is usually a message which provides detailed information about the command which failedIf this is not the case it is possible to enable more logging by adding ''-v'' to the command line: 
 + 
 +<code>./waf configure -i pair -m apot -v</code> 
 + 
 +Logging can be increased even further by adding additional ''-v'' arguments. 
 + 
 +===== Developer guide ===== 
 + 
 +A short introduction to extending the waf build system for //potfit// is available [[compiling:devel|here]].
  
compiling/main.1362054048.txt.gz · Last modified: 2013/02/28 13:20 by daniel