chempeng

almaBTE 1.3.2 离线安装

chempeng / 2021-01-14


环境准备,intel 全家桶、cmake、hdf5-1.8.20 boost-1.68.0

  1. 编译 hdf5
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.20/src/hdf5-1.8.20.tar.bz2 #集群若无法联网,自行下载导入服务器
tar -jxvf hdf5-1.8.20.tar.bz2
cd hdf5-1.8.20
./configure --prefix=/xxx/hdf5-1.8.20 --enable-cxx
make
make isntall

可在 make 后使用 make check 检查安装是否成功,安装完成后在安装目录 hdf5-1.8.20/lib 下检查是否生成 libhdf5_cpp.so,加入环境变量

export PATH=$PATH:/xxx/hdf5-1.8.20/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/xxx/hdf5-1.8.20/lib
export CPATH=$CPATH:/xxx/hdf5-1.8.20/include
  1. 编译 boost
wget https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2
tar -jxvf boost_1_68_0.tar.bz2
cd boost_1_68_0
./bootstrap.sh --prefix=/xxx/boost_1_68_0

生成 project-config.jam,编辑该文加,在末尾加入 using mpi ; ,路径可通过 which mpicc 查询,加入,

using mpi : /xxx/bin/mpicc ;

继续编译,

./b2
./b2 install

编译完成后,检查安装目录下存在 libboost_mpi.so、libboost_mpi.a 等。

  1. 编译 almaBTE
wget http://www.almabte.eu/wp-content/uploads/2018/10/almabte-v1.3.2.tar.gz
tar -zxvf almabte-v1.3.2.tar.gz
cd almabte-v1.3.2

修改 CMakeLists.txt,寻找 # Find some components from Boost# Try to find hdf5 in the system ,修改如下,

# Find some components from Boost.
set(BOOST_ROOT "/xxx/boost_1_68_0") #安装目录
find_package(Boost COMPONENTS system filesystem mpi serialization log REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})
add_definitions(-DBOOST_LOG_DYN_LINK)
set(Boost_USE_MULTITHREADED OFF)

# Try to find hdf5 in the system.
set(HDF5_ROOT "/xxx/hdf5-1.8.20") #安装目录
find_package(HDF5 COMPONENTS C CXX REQUIRED)
add_definitions(${HDF5_DEFINITIONS})
include_directories(${HDF5_INCLUDE_DIRS})
link_directories(${HDF5_LIBRARY_DIRS})
set(HDF5_LIBS ${HDF5_C_LIBRARIES} ${HDF5_CXX_LIBRARIES})

继续编译,

mkdir build
cd build
cmake ..
make all
make test # 最后显示 100% tests passed, 0 tests failed out of 35,编译成功

测试通过,安装完成

  1. Reference