Files
lammps/doc/src/Build_make.txt

81 lines
3.9 KiB
Plaintext

"Higher level section"_Build.html - "LAMMPS WWW Site"_lws - "LAMMPS
Documentation"_ld - "LAMMPS Commands"_lc :c
:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Commands_all.html)
:line
Build LAMMPS with make :h3
Building LAMMPS with traditional makefiles requires, that you have a
Makefile."machine" file in the src/MAKE, src/MAKE/MACHINES,
src/MAKE/OPTIONS, or src/MAKE/MINE directory, which is appropriate
for your system (see below). It can list various options for
customizing your LAMMPS build with a number of global compilation
options and features. To include LAMMPS packages (i.e. optional
commands and styles) you must install them first, as discussed on
the "Build package"_Build_package.html doc page. If the packages
use provided or external libraries, you must build those libraries
before building LAMMPS. Building "LAMMPS with CMake"_Build_cmake.html
can automate all of this for many types of machines, especially
workstations, desktops and laptops, so we suggest you try it first.
These commands perform a default LAMMPS build, producing the LAMMPS
executable lmp_serial or lmp_mpi in lammps/src:
cd lammps/src
make serial # build a serial LAMMPS executable
make mpi # build a parallel LAMMPS executable with MPI
make # see a variety of make options :pre
This initial compilation can take a long time, since LAMMPS is a large
project with many features. If your machine has multiple CPU cores (most
do these days), using a command like "make -jN mpi" (with N being to the
number of available local CPU cores) can be much faster. If you plan to
do development on LAMMPS or may need to recompile LAMMPS repeatedly, the
installation of the ccache (= Compiler Cache) software may speed up
compilation even more.
After the initial build, whenever you edit LAMMPS source files, or
add or remove new files to the source directory (e.g. by installing or
uninstalling packages), you must recompile and relink the LAMMPS executable
with the same command line, but the makefiles will make certain, that
only files that need to be recompiled will be compiled (because they
were changed or depend on files, that were changed).
:line
The lammps/src/MAKE tree contains all the Makefile.machine files
included in the LAMMPS distribution. Typing "make machine" uses
Makefile.machine. Thus the "make serial" or "make mpi" lines above
use Makefile.serial and Makefile.mpi. Others are in these dirs:
OPTIONS # Makefiles which enable specific options
MACHINES # Makefiles for specific machines
MINE # customized Makefiles you create (you may need to create this folder) :pre
Typing "make" lists all the available Makefile.machine files. A file
with the same name can appear in multiple dirs (not a good idea). The
order the dirs are searched is as follows: src/MAKE/MINE, src/MAKE,
src/MAKE/OPTIONS, src/MAKE/MACHINES. This gives preference to a
customized file you put in src/MAKE/MINE.
Makefiles you may wish to try include these (some require a package
first be installed). Many of these include specific compiler flags
for optimized performance. Please note, however, that most of these
customized machine Makefile are contributed and since both, compilers
and also OS configs, as well as LAMMPS itself keep changing all the
time, some of these settings and recommendations may be outdated:
make mac # build serial LAMMPS on a Mac
make mac_mpi # build parallel LAMMPS on a Mac
make intel_cpu # build with the USER-INTEL package optimized for CPUs
make knl # build with the USER-INTEL package optimized for KNLs
make opt # build with the OPT package optimized for CPUs
make omp # build with the USER-OMP package optimized for OpenMP
make kokkos_omp # build with the KOKKOS package for OpenMP
make kokkos_cuda_mpi # build with the KOKKOS package for GPUs
make kokkos_phi # build with the KOKKOS package for KNLs :pre