We suggest two different ways to build or install AmgXWrapper.
Since AmgXWrapper doesn't have a lot of code or complex hierarchy, it's very
easy to include the source code in the building process of your applications.
The poisson
and solveFromFiles
in the folder example
belong to this use
case.
AmgXWrapper can be compiled and built as a library and can be installed to a
user's preferred path. We provide CMakeLists.txt
for this purpose.
Our CFD solver, PetIBM is an example
of using AmgXWrapper as a library.
At any location you like, make a temporary folder to held compiled files and then go into that folder. For example,
$ mkdir ${HOME}/build
$ cd ${HOME}/build
Run CMake.
$ cmake \
-D CMAKE_INSTALL_PREFIX=${PATH_TO_WHERE_YOU_WANT_TO_INSTALL_AmgXWrapper} \
-D PETSC_DIR=${PATH_TO_PETSC} \
-D PETSC_ARCH=${THE_BUILD_OF_PETSC_YOU_WANT_TO_USE} \
-D CUDA_DIR=${PATH_TO_CUDA} \
-D AMGX_DIR=${PATH_TO_AMGX} \
${PATH_TO_AmgXWrapper_SOURCE}
Other optional CMake parameters are:
-
CUDA_HOST_COMPILER
: the underlying C compiler for CUDA compilernvcc
. If the default C compiler is too new for CUDA, users may need to use this parameter to choose an older version of C compiler. -
CMAKE_C_COMPILER
: the default ismpicc
. This is the C compiler used to compile C codes in AmgXWrapper. If a user wants to change the underlying C compiler used by MPI compiler, he/she should instead use the environment variableOMPI_MPICC
for this purpose. See Compiling MPI applications. -
CMAKE_CXX_COMPILER
: the default ismpicc
. This is the C++ compiler used to compile C++ codes in AmgXWrapper. If a user wants to change the underlying C++ compiler used by MPI compiler, he/she should instead use the environment variableOMPI_MPICXX
for this purpose. See Compiling MPI applications. -
CMAKE_BUILD_TYPE
: the default isRELEASE
.RELEASE
mode will use the flags-O3 -DNDEBUG
. Another option isDEBUG
, which is using flag-g
. -
CMAKE_CXX_FLAGS
andCMAKE_C_FLAGS
: set customized flags here if desired. -
BUILD_SHARED_LIBS
: the default isON
. This will create a shared librarylibAmgXWrapper.so
. To create a static library (libAmgXWrapper.a) only, set this argument toOFF
.
Build the library.
$ make -j <number of threads used to compiling>
If Doxygen exists, and if CMake is able to find Doxygen, the API documentation can be built with
$ make doc
This will build a HTML version of API documentation. The homepage is at
doc/html/index.html
under the build directory before installation.
Install the library, header, and documents to your preferred location.
$ make install
After installation, the build directory can be safely deleted. For example,
here we can delete ${HOME}/build
.
Under the installation location, lib
(or lib64
, depends on the system)
contains the library, libAmgXWrapper.so
or libAmgXWrapper.a
. The header file
AmgXSolver.hpp
will be in the folder include
, and the documents (if available)
will be in the folder doc
.