Skip to content

Commit

Permalink
Document deal.II's mechanism for setting the number of threads
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Jun 6, 2019
1 parent e066555 commit bb86bcc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ bool init_function() { return true; }

int main(int argc, char *argv[])
{
// Set the maximum number of threads used to the minimum of the number of
// cores reported by TBB and the environment variable DEAL_II_NUM_THREADS.
dealii::Utilities::MPI::MPI_InitFinalize mpi_init(
argc, argv, dealii::numbers::invalid_unsigned_int);

Expand Down
9 changes: 9 additions & 0 deletions tests/test_hierarchy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
#include "main.cc"
#include "test_hierarchy_helpers.hpp"

// In a lot of places in this file, we explicitly set the number of threads to
// use since some of the tests cases don't work with multiple threads yet. This
// works as follow: dealii::MultithreadInfo::set_thread_limit sets the number of
// threads to the minimum its the argument and the environment variable
// DEAL_II_NUM_THREADS. TBB is asked for the maximum nuber of cores if the
// minimum is dealii::numbers::invalid_unsigned_int. Consequently,
// MultithreadInfo::set_thread_limit(numbers::invalid_unsigned int) sets the
// number of threads to the ones specified in the environment variable.

namespace bdata = boost::unit_test::data;
namespace tt = boost::test_tools;

Expand Down

0 comments on commit bb86bcc

Please sign in to comment.