Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add instructions on using conda as build env #3466

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/FindIntelMKL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# MKL_FOUND - True if mkl found.
#

find_path(MKL_INCLUDE_DIR mkl_dfti.h HINTS ${MKLROOT}/include)
find_path(MKL_INCLUDE_DIR mkl_service.h HINTS ${MKLROOT}/include)

find_library(MKL_INTEL NAMES mkl_intel_lp64 HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64)
find_library(MKL_INTEL_THREAD NAMES mkl_intel_thread HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64)
Expand Down
10 changes: 5 additions & 5 deletions docs/advanced/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The new EXX implementation depends on two external libraries:

These two libraries are added as submodules in the [deps](https://github.com/deepmodeling/abacus-develop/tree/develop/deps) folder. Set `-DENABLE_LIBRI=ON` to build with these two libraries.

If you prefer using manually downloaded libraries, provide `-DLIBRI_DIR=${path to your LibRI folder} -DLIBCOMM_DIR=${path to your LibComm folder}`.
If you prefer using manually downloaded libraries, provide `-DLIBRI_DIR=${path to your LibRI folder} -DLIBCOMM_DIR=${path to your LibComm folder}`.

## Build Unit Tests

Expand Down Expand Up @@ -85,7 +85,7 @@ cmake -B build -DUSE_CUDA=1 -DCMAKE_CUDA_COMPILER=${path to cuda toolkit}/bin/nv

> Note: This flag is **enabled by default**. It will get better performance than the standard implementation on `gcc` and `clang`. But it **will be disabled** when using `Intel Compiler` since the math functions will get wrong results and the performance is also unexpectly poor.

To build math functions from source code, instead of using c++ standard implementation, define `USE_ABACUS_LIBM` flag.
To build math functions from source code, instead of using c++ standard implementation, define `USE_ABACUS_LIBM` flag.

Currently supported math functions:
`sin`, `cos`, `sincos`, `exp`, `cexp`
Expand Down Expand Up @@ -136,7 +136,7 @@ CEREAL_DIR = /usr/local/include/cereal

##------------------- FOR GNU COMPILER ------------------------------
## FFTW_DIR should contain lib/libfftw3.a.
## OPENBLAS_LIB_DIR should contain libopenblas.a.
## OPENBLAS_LIB_DIR should contain libopenblas.a.
## SCALAPACK_LIB_DIR should contain libscalapack.a
## All three above will only be used when CXX=mpicxx or g++
## ELPA_DIR should contain an include folder and lib/libelpa.a
Expand Down Expand Up @@ -270,8 +270,8 @@ directly.

> `deepmd_c`/`deepmd_cc` and `tensorflow_cc` libraries would be called according to `DeePMD_DIR` and `TensorFlow_DIR`, which is showed in detail in [this page](https://github.com/deepmodeling/deepmd-kit/blob/master/doc/inference/cxx.md).

### Add LibRI and LibComm Support
To use new EXX, you need two libraries: [LibRI](https://github.com/abacusmodeling/LibRI) and [LibComm](https://github.com/abacusmodeling/LibComm) and need to define `LIBRI_DIR` and `LIBCOMM_DIR` in the file `Makefile.vars` or use
### Add LibRI Support
To use new EXX, you need two libraries: [LibRI](https://github.com/abacusmodeling/LibRI) and [LibComm](https://github.com/abacusmodeling/LibComm) and need to define `LIBRI_DIR` and `LIBCOMM_DIR` in the file `Makefile.vars` or use
```makefile
make LIBRI_DIR=/public/software/LibRI LIBCOMM_DIR=/public/software/LibComm
```
Expand Down
35 changes: 30 additions & 5 deletions docs/quick_start/easy_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Please refer to our [guide](https://github.com/deepmodeling/abacus-develop/wiki/

## Install requirements by toolchain

We offer a set of [toolchain](https://github.com/deepmodeling/abacus-develop/tree/develop/toolchain)
We offer a set of [toolchain](https://github.com/deepmodeling/abacus-develop/tree/develop/toolchain)
scripts to compile and install all the requirements
automatically and suitable for machine characteristic in an online or offline way.
The toolchain can be downloaded with ABACUS repo, which is easily used and can
automatically and suitable for machine characteristic in an online or offline way.
The toolchain can be downloaded with ABACUS repo, which is easily used and can
have a convenient installation under HPC environment in both `GNU` or `Intel-oneAPI` toolchain.
Sometimes, ABACUS by toolchain installation may have highly efficient performance.
A Tutorial for using this toolchain can be accessed in [bohrium-notebook](https://nb.bohrium.dp.tech/detail/5215742477)
Expand Down Expand Up @@ -197,7 +197,7 @@ We also support [Gitpod](https://www.gitpod.io/): [Open in Gitpod](https://gitpo

## Install by conda

Conda is a package management system with a separated environment, not requiring system privileges. A pre-built ABACUS binary with all requirements is available at [conda-forge](https://anaconda.org/conda-forge/abacus). Conda will install the GPU-accelerated version of ABACUS if a valid GPU driver is present.
Conda is a package management system with a separated environment, not requiring system privileges. A pre-built ABACUS binary with all requirements is available at [conda-forge](https://anaconda.org/conda-forge/abacus). It supports advanced features including Libxc, LibRI, and DeePKS. Conda will install the GPU-supported version of ABACUS if a valid GPU driver is present. Please refer to [the advanced installation guide](../advanced/install.md) for more details.

```bash
# Install
Expand All @@ -212,6 +212,31 @@ OMP_NUM_THREADS=1 mpirun -n 4 abacus
conda update -n abacus_env abacus -c conda-forge
```

For more details on building a conda package of ABACUS, please refer to the [conda recipe file](https://github.com/deepmodeling/abacus-develop/blob/develop/conda/meta.yaml).
> If OpenBLAS gives warning about OpenMP threads, please install conda package `openblas=*=openmp*` or `blas=*=mkl`. See [switching BLAS implementation in conda](https://conda-forge.org/docs/maintainer/knowledge_base.html#switching-blas-implementation).

> ABACUS supports `OpenMPI` and `MPICH` variant. Install `mpich` or `openmpi` package to switch MPI library if required.

For more details on building a conda package of ABACUS locally, please refer to the [conda recipe file](https://github.com/deepmodeling/abacus-develop/blob/develop/conda/meta.yaml).

> Note: The [deepmodeling conda channel](https://anaconda.org/deepmodeling/abacus) offers historical versions of ABACUS.

### Developing with conda

It is possible to build ABACUS from source based on the conda environment.

```bash
conda create -n abacus_env abacus -c conda-forge
conda activate abacus_env
export CMAKE_PREFIX_PATH=$CONDA_PREFIX:$CMAKE_PREFIX_PATH

# By default OpenBLAS is used; run `conda install "blas=*=mkl" mkl_fft -c conda-forge` to switch implementation.
export MKLROOT=$CONDA_PREFIX # If Intel MKL is required.

export CMAKE_PREFIX_PATH=`python -c 'import torch;print(torch.utils.cmake_prefix_path)'`:$CMAKE_PREFIX_PATH # If DEEPKS support is required;
# usually expands to `$CONDA_PREFIX/lib/python3.1/site-packages/torch/share/cmake`
```

And, follow the instructions in [Build and Install](#build-and-install) part above withou manually setting paths to dependencies.
See [the advanced installation guide](../advanced/install.md) for more features.
Make sure the environment variables are set before running `cmake`.
Possible command: `cmake -B build -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON`.