@sculxb
2017-12-13T17:40:27.000000Z
字数 5699
阅读 3307
ubuntu
软件安装
安装libxc之后的提示
Libraries have been installed in:
/opt/etsf/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
这里最后的解决方式是在configure的时候加上安装位置
./configure --prefix=/home/cris/software/lib/libxc-3.0.0/bin
#这里本来使用的4.0的版本但是后来发现使用4.0的版本会碰到报错
../../src/hamiltonian/libhamiltonian.a(xc.o):在函数‘calc_tb09_c.10006’中:
xc_oct.f90:(.text+0x2693):对‘xc_f90_mgga_x_tb09_set_par_’未定义的引用
../../src/hamiltonian/libhamiltonian.a(xc.o):在函数‘__xc_oct_m_MOD_xc_get_vxc’中:
xc_oct.f90:(.text+0x1e3dc):对‘xc_f90_gga_lb_set_par_’未定义的引用
xc_oct.f90:(.text+0x1e40d):对‘xc_f90_gga_lb_set_par_’未定义的引用
../../src/hamiltonian/libhamiltonian.a(functionals.o):在函数‘__xc_functl_oct_m_MOD_xc_functl_init_functl’中:
functionals_oct.f90:(.text+0x15da):对‘xc_f90_lda_c_xalpha_set_par_’未定义的引用
functionals_oct.f90:(.text+0x17b5):对‘xc_f90_lda_c_1d_csc_set_par_’未定义的引用
functionals_oct.f90:(.text+0x17d5):对‘xc_f90_lda_c_2d_prm_set_par_’未定义的引用
functionals_oct.f90:(.text+0x18e9):对‘xc_f90_lda_x_1d_set_par_’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:615: recipe for target 'octopus' failed
make[3]: *** [octopus] Error 1
make[3]: Leaving directory '/home/cris/software/octopus-7.1/src/main'
Makefile:448: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/cris/software/octopus-7.1/src'
Makefile:495: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/cris/software/octopus-7.1'
Makefile:436: recipe for target 'all' failed
make: *** [all] Error 2
后再在https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825934上发现这是一个bug就换成3.0版本就没问题了
gcc sin.c -Im -L/lib -L/usr/lib # -I 加入某个函数库的意思 m 代表libm这个库(lib与.a或.so不用写)
-L 后面的路径代表在这个路径里寻找
.a 表示静态库 编译的时候会直接整合到执行程序当中
.so 动态函数库 不整合到执行程序当中,在编译时只有一个 Pointer 函数库在执行时必须存在而且所在目录也不能变
/etc/ld.so.conf 动态库缓存目录
ldconfig -p 列出缓存中的库
./configure --prefix=/usr/local/supersparrow 表示安装完成将自动生成目录supersparrow,而且该软件所有的文件都被复制到这个目录
ln -s 源文件 目标文件
###当我们需要在不同的目录,用到相同的文件时,我们不需要在每一个需要的目录下都放一个必须相同的文件,我们只要在某个固定的目录,放上该文件,然后在 其它的目录下用ln命令链接(link)它就可以,不必重复的占用磁盘空间
ln -s log2013.log link2013
改configure 把输出Could not find libxc 前面的if判断xyes改成xno
下载解压然后make
然后在configure的时候加上
--with-blas=/home/cris/software/lib/BLAS-3.8.0/blas_LINUX.a
下载解压
cp make.inc.example make.inc
make
遇到错误
recipe for target 'znep.out' failed
recipe for target 'lapack_testing' failed
但是已经生成了lapack.a 库文件,这里应该是make最后它会测试一下,而测试用的输入文件和输出文件不是编译需要生成的目标,所以这个报错不算是一个严格意义上的报错
这个时候configure遇到一个问题就是加两个--with-××的时候复制进去就直接执行了,后来发现是因为./configure后面没有加空格 加个空格然后在--with-***就可以了
先创建bin文件夹
mkdir bin
./configure --prefix=/home/cris/software/lib/gsl-2.0/bin
make
make install ##注意这里不能加DESTDIR=/home/cris/software/lib/gsl-2.0/bin因为这句的作用跟前面prefix是重合的
下载稳定版本解压
新建bin文件夹
./configure --prefix=/home/cris/software/lib/mpich-3.2.1/bin
make
make install
./configure --prefix=/home/cris/software/octopus-7.1/ --with-libxc-prefix=/home/cris/software/lib/libxc-3.0.0/bin --with-blas=/home/cris/software/lib/BLAS-3.8.0/blas_LINUX.a --with-lapack=/home/cris/software/lib/lapack-3.8.0/liblapack.a --with-gsl-prefix=/home/cris/software/lib/gsl-2.0/bin --with-fftw-prefix=/home/cris/software/lib/fftw-3.3.7/bin --enable-mpi FC=/home/cris/software/lib/mpich-3.2.1/bin/bin/mpif90 CC=/home/cris/software/lib/mpich-3.2.1/bin/bin/mpicc
注意每个不连续的标签之间只能隔一个空格,否则就会刚复制进去就开始执行
make check
遇到问题
error while loading shared libraries: libgsl.so.0:
找不到共享库libgsl,但是我们明明已经安装了,没有办法,只能把这个共享库路径添加到系统共享库路径里边去
sudo vi /etc/ld.so.conf
加上一行
/home/cris/software/lib/gsl-2.0/bin/lib
然后退出执行ldconfig就把这个共享库加载到缓存里去了
make check
warning: libmpi.so.12, needed by /home/cris/software/lib/mpich-3.2.1/bin/lib/libmpifort.so, may conflict with libmpi.so.20
在ubuntu上面可以直接通过apt-get 的方式来安装
sudo apt install libxc-dev
sudo apt install libblas-dev libscalapack-mpi-dev
sudo apt install liblapack-dev
sudo apt install libfftw3-dev
./configure
make
makecheck
输入文件为
CalculationMode = gs
Units = eV_Angstrom
FromScratch = yes
Boxshape = minimum
Radius = 6.0
Spacing = 0.2
XYZCoordinates = "adjusted.xyz"
%Species
'Ag' | 107.8682 | spec_ps_hgh | 47 | 2 | 0
%
Output =dos+ density
OutputHow = xcrysden
在当前文件夹下面输入
mpirun -np 4 octopus
结果不幸报错
Parser error: symbol 'spec_ps_hgh' used before being defined.
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
-------------------------------------------------------
Parser error: symbol 'spec_ps_hgh' used before being defined.
--------------------------------------------------------------------------
mpirun detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:
Process name: [[11048,1],0]
Exit code: 1
--------------------------------------------------------------------------
google了一下发现是输入文件里边指定的spec_ps_hgh被改变了识别不了,就换成官方提供的小例子
CalculationMode = gs
%Coordinates
'H' | 0 | 0 | 0
%
就可以看到跑起来啦 :)
mpirun -np 4 octopus &> out.log
在后边加上'> out.log'就可以不在屏幕输出,全部输出到这个out.log的文件中去,当然文件名可以自己随便指定
然后就照着http://octopus-code.org/wiki/Tutorial上面多尝试例子就好啦
mpiexec_mu01: cannot connect to local mpd (/tmp/mpd2.console_xbLiu)
百度一下发现时mpd没有启动,输入
mpdboot
解决之
还有找不到gsl库的问题,这个需要在root权限下将之前安装的gsl动态库加载到缓存库中去,在root权限下
vi /etc/ld.so.conf
#后面加上你的gsl里边那个动态库的地址(注意是你动态库的地址不是gsl整个库的地址,一般前者在后者的lib/文件夹下面)
然后执行
ldconfig
就好了