diff --git a/applications/test/checkIOspeed/Make/files b/applications/test/checkIOspeed/Make/files new file mode 100644 index 0000000000..67cce419cf --- /dev/null +++ b/applications/test/checkIOspeed/Make/files @@ -0,0 +1,3 @@ +Test-checkIOspeed.cxx + +EXE = $(FOAM_USER_APPBIN)/Test-checkIOspeed diff --git a/applications/test/checkIOspeed/Make/options b/applications/test/checkIOspeed/Make/options new file mode 100644 index 0000000000..18b23366ad --- /dev/null +++ b/applications/test/checkIOspeed/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/mesh/blockMesh/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lblockMesh diff --git a/applications/test/checkIOspeed/Test-checkIOspeed.cxx b/applications/test/checkIOspeed/Test-checkIOspeed.cxx new file mode 100644 index 0000000000..a92159dde3 --- /dev/null +++ b/applications/test/checkIOspeed/Test-checkIOspeed.cxx @@ -0,0 +1,400 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2024 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + Test-checkIOspeed + +Description + Simple test of file writing, including timings + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "profiling.H" +#include "clockTime.H" + +#include "fileName.H" +#include "fileOperation.H" +#include "IOstreams.H" +#include "OSspecific.H" +#include "globalIndex.H" +#include "volFields.H" +#include "IOField.H" +#include "PDRblock.H" + +// Not really great since CoherentMesh only works with reading! +#ifdef USE_COHERENT +#include "OFCstream.H" +#include "SliceStreamRepo.H" +#endif + +#include + +using namespace Foam; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + argList::addNote("Rewrites fields multiple times"); + + argList::noFunctionObjects(); // Disallow function objects + argList::noCheckProcessorDirectories(); + + argList::addVerboseOption("additional verbosity"); + argList::addOption + ( + "output", + "N", + "Begin output iteration (default: 10000)" + ); + argList::addOption + ( + "count", + "N", + "Number of writes (default: 1)" + ); + argList::addOption + ( + "fields", + "N", + "Number of fields to write (default: 1)" + ); + argList::addOption + ( + "global", + "N", + "Global field size" + ); + argList::addOption + ( + "local", + "N", + "Local fields size (default: 1000)" + ); + argList::addOption + ( + "mesh", + "(nx ny nz)", + "Create with a mesh" + ); + argList::addOption + ( + "exclude", + "(int ... )", + "zero-sized on ranks with specified modulo" + ); + + argList::addBoolOption("coherent", "Force coherent output"); + + #include "setRootCase.H" + #include "createTime.H" + + const label firstOutput = args.getOrDefault("output", 10000); + const label nOutput = args.getOrDefault("count", 1); + const label nFields = args.getOrDefault("fields", 1); + labelVector meshCells(0, 0, 0); + + const int verbose = args.verbose(); + + const bool useCoherent = args.found("coherent"); + + labelList excludes; + args.readListIfPresent("exclude", excludes); + + bool writeOnProc = true; + + const label myProci = UPstream::myProcNo(); + + for (const label excl : excludes) + { + if (excl > 1 && myProci > 0 && (myProci % excl) == 0) + { + writeOnProc = false; + break; + } + } + + const label nProcsEff = + returnReduce((writeOnProc ? 1 : 0), sumOp