Minor update on installation

This commit is contained in:
Atsushi Togo 2017-06-07 14:45:41 +02:00
parent 710a7a866e
commit 24990d6e66
3 changed files with 84 additions and 32 deletions

View File

@ -4,22 +4,42 @@ Installation
=============
.. contents::
:depth: 2
:depth: 3
:local:
System requirement
-------------------
**Phono3py-1.11.7 depends on phonopy-1.11.6 or later.** So the
installation of phonopy before the installation of phono3py is
Installation of phonopy before the installation of phono3py is
required. See how to install phonopy at
https://atztogo.github.io/phonopy/install.html .
https://atztogo.github.io/phonopy/install.html. Phono3py relies on
phonopy, so please use the latest release of phonopy when installing
phono3py.
From source code
-----------------
When installing phono3py using ``setup.py`` from the source code, a
few libraries are required before running ``setup.py`` script.
For phono3py, OpenMP library is necessary for the multithreding
support. In the case of the GNU OpenMP library, the library name may
be ``libgomp1``. In additon, LAPACK and LAPACKE are also needed. These
packages are probably installed using the package manager for each
OS. In the case of ubuntu linux, it would be like::
support. In additon, BLAS, LAPACK, and LAPACKE are also needed. These
packages are probably installed using the package manager for each OS
or conda.
When using gcc to compile phono3py, ``libgomp1`` is necessary to
enable OpenMP multithreading support. This library is probably
installed already in your system. If you don't have it and you use
Ubuntu linux, it is installed by::
% sudo apt-get install libgomp1
Installation of necessary libraries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here two ways to install necessary libraries are introduced.
By Ubuntu package manager
^^^^^^^^^^^^^^^^^^^^^^^^^^
In the case of ubuntu linux, it would be like::
% sudo apt-get install libgomp1 liblapack-dev liblapacke-dev
@ -44,26 +64,32 @@ it. As an example, the procedure of compiling LAPACKE is shown below.
BLAS, LAPACK, and LAPACKE, these all may have to be compiled
with -fPIC option to use it with python.
Multithreading support
------------------------
By conda
^^^^^^^^^
Phono3py supports OpenMP multithreading and most users will need it,
otherwise the calculation may take long time. The library options used
for GCC, ``-lgomp`` and ``-fopenmp``, are written in ``setup.py``,
but for the other compilers, you may have to change them. If you need
to compile without the OpenMP support, you can remove these options in
``setup.py``.
The installtion of LAPACKE is easy by conda. It is::
Install using pip/conda
------------------------
% conda install openblas
PyPI and conda packages are prepared at phonopy and phono3py
releases. Using these packages, the phonopy and phono3py installations
are expected to be easily done. For more detail, see
https://atztogo.github.io/phonopy/install.html .
or if the python libraries are not yet installed::
% conda install openblas numpy scipy h5py pyyaml matplotlib
This openblas package contains BLAS, LAPACK, and LAPACKE.
..
Multithreading support
------------------------
Phono3py supports OpenMP multithreading and most users will need it,
otherwise the calculation may take long time. The library options used
for GCC, ``-lgomp`` and ``-fopenmp``, are written in ``setup.py``,
but for the other compilers, you may have to change them. If you need
to compile without the OpenMP support, you can remove these options in
``setup.py``.
Building using setup.py
------------------------
~~~~~~~~~~~~~~~~~~~~~~~~
If package installation is not possible or you want to compile with
special compiler or special options, phono3py is built using
@ -91,11 +117,11 @@ already a user of phonopy, ``PYTHONPATH`` for the original phonopy
version has to be removed. The ``PYTHONPATH`` setting depends on
shells that you use. For example in bash or zsh::
export PYTHONPATH=~/phono3py-1.11.3/lib/python
export PYTHONPATH=~/phono3py-1.11.11/lib/python
or::
export PYTHONPATH=$PYTHONPATH:~/phono3py-1.11.3/lib/python
export PYTHONPATH=$PYTHONPATH:~/phono3py-1.11.11/lib/python
Phono3py command is installed under ``bin`` directory. The location of
``bin`` directory is depending on ``--user`` or ``--home`` scheme when
@ -104,3 +130,12 @@ operation system, e.g., ``~/.local/bin`` for Ubuntu linux and
``~/Library/Python/2.7`` for Mac (& python2.7). In the latter case,
``bin`` directory is found on the current directory if it was
``--home=.``.
Install using pip/conda
------------------------
PyPI and conda packages are prepared at phonopy and phono3py
releases. Using these packages, the phonopy and phono3py installations
are expected to be easily done. For more detail, see
https://atztogo.github.io/phonopy/install.html .

View File

@ -354,6 +354,13 @@ cutoff_frequency = conf['cutoff_frequency']
symprec = options.symprec
# Check supercell size
if supercell_matrix is None:
print_error_message("Supercell dimension (--dim) has to be specified.")
if log_level > 0:
print_end()
sys.exit(0)
#################################################
# Create supercells with displacements and exit #
#################################################

View File

@ -82,20 +82,30 @@ elif os.path.isfile("libopenblas.py"):
extra_compile_args += ['-DMULTITHREADED_BLAS']
else:
define_macros += [('MULTITHREADED_BLAS', None)]
elif platform.system() == 'Darwin':
# For MacPort
elif (platform.system() == 'Darwin' and
os.path.isfile('/opt/local/lib/libopenblas.a')):
# For MacPort:
# % sudo port install gcc6
# % sudo port select --set gcc mp-gcc
# % sudo port install OpenBLAS +gcc6
extra_link_args_lapacke = ['/opt/local/lib/libopenblas.a']
include_dirs_lapacke = ['/opt/local/include']
library_dirs_lapacke = []
else:
elif os.path.isfile('/usr/lib/liblapacke.so'):
# This is when lapacke is installed on system
extra_link_args_lapacke = ['-llapacke', '-llapack', '-lblas']
include_dirs_lapacke = []
library_dirs_lapacke = []
else:
# For conda: Try dynamic link library of openblas
# % conda install numpy scipy h5py pyyaml matplotlib openblas
extra_link_args_lapacke = ['-lopenblas']
include_dirs_lapacke = []
library_dirs_lapacke = []
if use_setuptools:
extra_compile_args += ['-DMULTITHREADED_BLAS']
else:
define_macros += [('MULTITHREADED_BLAS', None)]
## Uncomment below to measure reciprocal_to_normal_squared_openmp performance
# define_macros += [('MEASURE_R2N', None)]