Compiling the code
To load compilers module on Compute Canada, use the following commands:
module load intel # for the Intel compilers or for GNU compilers
module load gcc # for the GNU compilers
To load the MPI module on Compute Canada, use the following command:
module load openmpi
To load different Blas implementation module on Compute Canada, use the following command:
module load flexiblas # for the flexiblas lib implementation or for openblas
module load openblas # for the openblas lib implementation or for imkl
module load imkl # for the imkl lib implementation
Build kART with CMake (for the latest version, using pART)
To compile with the previous verson of kART (without ARTn integrated into kART), please go to the next section.
To build with CMake on Compute Canada, the following modules is required:
module load cmake
If you are not the same system, ensure that CMake is available.
Make compilation will fetch its main dependency such as lammps, artn-plugin. CMake should find the available option from the environement variable (such as MPI, compilers and Blas implementation) and set them on for compilation automaticaly.
This is done in tree steps. First Git clone kART. Then configure the cmake compilation project. Finally build kART.
git clone https://gitlab.com/groupe_mousseau/kart.git kart
cd kart && mkdir build && cd build # create and go to the build directory
cmake ../ # configuration
cmake --build . --target main_kART # compilation kART
To set compilers do one or the other at the configuration setp:
cmake ../ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran # for GNU compilers
cmake ../ -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DCMAKE_Fortran_COMPILER=ifx # for IntelLLVM compilers
Setting the compiler is not mandatory, the default compiler selected on Compute Canada is the GNU Compiler Collection (GCC). Note: the compiler that compiled MPI and the compiler to build kART must be of the same family (e.g. it will not work if MPI is build with Intel and the selected compiler is GNU). This create an Unexpected EOF error on Compute Canada, when the intel module is loaded (this also load an openmpi implementation that is also build with Intel compiler) while the GNU Compuler is selected by cmake. The solution is to set the IntelLLVM compilers as shown above.
The configuration step can be modified to customize dependency of the project by amending the command with options (Syntax: -DVARNAME=val or -DVARNAME val or -D VARNAME=val, for bollean value -DVARBOOL=yes/no/ON/OFF). Other option can be set such as kART project options, lammps package (e.g. -DPKG_MEAM=ON), quantum espresso, compiler options and much more. See cmake documentation https://cmake.org/cmake/help/latest/index.html. Compilation speed can be increase by setting the number of core assign to compilation with -jN where N is the number of code (e.g. cmake --build . --target main_kART -j16)
An example of how to add lammps package (e.g. MANYBODY) to kART the configuration step is
cmake ../ -DPKG_MANYBODY=ON
To set the Blas lib implementation to flexiblas:
cmake ../ -DBLA_VENDOR=flexiblas
Final example where are set the compilers as IntelLLVM, the Blas lib implementation to flexiblas and the MANYBODY lammps package:
cmake ../ -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DCMAKE_Fortran_COMPILER=ifx -DBLA_VENDOR=flexiblas -DPKG_MANYBODY=ON
See relevant lammps documentation at https://docs.lammps.org/Build_basics.html, https://docs.lammps.org/Build_settings.html, https://docs.lammps.org/Build_package.html and https://docs.lammps.org/Build_extras.html.
To build kART with machine-learning on-the-fly capabilities the configuration step is
cmake ../ -DWITH_MLIP=ON
This will fetch mlip and quantum espresso automatically. Then the project is build as usual with cmake --build . --target main_kART.
Testing the installation
To test the latest version of kART (which includes partn), you can run the examples/Si63-vac-partn. Note that the other examples might not working as some of the commands associated with the activation and relaxation have changed.
Build kART with Make (for the previous version, with integrated ARTn)
For now make compilation doesn’t work anymore due to important change in the project. But it is possible tu checkout to an older verssion of kart to compile it with make (this version doesn’t work with artn-plugin).
git clone https://gitlab.com/groupe_mousseau/kart.git kart
cd kart
git checkout 62d66adf
Building on mac OS X with Lammps and Openmpi
To build kART on a mac, with the lammps library, users can look into Makefile.normand.
Make using with LAMMPS
k-ART can be compiled with the LAMMPS library, giving it access to a wide range of efficiently programmed forcefields. k-ART includes a modified version of the fortran interface to the library as the original one has some limitations.
For this, download the latest version of LAMMPS : http://lammps.sandia.gov
LAMMPS can be compiled with cmake or make. We provide below a brief list of commands. Please refer to LAMMPS’ manual for all details. –>
Make version
Build LAMMPS as a Library,
a) Load all the packages from LAMMPS that you need before compilation. (For example, the package
manybodyis needed for using tersoff and sw potential.)
% make yes-manybody
You can find the list of all the available packages by typing make package-status in the src directory of LAMMPS or check the list on their web site (http://lammps.sandia.gov/doc/Section_packages.html)b) Now Compile LAMMPS as a library by entering :
% make makelib
% make -f Makefile.lib foofor old version of LAMMPS
% make mode=shlib foofor newest version of LAMMPS
(where foo is the architecture makefile name, for further details check the section 2.5 of their web page, http://lammps.sandia.gov/doc/Section_start.html#start_5)Note for "shlib" is for a shared library, for static one, just type "mode=lib"
c) You should have now a file named liblammps_foo.a in the src folder. You can move it to the source code directory of kART or update the path to the library in the k-ART Makefile.
To compile k-ART with the lammps library, you need to use the
-DLAMMPS_VERSIONflag and set the path to the src folder of your lammps distribution (see the briareelammps option as an example). –>
To build k-ART, without the lammps
library, just go in the SRC folder and select the appropriate Makefile (found in src/MAKEFILE). For example make briaree should
create the file KMCART_correctmap_briaree and move it to your binary
directory (default is bin in the home directory, can be changed with the
BINDIR variable in the Makefile).
To compile k-ART with the lammps library, you first need to create the lammps library file. Follow the instructions below to create it and then use the LAMMPSPATH variable in the makefile under the briareelammps flag to define its path. You can then compile by typing the command, for example:
% make briareelammps.
If working on a cluster, load all the necessary modules used during compilation (intel-compilers for example) and the MPI modules if the parallel version is being compiled (recommended).
Make the necessary modifications to the Makefile.
For example, on unix (briaree), we are using the following modules :\
intel-compilers/12.0.4.191\
MPI/Intel/openmpi/1.6.2\
And if lammps version FFTW/3.3