In this tutorial, I will show how to build a C++ compiling environment from raw CentOS linux. Specifically, OpenMPI and Boost Library is included in this environment.
First, use the following commands to update CentOS repositories
yum update -y
Then, group install the development tools in which gcc is included.
yum groupinstall "Development Tools" -y
Using the following command to install OpenMPI
yum install openmpi openmpi-devel -y
Since the default version of CMake in CentOS7 is rather old, we will install a relative new version. Below commands install some dependent libraries
yum install wget -y
yum install openssl-devel -y
Run the below commands to build and install CMake 3.17
wget https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0.tar.gz
tar -zxvf cmake-3.17.0.tar.gz
cd cmake-3.17.0
./bootstrap --prefix=/usr/local
make && make install
Now we start to download Boost Libary 1.68.0
wget https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
tar -zxvf boost_1_68_0.tar.gz
cd boost_1_68_0
Since we need Boost MPI library, make sure you load the OpenMPI module
source /etc/profile.d/modules.sh
module load mpi/openmpi-x86_64
Using the below command to compile and install Boost library
./bootstrap.sh
echo "using mpi ;" >> project-config.jam
./b2 threading=multi --with-program_options --with-filesystem --with-serialization --with-mp i --with-system install
Note the “using mpi ;” string is essential to tell Boost building script to compile Boost MPI Library. If you need other Boost libraries, just add the options –with-xxx where xxx is the library name.
Mission accomplished!
No comments:
Post a Comment