diff --git a/applications/test/one-sided1/Make/files b/applications/test/one-sided1/Make/files new file mode 100644 index 0000000000..5d94634064 --- /dev/null +++ b/applications/test/one-sided1/Make/files @@ -0,0 +1,3 @@ +Test-one-sided1.cxx + +EXE = $(FOAM_USER_APPBIN)/Test-one-sided1 diff --git a/applications/test/one-sided1/Make/options b/applications/test/one-sided1/Make/options new file mode 100644 index 0000000000..18e6fe47af --- /dev/null +++ b/applications/test/one-sided1/Make/options @@ -0,0 +1,2 @@ +/* EXE_INC = */ +/* EXE_LIBS = */ diff --git a/applications/test/one-sided1/Test-one-sided1.cxx b/applications/test/one-sided1/Test-one-sided1.cxx new file mode 100644 index 0000000000..9a0af7114e --- /dev/null +++ b/applications/test/one-sided1/Test-one-sided1.cxx @@ -0,0 +1,354 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2025 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-one-sided1 + +Description + Simple test of one-sided communication + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "Time.H" +#include "IPstream.H" +#include "OPstream.H" +#include "SubField.H" +#include "vector.H" +#include "IOstreams.H" + +using namespace Foam; + +template +Ostream& printSpanInfo(Ostream& os, const UList& span) +{ + os << "addr=" << Foam::name(span.cdata()) + << " size= " << span.size(); + + return os; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::noCheckProcessorDirectories(); + argList::addVerboseOption(); + argList::addBoolOption("no-shared", "disable shared memory tests"); + argList::addBoolOption("no-sleep", "disable sleep for async test"); + + #include "setRootCase.H" + + const bool with_shared = !args.found("no-shared"); + const bool with_sleep = !args.found("no-sleep"); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< nl + << "nProcs = " << UPstream::nProcs() + << " with " << UPstream::nComms() << " predefined comm(s)" << nl; + + if (!UPstream::parRun()) + { + Info<< "###############" << nl + << "Not running in parallel. Stopping now" << nl + << "###############" << endl; + return 1; + } + + const auto myProci = UPstream::myProcNo(); + const auto numProc = UPstream::nProcs(); + + // Make some windows + Field