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

Both sides previous revisionPrevious revision
Next revision
Previous revision
compiling [2013/03/04 07:39] danielcompiling:main [2020/10/12 15:51] (current) – [Advanced options] print -- as --, not ndash pbro
Line 1: Line 1:
 +~~NOTOC~~
 ====== Compiling potfit ====== ====== Compiling potfit ======
 ---- ----
-//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. 
  
-<code bash>gmake [FLAGS="some flags"potfit-target</code>+//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 ''SYSTEM'' 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 ''SYSTEM'' variable, can be passed on the command line with the help of the ''FLAGS'' variable.+===== Basics =====
  
-After compiling, the potfit executable is moved to the directory ''$HOME/bin'', if this existsOtherwise it is not movedThe 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 folderIt is used for all build related operations like configuration, building and cleanupIt provides an exhaustive help page when called with the --help argument: 
 +<code>./waf --help</code>
  
-''potfit-target'' consists of several components and has the following structure:+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.
  
-   potfit[_parallelization][_option][_option]...+=== 1Configuration ===
  
-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. Most options can coexist with each other.+The configuration uses the ''configure'' command from waf:
  
-Here are some [[Compiling/Examples|examples]] that might help you compile //potfit//.+<code>./waf configure <additional arguments></code>
  
-===  Compilation Options  ===+A minimal configuration needs to specify at least the interaction (-i) and the potential model (-m):
  
-The compilation options are described together with the simulation features they enable. For details, see the [[options]]+<code>./waf configure -i pair -m apot</code>
  
-===  Supported values of the ''SYSTEM'' variable  ===+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>
  
-Currently, the following values of the ''SYSTEM'' variable are supported and properly tested:+=== 2. Build ===
  
-<code>x86_64-gcc All recent 64 bit processors, gcc +The build process can be start with the ''build'' command from waf:
-x86_64-icc All recent 64 bit processors, icc</code>+
  
-The following values of the ''SYSTEM'' variable are also available but not very well tested:+<code>./waf build</code>
  
-<code>i686-gcc 32 bit processor, gcc +Since ''build'' is the default command it can also be omitted for brevity.
-i686-icc 32 bit processor, icc</code>+
  
-Support for different values of ''SYSTEM'' is easily added. The Makefile contains 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 ''SYSTEM''. There is a template from which one can start.+Once the build process is complete, there will be line indicating the name of the created binary:
  
-===  Problems with the Intel Math Kernel Library  ===+<code> 
 +---> Successfully moved potfit_apot_pair_mkl to bin/ folder <--- 
 +</code>
  
-If you are having trouble linking //potfit// with the Intel MKLplease take a look at the [[http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/|MKL Link Line Advisor]]. Replace the ''LIBS'' variable in your profile by the output of the advisor.+===== Setting options ===== 
 + 
 +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 stressprovide 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.1362379169.txt.gz · Last modified: 2013/03/04 07:39 by daniel