0%

SMILI 安装说明

SMILI 安装说明

安装依赖

1
2
3
$ sudo apt install x11*
$ sudo apt install libxt-dev
$ sudo apt install libopenblas-dev

安装 OpenBLAS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Clone the current repository
git clone https://github.com/xianyi/OpenBLAS

# Compile and install
# macOS MacPorts users may not use USE_OPENMP=1 option, and need to omit it.
cd OpenBLAS
make USE_OPENMP=1 CC=gcc FC=gfortran
make PREFIX="~/local" install

# 确认是否安装正确
# 是否有输出
$ pkg-config --debug openblas

# 如果没有,增加pkg的path
export PKG_CONFIG_PATH=~/local/lib/pkgconfig:$PKG_CONFIG_PATH

安装FFTW3

1
2
3
4
5
$ apt install fftw*

# 确认是否安装正确
# 是否有输出
$ pkg-config --debug fftw3

安装 FINUFFT

1
2
3
4
# 下载源码
$ cd ~/local
$ git clone https://github.com/flatironinstitute/finufft
$ cd finufft

准备make.inc文件,内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Compilers
CXX=g++
CC=gcc
FC=gfortran

# (compile flags for use with GCC are as in linux makefile)
CFLAGS +=

# If you're getting warning messages of the form:
# ld: warning: object file (lib-static/libfinufft.a(finufft1d.o)) was built for
# newer OSX version (10.13) than being linked (10.9)
# Then you can uncomment the following two lines with the older version number
# (in this example -mmacosx-version-min=10.9)
#
#CFLAGS += "-mmacosx-version-min=<OLDER OSX VERSION NUMBER>"

# if you are macOS homebrew users, uncomment this.
# (assuming that /usr/local is your homebrew's PREFIX)
#CFLAGS += -I src -I/usr/local/include
#LIBS += -L/usr/local/lib

# if you are macOS MacPorts users, uncomment this.
# (assuming that /opt/local is your MacPorts' PREFIX)
#CFLAGS += -I src -I/opt/local/include
#LIBS += -L/opt/local/lib

# Your FFTW3's installation PREFIX
CFLAGS += -I$HOME/local/include
LIBS += -L$HOME/local/lib

# You can keep them
FFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS) -DNEED_EXTERN_C

# OpenMP with GCC on OSX needs following...
OMPFLAGS = -fopenmp
OMPLIBS = -lgomp
# since fftw3_omp doesn't work in OSX, you need to uncomment this
#FFTWOMPSUFFIX=threads

开始编译库

1
$ make lib

新建finufft.pc文件,内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
# This is an example pkg-config file. Here is an brief instruction.
# (1) Please change finufftdir depending on your install directory.
# (2) please change its filename to finufft.sample.pc and
# copy to a directory specified in $PKG_CONFIG_PATH
finufftdir=$(HOME)/local/finufft
libdir=${finufftdir}/lib-static
includedir=${finufftdir}/include

Name: FINUFFT
Description: Flatiron Institute Nonuniform Fast Fourier Transform libraries
Version: github
Libs: -L${libdir} -lfinufft
Cflags: -I${includedir}

确认是否安装完毕

1
2
3
4
5
6
# 确认是否安装正确
# 是否有输出
$ pkg-config --debug finufft

# 如果没有,增加pkg的path
export PKG_CONFIG_PATH=~/local/finufft/:$PKG_CONFIG_PATH

安装SMILI

1
2
3
4
5
6
# Clone the repository
$ git clone https://github.com/astrosmili/smili
$ cd smili
# 通过conda创建虚拟环境,不然编译会有问题
$ ./configure
$ make install
处无为之事,行不言之教;作而弗始,生而弗有,为而弗恃,功成不居!

欢迎关注我的其它发布渠道