Install SHTOOLS: Difference between revisions
| Line 66: | Line 66: | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$HOME/usr/lib" |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$HOME/usr/lib" |
||
make python2 LAPACK="-L/usr/lib64 -llapack" BLAS=" |
make python2 LAPACK="-L/usr/lib64 -llapack" BLAS="-lblas" FFTW="-L$HOME/usr/lib -lfftw3" |
||
The output should be something look like [https://shtools.oca.eu/shtools/www/makeout.html this]. Then your package is ready for using. |
The output should be something look like [https://shtools.oca.eu/shtools/www/makeout.html this]. Then your package is ready for using. |
||
== Examples for using SHTOOLS in python == |
== Examples for using SHTOOLS in python == |
||
Revision as of 07:33, 27 December 2016
SHTOOLS is a package for spherical harmonics transformation and reconstructions. The current version (SHTOOLS3.4) is available in python and Fortran 95. In this article, we are introducing the installation of SHTOOLS python packages on your own computer and mc2 cluster.
How to Install SHTOOLS on Your Own Computer
On Mac or Linux, you will need to have fortran compiler, lapack/blas, and fftw3 available. This can be done simply by running the following commands with homebrew on Mac:
brew install fftw --with-fortran
or Linux:
sudo apt-get install libblas-dev liblapack-dev g++ gfortran libfftw3-dev tcsh
If you have installed python and the package manager pip, you can install the shtools directly by running the command:
pip install pyshtools
Then if you run command:
pip list
You will see pyshtools library is available in your python packages.
How to Install SHTOOLS on mc2
On mc2 cluster, since we can only install packages for user only, we are not allowed to use sudo command to install the required packages. We need to compile the packages by our own.
For compiling shtools, the required packages are fftw3, lapack, and blas. Libraries for lapack and blas are available on mc2, we can use them directly for compiling shtools. For installing fftw3, please refer to Install_FFTW3 for more details.
After you followed the steps in FFTW3 installation (Serial only), you should have all the fftw3 libraries available:
~/usr/include/fftw3.h ~/usr/include/fftw3.f ~/usr/lib/libfftw3.a ~/usr/lib/libfftw3.la ~/usr/lib/libfftw3.so
And also, run:
ls /usr/lib64
The libraries for lapack and blas should be available here:
/usr/lib64/liblapack.a /usr/lib64/liblapack.so /usr/lib64/liblapack.so.3 ... /usr/lib64/libblas.a /usr/lib64/libblas.so /usr/lib64/libblas.so.3 ...
Also before you proceed, make sure to load the python module (we use python 2 as an example):
module load python/2.7.8 (Whichever is available)
Then you are ready to install shtools on your mc2 account.
First, download the shtools source package from Releases
cd ~/soft wget https://github.com/SHTOOLS/SHTOOLS/archive/v3.4.tar.gz tar -zxvf v3.4.tar.gz cd SHTOOLS-3.4
Then, indicate the libraries and compile the source code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$HOME/usr/lib" make python2 LAPACK="-L/usr/lib64 -llapack" BLAS="-lblas" FFTW="-L$HOME/usr/lib -lfftw3"
The output should be something look like this. Then your package is ready for using.