mirror of https://github.com/phonopy/phono3py.git
Set version 3.3.0
This commit is contained in:
parent
d52aae6532
commit
1fc542fc8f
|
@ -1,27 +1,27 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
option(PHPHCALC "Option to build phph calculation module" OFF)
|
||||
option(PHONONCALC "Option to build phonon calculation module" OFF)
|
||||
option(GRIDSYS "Option to build gridsys module" OFF)
|
||||
option(WITH_Fortran "enable fortran interface" OFF)
|
||||
option(BUILD_PHPHCALC_LIB "Option to build phph calculation module" OFF)
|
||||
option(BUILD_PHONONCALC_LIB "Option to build phonon calculation module" OFF)
|
||||
option(BUILD_GRIDSYS_LIB "Option to build gridsys module" OFF)
|
||||
option(PHONO3PY_WITH_Fortran "enable fortran interface" OFF)
|
||||
option(PHONO3PY_USE_OMP "Option to search OpenMP library" ON)
|
||||
option(PHPHCALC_USE_MTBLAS "Use multithread BLAS is it exists" OFF)
|
||||
option(WITH_TESTS "build unit tests" OFF)
|
||||
option(PHONO3PY_USE_MTBLAS "Use multithread BLAS if it exists" ON)
|
||||
option(PHONO3PY_WITH_TESTS "build unit tests" OFF)
|
||||
option(BUILD_SHARED_LIBS "Option to build shared library" OFF)
|
||||
|
||||
if(WITH_Fortran)
|
||||
if(PHONO3PY_WITH_Fortran)
|
||||
enable_language(Fortran)
|
||||
set(GRIDSYS ON)
|
||||
set(BUILD_GRIDSYS_LIB ON)
|
||||
endif()
|
||||
|
||||
if(WITH_TESTS)
|
||||
if(PHONO3PY_WITH_TESTS)
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
set(GRIDSYS ON)
|
||||
set(BUILD_GRIDSYS_LIB ON)
|
||||
endif()
|
||||
|
||||
if((NOT PHPHCALC)
|
||||
AND (NOT PHONONCALC)
|
||||
AND (NOT GRIDSYS))
|
||||
if((NOT BUILD_PHPHCALC_LIB)
|
||||
AND (NOT BUILD_PHONONCALC_LIB)
|
||||
AND (NOT BUILD_GRIDSYS_LIB))
|
||||
set(BUILD_NANOBIND_MODULE ON)
|
||||
message(STATUS "Build nanobind module of ${SKBUILD_PROJECT_NAME}")
|
||||
else()
|
||||
|
@ -86,8 +86,8 @@ else()
|
|||
set(OpenMP_FOUND OFF) # cmake-lint: disable=C0103
|
||||
endif()
|
||||
|
||||
if(PHPHCALC
|
||||
OR PHONONCALC
|
||||
if(BUILD_PHPHCALC_LIB
|
||||
OR BUILD_PHONONCALC_LIB
|
||||
OR BUILD_NANOBIND_MODULE)
|
||||
find_package(BLAS REQUIRED) # set BLAS_LIBRARIES
|
||||
|
||||
|
@ -104,20 +104,22 @@ if(PHPHCALC
|
|||
endif()
|
||||
|
||||
if(BLAS_LIBRARIES MATCHES "libmkl")
|
||||
message(STATUS "MKL detected: Set C-macros MKL_LAPACKE MULTITHREADED_BLAS")
|
||||
message(STATUS "Use multithreaded BLAS for phonon calculation.")
|
||||
message(STATUS "MKL detected: Set C-macro MKL_LAPACKE.")
|
||||
|
||||
if(PHPHCALC_USE_MTBLAS)
|
||||
message(STATUS "Use multithreaded BLAS for ph-ph calculation.")
|
||||
if(PHONO3PY_USE_MTBLAS)
|
||||
message(
|
||||
STATUS "Set C-macro MULTITHREADED_BLAS to avoid nested OpenMP calls."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BLAS_LIBRARIES MATCHES "libopenblas")
|
||||
message(STATUS "OpenBLAS detected: Set C-macro MULTITHREADED_BLAS")
|
||||
message(STATUS "Use multithreaded BLAS for phonon calculation.")
|
||||
message(STATUS "OpenBLAS detected.")
|
||||
|
||||
if(PHPHCALC_USE_MTBLAS)
|
||||
message(STATUS "Use multithreaded BLAS for ph-ph calculation.")
|
||||
if(PHONO3PY_USE_MTBLAS)
|
||||
message(
|
||||
STATUS "Set C-macro MULTITHREADED_BLAS to avoid nested OpenMP calls."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -125,7 +127,7 @@ endif()
|
|||
# ###################################################################################
|
||||
# Build phphcalc module #
|
||||
# ###################################################################################
|
||||
if(PHPHCALC OR BUILD_NANOBIND_MODULE)
|
||||
if(BUILD_PHPHCALC_LIB OR BUILD_NANOBIND_MODULE)
|
||||
# Source code
|
||||
set(SOURCES_PHPHCALC
|
||||
${PROJECT_SOURCE_DIR}/c/bzgrid.c
|
||||
|
@ -163,7 +165,7 @@ if(PHPHCALC OR BUILD_NANOBIND_MODULE)
|
|||
target_include_directories(phphcalc_lib PRIVATE ${MY_INCLUDES})
|
||||
|
||||
if(BLAS_LIBRARIES MATCHES "libmkl")
|
||||
if(PHPHCALC_USE_MTBLAS)
|
||||
if(PHONO3PY_USE_MTBLAS)
|
||||
target_compile_definitions(
|
||||
phphcalc_lib PRIVATE MKL_LAPACKE MULTITHREADED_BLAS
|
||||
THM_EPSILON=1e-10)
|
||||
|
@ -174,7 +176,7 @@ if(PHPHCALC OR BUILD_NANOBIND_MODULE)
|
|||
endif()
|
||||
|
||||
if(BLAS_LIBRARIES MATCHES "libopenblas")
|
||||
if(PHPHCALC_USE_MTBLAS)
|
||||
if(PHONO3PY_USE_MTBLAS)
|
||||
target_compile_definitions(phphcalc_lib PRIVATE MULTITHREADED_BLAS
|
||||
THM_EPSILON=1e-10)
|
||||
else()
|
||||
|
@ -195,7 +197,7 @@ if(PHPHCALC OR BUILD_NANOBIND_MODULE)
|
|||
target_include_directories(phphcalc_lib PRIVATE ${MY_INCLUDES})
|
||||
|
||||
if(BLAS_LIBRARIES MATCHES "libmkl")
|
||||
if(PHPHCALC_USE_MTBLAS)
|
||||
if(PHONO3PY_USE_MTBLAS)
|
||||
target_compile_definitions(
|
||||
phphcalc_lib PRIVATE MKL_LAPACKE MULTITHREADED_BLAS
|
||||
THM_EPSILON=1e-10)
|
||||
|
@ -206,7 +208,7 @@ if(PHPHCALC OR BUILD_NANOBIND_MODULE)
|
|||
endif()
|
||||
|
||||
if(BLAS_LIBRARIES MATCHES "libopenblas")
|
||||
if(PHPHCALC_USE_MTBLAS)
|
||||
if(PHONO3PY_USE_MTBLAS)
|
||||
target_compile_definitions(phphcalc_lib PRIVATE MULTITHREADED_BLAS
|
||||
THM_EPSILON=1e-10)
|
||||
else()
|
||||
|
@ -236,7 +238,7 @@ endif()
|
|||
# ###################################################################################
|
||||
# phononcalc #
|
||||
# ###################################################################################
|
||||
if(PHONONCALC OR BUILD_NANOBIND_MODULE)
|
||||
if(BUILD_PHONONCALC_LIB OR BUILD_NANOBIND_MODULE)
|
||||
# Source code
|
||||
set(SOURCES_PHONONCALC
|
||||
${PROJECT_SOURCE_DIR}/c/dynmat.c ${PROJECT_SOURCE_DIR}/c/lapack_wrapper.c
|
||||
|
@ -311,7 +313,7 @@ endif()
|
|||
# ###################################################################################
|
||||
# grid #
|
||||
# ###################################################################################
|
||||
if(GRIDSYS)
|
||||
if(BUILD_GRIDSYS_LIB)
|
||||
# Source code
|
||||
set(SOURCES_GRIDSYS
|
||||
${PROJECT_SOURCE_DIR}/c/bzgrid.c
|
||||
|
@ -360,12 +362,12 @@ if(GRIDSYS)
|
|||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
endif()
|
||||
|
||||
if(WITH_Fortran)
|
||||
if(PHONO3PY_WITH_Fortran)
|
||||
add_subdirectory(fortran)
|
||||
endif()
|
||||
|
||||
if(WITH_TESTS)
|
||||
if(WITH_Fortran)
|
||||
if(PHONO3PY_WITH_TESTS)
|
||||
if(PHONO3PY_WITH_Fortran)
|
||||
set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/fortran)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
|
||||
# Change Log
|
||||
|
||||
## Jul-8-2024: Version 3.3.0
|
||||
|
||||
- Build system of phono3py was renewed. Now nanobind, cmake, and
|
||||
scikit-build-core are used for the building, and the receipt is written in
|
||||
`CMakeLists.txt` and `pyproject.toml`.
|
||||
|
||||
## Jun-29-2024: Version 3.2.0
|
||||
|
||||
- `--rd` and `--rd-fc2` options for generating random directional displacements.
|
||||
|
|
|
@ -58,9 +58,9 @@ copyright = "2015, Atsushi Togo"
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = "3.2"
|
||||
version = "3.3"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = "3.2.0"
|
||||
release = "3.3.0"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -30,18 +30,16 @@ All dependent packages should be installed.
|
|||
(install_from_source_code)=
|
||||
## Installation from source code
|
||||
|
||||
When installing phono3py using `setup.py` from the source code, a few libraries
|
||||
are required before running `setup.py` script.
|
||||
When installing phono3py from the source code, a few libraries are required
|
||||
before running `pip install`. For building phono3py, nanobind,
|
||||
scikit-build-core, and cmake are used.
|
||||
|
||||
- {ref}`Linear algebra library <install_lapacke>`: BLAS, LAPACK, and LAPACKE
|
||||
- {ref}`OpenMP library <install_openmp>`: For the multithreding support.
|
||||
|
||||
These packages may be installed by the package manager of OS (e.g. `apt`) or
|
||||
conda environment. Automatic search of required libraries and flags that are
|
||||
already on the system is performed by cmake. If cmake is installed on the
|
||||
system, this automatic search is invoked as default. For the installation with
|
||||
custom configurations without using cmake, the environment variable
|
||||
`PHONO3PY_USE_CMAKE=false` has to be set.
|
||||
already on the system is performed by cmake.
|
||||
|
||||
(install_with_cmake)=
|
||||
### Build with automatic search of library configurations by cmake
|
||||
|
@ -56,57 +54,6 @@ See an example at {ref}`install_an_example`. In the standard output, flags and
|
|||
libraries found by cmake are shown. Please carefully check if those
|
||||
configurations are expected ones or not.
|
||||
|
||||
(install_custom)=
|
||||
### Build with custom library configurations by `site.cfg` file
|
||||
|
||||
Custom installation is achieved by creating `site.cfg` file on the same
|
||||
directory as `setup.py`. Users will write configurations of compiler flags and
|
||||
linked libraries in `site.cfg`. If `setup.py` finds `site.cfg`, the
|
||||
configurations are used as the default configurations. If cmake is found in the
|
||||
system, cmake tries to find required libraries and found configurations are
|
||||
appended. To deactivate cmake's library search, the environment variable
|
||||
`PHONO3PY_USE_CMAKE=false` has to be set before running the phono3py build:
|
||||
```
|
||||
% export PHONO3PY_USE_CMAKE=false
|
||||
```
|
||||
In previous versions, `site.cfg` was processed by numpy,
|
||||
but from version 2.4.0, it is processed by script in `setup.py`.
|
||||
`extra_link_args`, `extra_compile_args`, `extra_objects`, and `include_dirs` can
|
||||
be specified. How they used is found at [setuptools web
|
||||
site](https://setuptools.pypa.io/en/latest/userguide/ext_modules.html#extension-api-reference).
|
||||
|
||||
In most cases, users want to enable multithreading support with OpenMP. Its
|
||||
minimum setting with gcc as the compiler is:
|
||||
|
||||
```
|
||||
extra_compile_args = -fopenmp
|
||||
```
|
||||
|
||||
Additional configuration can be necessary. It is recommended first starting only
|
||||
with `extra_compile_args = -fopenmp` and run `setup.py`, then check if phono3py
|
||||
works properly or not without error or warning. When phono3py doesn't work with
|
||||
the above setting, add another configuration one by one to test compilation.
|
||||
Some examples are given below.
|
||||
|
||||
For MKL (for gcc and clang), `site.cfg`
|
||||
|
||||
```
|
||||
extra_compile_args = -fopenmp
|
||||
```
|
||||
|
||||
For openblas and clang
|
||||
|
||||
```
|
||||
extra_compile_args = -fopenmp
|
||||
```
|
||||
|
||||
For openblas and gcc
|
||||
|
||||
```
|
||||
extra_compile_args = -fopenmp
|
||||
extra_link_args = -lgomp
|
||||
```
|
||||
|
||||
(install_an_example)=
|
||||
|
||||
## Installation instruction of latest development version of phono3py
|
||||
|
@ -117,7 +64,8 @@ wrong python libraries can be imported.
|
|||
1. Download miniforge
|
||||
|
||||
Miniforge is downloaded at https://github.com/conda-forge/miniforge. The
|
||||
detailed installation instruction is found in the same page. If usual conda or miniconda is used, the following `~/.condarc` setting is recommended:
|
||||
detailed installation instruction is found in the same page. If usual conda
|
||||
or miniconda is used, the following `~/.condarc` setting is recommended:
|
||||
|
||||
```
|
||||
channel_priority: strict
|
||||
|
@ -148,7 +96,7 @@ wrong python libraries can be imported.
|
|||
For x86-64 system:
|
||||
|
||||
```bash
|
||||
% conda install numpy scipy h5py pyyaml matplotlib-base c-compiler "libblas=*=*mkl" spglib mkl-include cmake
|
||||
% conda install numpy scipy h5py pyyaml matplotlib-base c-compiler cxx-compiler "libblas=*=*mkl" spglib mkl-include cmake
|
||||
```
|
||||
|
||||
A libblas library can be chosen among `[openblas, mkl, blis, netlib]`. If
|
||||
|
@ -161,7 +109,7 @@ wrong python libraries can be imported.
|
|||
For macOS ARM64 system, currently only openblas can be chosen:
|
||||
|
||||
```bash
|
||||
% conda install numpy scipy h5py pyyaml matplotlib-base c-compiler spglib cmake openblas
|
||||
% conda install numpy scipy h5py pyyaml matplotlib-base c-compiler cxx-compiler spglib cmake openblas
|
||||
```
|
||||
|
||||
Note that using hdf5 files on NFS mounted file system, you may have to disable
|
||||
|
@ -179,10 +127,8 @@ wrong python libraries can be imported.
|
|||
% git clone https://github.com/phonopy/phonopy.git
|
||||
% git clone https://github.com/phonopy/phono3py.git
|
||||
% cd phonopy
|
||||
% git checkout develop
|
||||
% pip install -e . -vvv
|
||||
% cd ../phono3py
|
||||
% git checkout develop
|
||||
% pip install -e . -vvv
|
||||
```
|
||||
|
||||
|
@ -215,23 +161,6 @@ Ubuntu package manager (`liblapacke` and `liblapacke-dev`):
|
|||
% sudo apt-get install liblapack-dev liblapacke-dev
|
||||
```
|
||||
|
||||
### Compiling Netlib LAPACKE
|
||||
|
||||
The compilation procedure is found at the LAPACKE web site. After creating the
|
||||
LAPACKE library, `liblapacke.a` (or the dynamic link library), `setup.py` must
|
||||
be properly modified to link it. As an example, the procedure of compiling
|
||||
LAPACKE is shown below.
|
||||
|
||||
```bash
|
||||
% tar xvfz lapack-3.6.0.tgz
|
||||
% cd lapack-3.6.0
|
||||
% cp make.inc.example make.inc
|
||||
% make lapackelib
|
||||
```
|
||||
|
||||
BLAS, LAPACK, and LAPACKE, these all may have to be compiled with `-fPIC` option
|
||||
to use it with python.
|
||||
|
||||
(install_openmp)=
|
||||
## Multithreading and its controlling by C macro
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
@ -139,5 +137,6 @@ def main(args: argparse.Namespace):
|
|||
plot(args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def run():
|
||||
"""Run phono3py-coleigplot script."""
|
||||
main(get_options())
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (C) 2021 Atsushi Togo
|
||||
# All rights reserved.
|
||||
#
|
||||
|
@ -36,5 +34,7 @@
|
|||
|
||||
from phono3py.cui.kaccum_script import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
def run():
|
||||
"""Run phono3py-kaccum script."""
|
||||
main()
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
@ -350,5 +348,6 @@ def main(args):
|
|||
plt.close(fig)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def run():
|
||||
"""Run phono3py-kdeplot script."""
|
||||
main(get_options())
|
|
@ -34,4 +34,4 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
__version__ = "3.2.0"
|
||||
__version__ = "3.3.0"
|
||||
|
|
|
@ -26,9 +26,15 @@ Repository = "https://github.com/phonopy/phono3py"
|
|||
|
||||
[project.scripts]
|
||||
phono3py = "phono3py.scripts.phono3py:run"
|
||||
phono3py-load = "phonopy.scripts.phono3py_load:run"
|
||||
phono3py-load = "phono3py.scripts.phono3py_load:run"
|
||||
phono3py-coleigplot = "phono3py.scripts.phono3py_coleigplot:run"
|
||||
phono3py-kaccum = "phono3py.scripts.phono3py_kaccum:run"
|
||||
phono3py-kdeplot = "phono3py.scripts.phono3py_kdeplot:run"
|
||||
|
||||
|
||||
[tool.scikit-build]
|
||||
cmake.verbose = true
|
||||
logging.level = "INFO"
|
||||
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
|
||||
sdist.exclude = ["*"]
|
||||
sdist.include = [
|
||||
|
@ -43,7 +49,7 @@ sdist.include = [
|
|||
]
|
||||
|
||||
[tool.scikit-build.cmake.define]
|
||||
PHPHCALC_USE_MTBLAS = {env="PHPHCALC_USE_MTBLAS", default="OFF"}
|
||||
PHONO3PY_USE_MTBLAS = {env="PHONO3PY_USE_MTBLAS", default="ON"}
|
||||
USE_CONDA_PATH = {env="USE_CONDA_PATH", default="ON"}
|
||||
PHONO3PY_USE_OMP = {env="PHONO3PY_USE_OMP", default="ON"}
|
||||
|
||||
|
|
Loading…
Reference in New Issue