From 4408ec20b409a4a634780d60a5f376417b39dd98 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Mon, 11 Dec 2017 13:50:31 +0000 Subject: [PATCH] ENH: collated: switch off threading by default. See also #659. --- etc/controlDict | 8 ++++---- src/Pstream/mpi/UPstream.C | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/etc/controlDict b/etc/controlDict index 912ad98538d..3c5749e0564 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -81,13 +81,13 @@ OptimisationSwitches //- collated: thread buffer size for queued file writes. // If set to 0 or not sufficient for the file size threading is not used. - // Default: 2e9 - maxThreadFileBufferSize 2e9; + // Default: 1e9 + maxThreadFileBufferSize 0; //- masterUncollated: non-blocking buffer size. // If the file exceeds this buffer size scheduled transfer is used. - // Default: 2e9 - maxMasterFileBufferSize 2e9; + // Default: 1e9 + maxMasterFileBufferSize 1e9; commsType nonBlocking; //scheduled; //blocking; floatTransfer 0; diff --git a/src/Pstream/mpi/UPstream.C b/src/Pstream/mpi/UPstream.C index 321ae90c4aa..e92cb32582b 100644 --- a/src/Pstream/mpi/UPstream.C +++ b/src/Pstream/mpi/UPstream.C @@ -30,6 +30,7 @@ License #include "SubList.H" #include "allReduce.H" #include "int.H" +#include "collatedFileOperation.H" #include <mpi.h> @@ -128,12 +129,17 @@ bool Foam::UPstream::init(int& argc, char**& argv) //MPI_Init(&argc, &argv); + int wanted_thread_support = MPI_THREAD_SINGLE; + if (fileOperations::collatedFileOperation::maxThreadFileBufferSize > 0) + { + wanted_thread_support = MPI_THREAD_MULTIPLE; + } int provided_thread_support; MPI_Init_thread ( &argc, &argv, - MPI_THREAD_MULTIPLE, + wanted_thread_support, &provided_thread_support ); -- GitLab