Skip to content

Commit 9d83617

Browse files
committed
Merge pull request #176 from torbjoernk/feature/for-juqueen
getting up and running on JUQUEEN
2 parents 690b095 + 0e6285e commit 9d83617

File tree

10 files changed

+160
-36
lines changed

10 files changed

+160
-36
lines changed

3rdparty/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ message(STATUS "----------------------------------------------------------------
1010
message(STATUS "Boost")
1111

1212
set(Boost_USE_MULTITHREADED ON)
13+
if(${pfasst_BUILD_SHARED_LIBS})
14+
set(Boost_USE_STATIC_LIBS OFF)
15+
else()
16+
set(Boost_USE_STATIC_LIBS ON)
17+
endif()
1318
set(Boost_ADDITIONAL_VERSIONS "1.57" "1.57.0" ${Boost_ADDITIONAL_VERSIONS})
1419

1520
if(${compiler_version_available} AND ${CMAKE_CXX_COMPILER_ID} MATCHES Clang)

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ list(APPEND CMAKE_FIND_ROOT_PATH ${pfasst_SOURCE_DIR}/stack)
1414
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/3rdparty)
1515

1616
option(pfasst_DISABLE_LIBCXX "Disable use of LLVM's libc++ when compiling with Clang." ON )
17-
option(pfasst_BUILD_SHARED_LIBS "Build shared libraries." OFF)
17+
option(pfasst_BUILD_SHARED_LIBS "Build shared libraries." ON )
1818
option(pfasst_BUILD_EXAMPLES "Build example programs." ON )
1919
CMAKE_DEPENDENT_OPTION(pfasst_INSTALL_EXAMPLES "Install example programs." ON
2020
"pfasst_BUILD_EXAMPLES" OFF)
@@ -25,7 +25,17 @@ option(pfasst_DEFAULT_RAND_SEED "Using a hardcoded random seed"
2525

2626
if(${pfasst_WITH_MPI})
2727
find_package(MPI REQUIRED)
28-
message(STATUS "Using MPI C++ Compiler: ${MPI_CXX_COMPILER}")
28+
if(NOT "${CMAKE_CXX_COMPILER}" STREQUAL "${MPI_CXX_COMPILER}" OR
29+
NOT "${CMAKE_C_COMPILER}" STREQUAL "${MPI_C_COMPILER}")
30+
message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}")
31+
message(STATUS "MPI C++ Compiler Wrapper: ${MPI_CXX_COMPILER}")
32+
message(WARNING "Please make sure to set CXX and CC to the MPI compiler wrappers!")
33+
set(CMAKE_CXX_COMPILER "${MPI_CXX_COMPILER}")
34+
set(CMAKE_C_COMPILER "${MPI_C_COMPILER}")
35+
message(STATUS "Set default compilers to MPI compilers.")
36+
endif()
37+
message(STATUS "Using MPI C++ Compiler Wrapper: ${MPI_CXX_COMPILER}")
38+
message(STATUS "USing MPI C Compiler Wrapper: ${MPI_C_COMPILER}")
2939
add_definitions(-DWITH_MPI)
3040
endif()
3141

cmake/FindFFTW.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ if(FFTW_INCLUDE_PATH)
1010
set(FFTW_FIND_QUIETLY TRUE)
1111
endif(FFTW_INCLUDE_PATH)
1212

13-
find_path(FFTW_INCLUDE_PATH fftw3.h)
13+
find_path(FFTW_INCLUDE_PATH fftw3.h
14+
HINTS $ENV{FFTW3_INCLUDE}
15+
)
1416

15-
find_library(FFTW_LIBRARIES NAMES fftw3)
17+
find_library(FFTW_LIBRARIES NAMES fftw3
18+
HINTS $ENV{FFTW3_LIB}
19+
)
1620

1721
# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
1822
# all listed variables are TRUE

cmake/toolchain_juqueen.cmake

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Toolchain File for JUQUEEN @ Juelich Supercomputing Center
2+
# BG/Q system
3+
#
4+
# Remark: IBM XL/C++ compiler is not supported by PFASST++ due to lack of C++11 support
5+
#
6+
# IMPORTANT!!
7+
# Make sure you have loaded only the following modules:
8+
# - gcc/4.8.1
9+
# - fftw3/3.3.3
10+
#
11+
# As well make sure you have built boost::program_options according to the instructions from the
12+
# PFASST++ documentation on JUQUEEN.
13+
#
14+
15+
message(STATUS "Please make sure you have loaded at least gcc/4.8.1")
16+
17+
set(CMAKE_C_COMPILER /bgsys/local/gcc/4.8.1/bin/mpigcc)
18+
set(CMAKE_CXX_COMPILER /bgsys/local/gcc/4.8.1/bin/mpig++)
19+
set(CMAKE_Fortran_COMPILER /bgsys/local/gcc/4.8.1/bin/mpigfortran)
20+
21+
set(MPI_ROOT /bgsys/local/gcc/4.8.1)
22+
set(MPI_C_COMPILER ${MPI_ROOT}/bin/mpigcc)
23+
set(MPI_CXX_COMPILER ${MPI_ROOT}/bin/mpig++)
24+
set(MPI_Fortran_COMPILER ${MPI_ROOT}/bin/mpigfortran)

doc/source/installing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ latest release from [GitHub][github_releases].
135135

136136
make install
137137

138+
### Supercomputers
139+
140+
There are a few tweaks and special care require to get up and running on supercomputers.
141+
We have compiled a few working walk-throughs at \subpage page_supercomputers .
142+
138143
## Building with vanilla make
139144

140145
A sample `Makefile` is included in the `advection_diffusion` example. This may be of particular

