From b86ea37eebb2f5a9d64a8f122edd68e6d131bde1 Mon Sep 17 00:00:00 2001 From: Tuomo Salmi Date: Fri, 1 Dec 2023 12:36:51 +0100 Subject: [PATCH] Installation instructions updated (#352) * Comments on mpif90 compiler when installing MultiNest * Sphinx version upper limit given. * Better cleaning of previous installation Including rayXpanda object files * Requirement for mpich added. * Numpy forced to be below 2.0.0 * GSL installation using conda --- basic_environment.yml | 2 +- docs/source/install.rst | 80 ++++++++++++----------------------------- 2 files changed, 24 insertions(+), 58 deletions(-) diff --git a/basic_environment.yml b/basic_environment.yml index 3948e502..6c0cdf63 100644 --- a/basic_environment.yml +++ b/basic_environment.yml @@ -2,7 +2,7 @@ name: xpsi_py3 channels: - defaults dependencies: - - numpy + - numpy < 2.0.0 - cython ~= 0.29 - matplotlib - scipy diff --git a/docs/source/install.rst b/docs/source/install.rst index fc59261b..fada4fc1 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -43,7 +43,7 @@ contents are: channels: - defaults dependencies: - - numpy + - numpy < 2.0.0 - cython ~= 0.29 - matplotlib - scipy @@ -90,7 +90,13 @@ Activate the environment as: **ALL THE FOLLOWING STEPS SHOULD BE PERFORMED IN THIS NEWLY CREATED ENVIRONMENT.** Pay special attention to reactivate the environment if you ever have to restart the kernel. - + +We start by installing the GNU Scientific Library (GSL): + +.. code-block:: bash + + conda install gsl + Next, install `mpi4py `_ which is required for nested sampling: @@ -139,21 +145,10 @@ In addition, some optional miscellaneous packages are: Prerequisite Non-Python Packages and PyMultiNest ------------------------------------------------ -X-PSI has several dependencies that are not Python packages, +X-PSI has dependencies that are not Python packages, or which are Python packages but need to be installed from source (PyMultiNest). Build and install guidelines are given below. -GSL -^^^ - -GSL is the GNU Scientific Library. To obtain the latest -`GSL `_ source code (otherwise ``v2.5`` -works): - -.. code-block:: bash - - wget -v http://mirror.koddos.net/gnu/gsl/gsl-latest.tar.gz - .. note:: The next steps require an `OpenMP `_-enabled C @@ -161,32 +156,6 @@ works): linux systems come with `GCC `_ built-in. To find out the GCC path-executable on your system, run ``which gcc``. -Untar, navigate to the directory (e.g., ``cd gsl-latest``), and -then build and install: - -.. code-block:: bash - - ./configure CC= --prefix=$HOME/gsl - make - make check - make install - make installcheck - make clean - -This will install the library in your ``$HOME``, as an example. Next, add GSL -to your path by adding the following line to ``~/.bashrc``: - -.. code-block:: bash - - export PATH=$HOME/gsl/bin:$PATH - -You can check the prefix and version of GSL on your path: - -.. code-block:: bash - - gsl-config --version - gsl-config --prefix - .. _multinest: @@ -203,12 +172,6 @@ To build the MultiNest library, you require an MPI-wrapped Fortran compiler (e.g., `openmpi-mpifort `_ from Open MPI). -.. note:: - - The following assumes you have installed mpi4py. If you - have not already installed it through the ``environment.yml`` file, you may - do so e.g. via ``conda install -c conda-forge mpi4py``. - Prerequisites for MultiNest are c and fortran compilers (e.g. ``gcc`` and ``gfortran``), ``cmake``, ``blas``, ``lapack``, and ``atlas``. In case missing them, they can be installed by: @@ -217,6 +180,12 @@ compilers (e.g. ``gcc`` and ``gfortran``), ``cmake``, ``blas``, ``lapack``, and sudo apt-get install cmake libblas-dev liblapack-dev libatlas-base-dev +To have MPI-wrapped compilers, one should also install ``mpich`` if not installed already: + +.. code-block:: bash + + sudo apt install mpich + Assuming these libraries are available, first clone the repository, then navigate to it and build: @@ -226,10 +195,14 @@ then navigate to it and build: cd /multinest/MultiNest_v3.12_CMake/multinest/ mkdir build cd build - CC=gcc FC=mpif90 CXX=g++ cmake -DCMAKE_{C,CXX}_FLAGS="-O3 -march=native -funroll-loops" -DCMAKE_Fortran_FLAGS="-O3 -march=native -funroll-loops" .. + CC=gcc FC=mpif90 CXX=g++ cmake -DCMAKE_{C,CXX}_FLAGS="-O3 -march=native -funroll-loops" -DCMAKE_Fortran_FLAGS="-O3 -march=native -funroll-loops" .. make ls ../lib/ +.. note:: + + We note that new default mpif90 created by mpi4py conda installation may not work here. Thus, one needs to point the path to the native mpif90 compiler of the system (e.g. ``CC=gcc FC=/usr/bin/mpif90 CXX=g++ ...``) or install mpi4py only after MultiNest has been installed and use then ``FC=mpif90``. + Now you need the Python interface to MultiNest: .. code-block:: bash @@ -278,13 +251,6 @@ For ``icc``, you may need to prepend this command with ``LDSHARED="icc -shared"``. This ensures that both the compiler and linker are Intel, otherwise the ``gcc`` linker might be invoked. -Provided the GSL ``/bin`` is in your ``PATH`` -environment variable, the X-PSI ``setup.py`` script will automatically use the -``gsl-config`` executable to link the shared libraries and give the required -C flags for compilation of the X-PSI extensions. Because the library location -will not change for runtime, we state the runtime linking instructions at -compilation in the ``setup.py`` script. - A quick check of the X-PSI installation can be done with ``import xpsi``, which should print to screen something like the following: @@ -293,7 +259,7 @@ should print to screen something like the following: /=============================================\ | X-PSI: X-ray Pulse Simulation and Inference | |---------------------------------------------| - | Version: 2.1.0 | + | Version: 2.1.1 | |---------------------------------------------| | https://xpsi-group.github.io/xpsi | \=============================================/ @@ -348,7 +314,7 @@ If you ever need to reinstall, first clean to recompile the C files: .. code-block:: bash - rm -r build dist *egg* xpsi/*/*.c + rm -r build dist *egg* xpsi/*/*.c xpsi/include/rayXpanda/*.o Alternatively, to build X-PSI in-place: @@ -370,7 +336,7 @@ these, run the following command: .. code-block:: bash - conda install sphinx + conda install "sphinx<7.0" conda install -c conda-forge nbsphinx conda install decorator conda install sphinxcontrib-websupport