Skip to content
Snippets Groups Projects
Commit 9fd4578b authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add --threads option to control the number of threads for tests

parent ba333baa
No related branches found
No related tags found
1 merge request!199Integrate checkpointing
......@@ -28,7 +28,16 @@ main(int argc, char* argv[])
parallel::Messenger::create(argc, argv);
const int nb_max_threads = std::max(std::thread::hardware_concurrency(), 1u);
const int nb_threads = std::max(nb_max_threads / parallel::Messenger::getInstance().size(), 1ul);
int nb_threads = std::max(nb_max_threads / parallel::Messenger::getInstance().size(), 1ul);
Catch::Session session;
auto cli = session.cli() | Catch::Clara::Opt(nb_threads, "number of threads")["--threads"](
"number of threads (default: max logical threads)");
session.cli(cli);
int result = session.applyCommandLine(argc, argv);
{
Kokkos::InitializationSettings args;
......@@ -54,9 +63,6 @@ main(int argc, char* argv[])
}
}();
Catch::Session session;
int result = session.applyCommandLine(argc, argv);
// disable file locking to avoid mess in tests
setenv("HDF5_USE_FILE_LOCKING", "FALSE", 1);
......
......@@ -23,7 +23,16 @@ int
main(int argc, char* argv[])
{
parallel::Messenger::create(argc, argv);
const int nb_threads = std::max(std::thread::hardware_concurrency() / 2, 1u);
int nb_threads = std::max(std::thread::hardware_concurrency() / 2, 1u);
Catch::Session session;
auto cli = session.cli() | Catch::Clara::Opt(nb_threads, "number of threads")["--threads"](
"number of threads (default: max logical threads)");
session.cli(cli);
int result = session.applyCommandLine(argc, argv);
{
Kokkos::InitializationSettings args;
......@@ -40,9 +49,6 @@ main(int argc, char* argv[])
PETScWrapper::initialize(argc, argv);
SLEPcWrapper::initialize(argc, argv);
Catch::Session session;
int result = session.applyCommandLine(argc, argv);
if (result == 0) {
const auto& config = session.config();
if (config.listReporters() or config.listTags() or config.listTests()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment