![]() |
cd hpx mkdir my_hpx_build cd my_hpx_build
cmake -DBOOST_ROOT=/root/of/boost/installation \ -DHWLOC_ROOT=/root/of/hwloc/installation [other CMake variable definitions] \ /path/to/source/tree
for instance:
cmake -DBOOST_ROOT=~/packages/boost -DHWLOC_ROOT=/packages/hwloc -DCMAKE_INSTALL_PREFIX=~/packages/hpx ~/downloads/hpx_0.9.9
gmake -j4
![]() |
Caution |
---|---|
Compiling and linking HPX needs a considerable amount of memory. It is advisable that approximately 2 GB of memory per parallel process is available. |
![]() |
Note |
---|---|
Many Linux distributions use |
gmake install
![]() |
Important |
---|---|
These commands will build and install the essential core components of HPX only. In order to build and run the tests, please invoke: gmake tests and in order to build (and install) all examples invoke: cmake -DHPX_BUILD_EXAMPLES=On . gmake examples gmake install |
For more detailed information about using CMake please refer its documentation and also the section Building HPX with CMake. Please pay special attention to the section about HPX_MALLOC as this is crucial for getting decent performance.
This section describes how to buildHPX for OS X (Mac) (with recent versions of Clang, libc++, and Boost).
The standard system compiler on OS X is too old to build HPX. You will have to install a newer compiler manually, either Clang or GCC. Below we describe two possibilities:
In order to build HPX you will need a fairly recent version of Clang
(at least version 3.2 of Clang and LLVM). For more instructions please see
[link http://clang.llvm.org/get_started.html here].
If you're using Homebrew, `brew install llvm --with-clang` will do the trick
and install 3.2 into `/usr/local/bin`.
In the guide below, I assume you're either using Clang 3.2 as installed by
Homebrew into /usr/local/bin, or that the following symlinks are created and
visible in your $PATH:
ln -s /path/to/build-llvm/Release/bin/clang++ clang++-3.3 ln -s /path/to/build-llvm/Release/bin/clang clang-3.3
(Replace /path/to
here with an absolute path of your liking.)
You need to use the trunk version; what's currently bundled with XCode or OS X aren't quite there yet. You can follow the steps in http://libcxx.llvm.org/ if you choose, but here's briefly how it can be built:
cd /path/to git clone http://llvm.org/git/libcxx.git cd libcxx/lib CXX=clang++-3.3 CC=clang-3.3 TRIPLE=-apple- ./buildit
or alternatively:
CXX=/usr/local/bin/clang++ CC=/usr/local/bin/clang TRIPLE=-apple- \ ./buildit
The library is then found in /path/to/libcxx/include
and
/path/to/libcxx/lib
, respectively
To build Boost with Clang and make it link to libc++ as standard library, you'll need to set up either of the following in your `~/user-config.jam` file:
# user-config.jam (put this file into your home directory) # ... # Clang 3.2 using clang : 3.2 : "/usr/local/bin/clang++" : <cxxflags>"-std=c++11 -stdlib=libc++ -fcolor-diagnostics -isystem /path/to/libcxx/include" <linkflags>"-stdlib=libc++ -L/path/to/libcxx/lib" ; # Clang trunk ("3.3" for convenience) using clang : 3.3 : "clang++-3.3" : <cxxflags>"-std=c++11 -stdlib=libc++ -fcolor-diagnostics -isystem /path/to/libcxx/include" <linkflags>"-stdlib=libc++ -L/path/to/libcxx/lib" ;
(Again, remember to replace /path/to
with whatever you
used earlier.)
You can then use as build command either:
b2 --build-dir=/tmp/build-boost --layout=versioned toolset=clang-3.2 install -j4
or
b2 --build-dir=/tmp/build-boost --layout=versioned toolset=clang-3.3 install -j4
we verifed this using Boost V1.53. If you use a different version,
just remember to replace /usr/local/include/boost-1_53
with whatever include prefix you had in your installation.
cd /path/to git clone https://github.com/STEllAR-GROUP/hpx.git mkdir build-hpx && cd build-hpx
To build with Clang 3.2, execute:
cmake ../hpx \ -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ \ -DCMAKE_C_COMPILER=/usr/local/bin/clang-3.3 \ -DBOOST_INCLUDE_DIR=/usr/local/include/boost-1_53 \ -DBOOST_LIBRARY_DIR=/usr/local/lib \ -DBOOST_SUFFIX=-clang-darwin32-mt-1_53 \ -DCMAKE_CXX_FLAGS="-isystem /path/to/libcxx/include" \ -DLINK_FLAGS="-L /path/to/libcxx/lib" make
To build with Clang 3.3 (trunk), execute:
cmake ../hpx \ -DCMAKE_CXX_COMPILER=clang++-3.3 \ -DCMAKE_C_COMPILER=clang-3.3 \ -DBOOST_INCLUDE_DIR=/usr/local/include/boost-1_53 \ -DBOOST_LIBRARY_DIR=/usr/local/lib \ -DBOOST_SUFFIX=-clang-darwin33-mt-1_53 \ -DCMAKE_CXX_FLAGS="-isystem /path/to/libcxx/include" \ -DLINK_FLAGS="-L /path/to/libcxx/lib" make
For more detailed information about using CMake please refer its documentation and to the section Building HPX with CMake for. Please pay special attention to the section about HPX_MALLOC as this is crucial for getting decent performance.
Alternatively, you can install a recent version of gcc as well as all required libraries via MacPorts:
Install CMake, gcc 4.8, and hwloc:
sudo port install gcc48 sudo port install hwloc
You may also want:
sudo port install cmake sudo port install git-core
Make this version of gcc your default compiler:
sudo port install gcc_select sudo port select gcc mp-gcc48
Build Boost manually (the Boost package of MacPorts is built with Clang, and unfortunately doesn't work with a GCC-build version of HPX):
wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.bz2 tar xjf boost_1_54_0.tar.bz2 pushd boost_1_54_0 export BOOST_ROOT=$HOME/boost_1_54_0 ./bootstrap.sh --prefix=$BOOST_DIR ./b2 -j8 ./b2 -j8 install export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$BOOST_ROOT/lib popd
Build HPX:
git clone https://github.com/STEllAR-GROUP/hpx.git mkdir hpx-build pushd hpx-build export HPX_ROOT=$HOME/hpx cmake -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_FORTRAN_COMPILER=gfortran \ -DCMAKE_C_FLAGS="-Wno-unused-local-typedefs" \ -DCMAKE_CXX_FLAGS="-Wno-unused-local-typedefs" \ -DBOOST_ROOT=$BOOST_ROOT \ -DHWLOC_ROOT=/opt/local \ -DCMAKE_INSTALL_PREFIX=$HOME/hpx \ $(pwd)/../hpx make -j8 make -j8 install export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$HPX_ROOT/lib/hpx popd
BOOST_ROOT
, HPX_ROOT
,
and DYLD_LIBRARY_PATH
(for both BOOST_ROOT
and HPX_ROOT
) every time you configure, build, or
run an HPX application.
cmake -DHPX_HAVE_PARCELPORT_MPI=ON \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_FORTRAN_COMPILER=gfortran \ -DMPI_C_COMPILER=openmpicc \ -DMPI_CXX_COMPILER=openmpic++ \ -DMPI_FORTRAN_COMPILER=openmpif90 \ -DCMAKE_C_FLAGS="-Wno-unused-local-typedefs" \ -DCMAKE_CXX_FLAGS="-Wno-unused-local-typedefs" \ -DBOOST_ROOT=$BOOST_DIR \ -DHWLOC_ROOT=/opt/local \ -DCMAKE_INSTALL_PREFIX=$HOME/hpx $(pwd)/../hpx
BOOST_ROOT
and HWLOC_ROOT
.
These (PATH) variables need to be set to point to the root folder
of your Boost and Portable Hardware
Locality (HWLOC) installations. It is recommended to set
the variable CMAKE_INSTALL_PREFIX
as well. This determines where the HPX libraries will be built
and installed. If this (PATH) variable is set, it has to refer
to the directory where the built HPX files
should be installed to.
CMAKE_BUILD_TYPE
(under the CMAKE
tree) is set to Debug
or Release
, according
to what you plan to do (alternatively, this variable can be set
to RelWithDebInfo
or MinSizeRel
).
The text area at the bottom of CMake GUI displays the output of
CMake. CMake prompts an error message in a separate dialog box
if a required dependency is not found.
For more detailed information about using CMake please refer its documentation and also the section Building HPX with CMake.
So far we only support BGClang for compiling HPX on the BlueGene/Q.
BGClang trac page <https://trac.alcf.anl.gov/projects/llvm-bgq>
_
./configure \ --host=powerpc64-bgq-linux \ --prefix=$HOME/install/hwloc \ --disable-shared \ --enable-static \ CPPFLAGS='-I/bgsys/drivers/ppcfloor -I/bgsys/drivers/ppcfloor/spi/include/kernel/cnk/' make make install
~/user-config.jam
file:
# user-config.jam (put this file into your home directory) using clang : : bgclang++11 : ;
You can then use this as your build command:
./bootstrap.sh ./b2 --build-dir=/tmp/build-boost --layout=versioned toolset=clang -j12
git clone git://github.com/STEllAR-GROUP/hpx.git
cmake -DHPX_PLATFORM=BlueGeneQ \ -DCMAKE_CXX_COMPILER=bgclang++11 \ -DMPI_CXX_COMPILER=mpiclang++11 \ -DHWLOC_ROOT=/path/to/hwloc/installation \ -DBOOST_ROOT=/path/to/boost \ -DHPX_MALLOC=system \ /path/to/hpx
make -j24 make install
This will build and install the essential core components of HPX only. Use:
make -j24 examples make -j24 install
to build and install the examples.
Adapt your ~/user-config.jam to contain the following lines:
## Toolset to be used for compiling for the host using intel : host : : <cxxflags>"-std=c++0x" ; ## Toolset to be used for compiling for the Xeon Phi using intel : mic : : <cxxflags>"-std=c++0x -mmic" <linkflags>"-std=c++0x -mmic" ;
Change to the directory you unpacked boost in (from now on referred to as $BOOST_ROOT) and execute the following commands:
./bootstrap.sh ./b2 toolset=intel-mic -j<N>
You should now have all the required boost libraries.
Run the configure-make-install procedure as follows:
CC=icc CFLAGS=-mmic CXX=icpc CXXFLAGS=-mmic LDFLAGS=-mmic ./configure --host=k1om --prefix=$HWLOC_ROOT make make install
You now have a working hwloc installation in $HWLOC_ROOT.
After all the prerequistes have been succesfully installed, we can now start building and installing HPX. The build procedure is almost the same as for How to Install HPX on Unix Variants with the sole difference that you have to enable the Xeon Phi in the CMake Build system. This is achieved by invoking CMake in the following way:
cmake \ -T/path/to/hpx/cmake/toolchains/XeonPhi.cmake \ -DBOOST_ROOT=$BOOST_ROOT \ -DHWLOC_ROOT=$HWLOC_ROOT \ /path/to/hpx
For more detailed information about using CMake please refer its documentation and to the section Building HPX with CMake. Please pay special attention to the section about HPX_MALLOC as this is crucial for getting decent performance on the Xeon Phi.