doc/source/supercomputers.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Usage on Supercomputers {#page_supercomputers}
2+
3+
## JUQUEEN
4+
5+
There are a few steps one has to complete before using _PFASST++_ on _JUQUEEN_.
6+
7+
1. make sure the only modules loaded are `gcc/4.8.1` and `fftw3/3.3.3`
8+
9+
2. prepare a custom installation of _Boost_
10+
11+
Because at time of writing only 1.47.0 is available compiled with _XL/C++_, which does not
12+
support the C++11 features we learned to love.
13+
14+
1. download a recent version of _Boost_ (i.e. 1.57.0)
15+
16+
2. extract the archive and `cd` into it
17+
18+
3. run
19+
20+
CXX=`which mpig++` CC=`which mpigcc` ./bootstrap.sh \
21+
--with-libraries=program_options --prefix=<INSTALL_PLACE>
22+
23+
where `INSTALL_PLACE` is something like `$HOME/progs/juqueen`
24+
25+
4. create file called `user-config.jam` with the following content:
26+
27+
using gcc : 4.8.1 : mpig++ ;
28+
29+
5. now compile
30+
31+
CXX=`which mpig++` CC=`which mpigcc` ./b2 --prefix=<INSTALL_PLACE> \
32+
--reconfigure link=static stage
33+
34+
and install
35+
36+
CXX=`which mpig++` CC=`which mpigcc` ./b2 --prefix=<INSTALL_PLACE> \
37+
link=static install
38+
39+
3. go to the sources of _PFASST++_, create a build folder and step into it
40+
41+
4. run _CMake_
42+
43+
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain_juqueen.cmake \
44+
-DCMAKE_CXX_COMPILER=`which mpig++` -DCMAKE_C_COMPILER=`which mpigcc` \
45+
-DBOOST_ROOT=<INSTALL_PLACE> -Dpfasst_WITH_MPI=ON \
46+
-Dpfasst_BUILD_TESTS=OFF -Dpfasst_BUILD_SHARED_LIBS=OFF ..
47+
48+
5. run make
49+
50+
make
51+
52+
6. write your _LLSubmit_ configuration file
53+
54+
for example for the Advection-Diffusion example:
55+
56+
#@job_name = MPI_PFASST_test
57+
#@comment = "a little test of PFASST with MPI"
58+
#@output = mpi_pfasst_test_$(jobid)_$(stepid).out
59+
#@error = mpi_pfasst_test_$(jobid)_$(stepid).err
60+
#@environment = COPY_ALL
61+
#@job_type = bluegene
62+
#@notification = never
63+
#@wall_clock_limit = 00:10:00
64+
#@bg_size = 1
65+
#@bg_connectivity = TORUS
66+
#@queue
67+
runjob --np 32 --ranks-per-node 32 : \
68+
<PATH_TO_BUILD_DIR>/examples/advection_diffusion/mpi_pfasst \
69+
-q --tend 0.64 --dt 0.01 --num_iter 8

examples/advection_diffusion/CMakeLists.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,4 @@ foreach(example ${all_advec_examples})
4141
endif()
4242
endforeach(example)
4343

44-
if(${pfasst_WITH_MPI})
45-
include_directories(${MPI_CXX_INCLUDE_PATH})
46-
foreach(example ${advec_mpi_examples})
47-
if(MPI_COMPILE_FLAGS)
48-
set_target_properties(${example} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
49-
endif()
50-
if(MPI_LINK_FLAGS)
51-
set_target_properties(${example} PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
52-
endif()
53-
target_link_libraries(${example} ${MPI_CXX_LIBRARIES})
54-
endforeach(example)
55-
endif()
56-
5744
set(examples_to_install ${examples_to_install} ${all_advec_examples} PARENT_SCOPE)

examples/advection_diffusion/mpi_pfasst.cpp

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ using namespace std;
1616
#include <fftw3.h>
1717

1818
#include <pfasst.hpp>
19+
#include <pfasst/logging.hpp>
1920
#include <pfasst/controller/pfasst.hpp>
2021
#include <pfasst/mpi_communicator.hpp>
2122
#include <pfasst/encap/automagic.hpp>
@@ -40,17 +41,24 @@ namespace pfasst
4041
*
4142
* @ingroup AdvectionDiffusion
4243
*/
43-
error_map run_mpi_pfasst(double abs_residual_tol, size_t niters=4)
44+
error_map run_mpi_pfasst(const double abs_res_tol, const double rel_res_tol,
45+
const size_t niters, const size_t nsteps, const double dt,
46+
const size_t ndofs_f, const size_t ndofs_c,
47+
const size_t nnodes_f, const size_t nnodes_c)
4448
{
45-
const size_t nsteps = 4;
46-
const double dt = 0.01;
47-
49+
CLOG(INFO, "Advec") << "abs_res_tol: " << abs_res_tol << ", "
50+
<< "rel_res_tol: " << rel_res_tol << ", "
51+
<< "niter: " << niters << ", "
52+
<< "nsteps: " << nsteps << ", "
53+
<< "dt: " << dt << ", "
54+
<< "ndofs (f-c): " << ndofs_f << "-" << ndofs_c << ", "
55+
<< "nnodes (f-c): " << nnodes_f << "-" << nnodes_c;
4856
vector<pair<size_t, quadrature::QuadratureType>> nodes = {
49-
{ 3, quadrature::QuadratureType::GaussLobatto },
50-
{ 5, quadrature::QuadratureType::GaussLobatto }
57+
{ nnodes_c, quadrature::QuadratureType::GaussLobatto },
58+
{ nnodes_f, quadrature::QuadratureType::GaussLobatto }
5159
};
5260

53-
vector<size_t> ndofs = { 64, 128 };
61+
vector<size_t> ndofs = { ndofs_c, ndofs_f };
5462

5563
auto build_level = [ndofs](size_t level) {
5664
auto factory = make_shared<MPIVectorFactory<double>>(ndofs[level]);
@@ -75,7 +83,7 @@ namespace pfasst
7583
pf.set_comm(&comm);
7684
pf.set_duration(0.0, nsteps * dt, dt, niters);
7785
pf.set_nsweeps({2, 1});
78-
pf.get_finest<AdvectionDiffusionSweeper<>>()->set_residual_tolerances(abs_residual_tol, 0.0);
86+
pf.get_finest<AdvectionDiffusionSweeper<>>()->set_residual_tolerances(abs_res_tol, rel_res_tol);
7987
pf.set_options();
8088
pf.run();
8189

@@ -94,7 +102,22 @@ int main(int argc, char** argv)
94102
pfasst::init(argc, argv,
95103
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_opts,
96104
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_logs);
97-
pfasst::examples::advection_diffusion::run_mpi_pfasst(0.0);
105+
106+
const double tend = pfasst::config::get_value<double>("tend", 0.04);
107+
const double dt = pfasst::config::get_value<double>("dt", 0.01);
108+
const size_t nnodes_f = pfasst::config::get_value<size_t>("num_nodes", 5);
109+
const size_t ndofs_f = pfasst::config::get_value<size_t>("spatial_dofs", 128);
110+
const size_t niters = pfasst::config::get_value<size_t>("num_iter", 4);
111+
const double abs_res_tol = pfasst::config::get_value<double>("abs_res_tol", 0.0);
112+
const double rel_res_tol = pfasst::config::get_value<double>("rel_res_tol", 0.0);
113+
114+
const size_t nsteps = tend / dt;
115+
const size_t nnodes_c = (nnodes_f + 1) / 2;
116+
const size_t ndofs_c = ndofs_f / 2;
117+
118+
pfasst::examples::advection_diffusion::run_mpi_pfasst(abs_res_tol, rel_res_tol,
119+
niters, nsteps, dt,
120+
ndofs_f, ndofs_c, nnodes_f, nnodes_c);
98121
fftw_cleanup();
99122
MPI_Finalize();
100123
}

tests/examples/advection_diffusion/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,19 @@ if(${pfasst_WITH_MPI})
2727
if(MPI_COMPILE_FLAGS)
2828
if(pfasst_WITH_GCC_PROF AND ${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
2929
set_target_properties(${test}
30-
PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS} -ftest-coverage -fprofile-arcs"
30+
PROPERTIES COMPILE_FLAGS "-ftest-coverage -fprofile-arcs"
3131
LINK_FLAGS "-fprofile-arcs"
3232
)
33-
else()
34-
set_target_properties(${test} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
3533
endif()
3634
endif()
37-
if(MPI_LINK_FLAGS)
38-
set_target_properties(${test} PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
39-
endif()
4035
target_link_libraries(${test}
4136
${3rdparty_DEPENDEND_LIBS}
4237
${TESTS_3rdparty_DEPENDEND_LIBS}
4338
${FFTW_LIBRARIES}
4439
${pfasst_DEPENDEND_LIBS}
45-
${MPI_CXX_LIBRARIES}
4640
)
4741
add_test(NAME ${test}
48-
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS} ${CMAKE_BINARY_DIR}/tests/examples/advection_diffusion/${test} ${MPIEXEC_POSTFLAGS} --gtest_output=xml:${test}_out.xml
42+
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${CMAKE_BINARY_DIR}/tests/examples/advection_diffusion/${test} --gtest_output=xml:${test}_out.xml
4943
)
5044
endforeach(test)
5145
else()

tests/examples/advection_diffusion/test_mpi_advection_diffusion.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ TEST(ErrorTest, MPIPFASST)
2424
{
2525
typedef error_map::value_type vtype;
2626

27-
auto errors = run_mpi_pfasst(0.0);
27+
auto errors = run_mpi_pfasst(0.0, 0.0, 4, 4, 0.01, 128, 64, 5, 3);
2828
auto get_step = [](const vtype x) { return get<0>(get<0>(x)); };
2929
auto get_iter = [](const vtype x) { return get<1>(get<0>(x)); };
3030
auto get_error = [](const vtype x) { return get<1>(x); };
@@ -44,7 +44,7 @@ TEST(AdaptiveErrorTest, MPIPFASST)
4444
{
4545
typedef error_map::value_type vtype;
4646

47-
auto errors = run_mpi_pfasst(1.e-8, 12);
47+
auto errors = run_mpi_pfasst(1.e-8, 0.0, 12, 4, 0.01, 128, 64, 5, 3);
4848
auto get_step = [](const vtype x) { return get<0>(get<0>(x)); };
4949
auto get_iter = [](const vtype x) { return get<1>(get<0>(x)); };
5050
auto get_error = [](const vtype x) { return get<1>(x); };
@@ -69,6 +69,9 @@ int main(int argc, char** argv)
6969
{
7070
testing::InitGoogleTest(&argc, argv);
7171
MPI_Init(&argc, &argv);
72+
pfasst::init(argc, argv,
73+
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_opts,
74+
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_logs);
7275
int result = 1, max_result; // GTest return value 1 (failure), 0 (success)
7376
result = RUN_ALL_TESTS();
7477
MPI_Allreduce(&result, &max_result, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);

0 commit comments

Comments
 (0)