Split flow_comp into per-component translation units

for parallel builds and bounded per-process memory
This commit is contained in:
Kai Bao committed 2026-06-29 14:35:07 +02:00
1 parent 8b7119de65
commit 497cd36d4b
20 files changed
+703 -13

No files matched your search

+13
View File
@@ -893,6 +893,16 @@ macro(opm-simulators_targets_hook)
opmsimulators
)
# One translation unit per (component, water) combination, each defining a
# single explicit specialization of dispatchFlowComp<>. Instantiating one
# configuration per file keeps per-process compile memory bounded and lets
# make -j compile the configurations in parallel.
set(FLOW_COMP_DISPATCH_SOURCES)
foreach(component IN LISTS OPM_COMPILE_COMPONENTS)
list(APPEND FLOW_COMP_DISPATCH_SOURCES flowexperimental/comp/flow_comp_dispatch${component}.cpp)
list(APPEND FLOW_COMP_DISPATCH_SOURCES flowexperimental/comp/flow_comp_dispatch${component}_2p.cpp)
endforeach()
opm_add_executable(
TARGET
flow_comp
@@ -904,6 +914,7 @@ macro(opm-simulators_targets_hook)
opmsimulators
SOURCES
flowexperimental/comp/flow_comp.cpp
${FLOW_COMP_DISPATCH_SOURCES}
$<TARGET_OBJECTS:moduleVersion>
)
target_compile_definitions(flow_comp
@@ -916,6 +927,7 @@ macro(opm-simulators_targets_hook)
flow_comp2_2p
SOURCES
flowexperimental/comp/flow_comp2_2p.cpp
flowexperimental/comp/flow_comp_dispatch2_2p.cpp
$<TARGET_OBJECTS:moduleVersion>
LIBRARIES
opmsimulators
@@ -926,6 +938,7 @@ macro(opm-simulators_targets_hook)
flow_comp3_2p
SOURCES
flowexperimental/comp/flow_comp3_2p.cpp
flowexperimental/comp/flow_comp_dispatch3_2p.cpp
$<TARGET_OBJECTS:moduleVersion>
LIBRARIES
opmsimulators
+6 -13
View File
@@ -284,18 +284,11 @@ struct EnableThermalFluxBoundaries<TypeTag, TTag::FlowCompProblem> {
} // namespace Opm::Properties
namespace Opm {
template<int numComp, bool EnableWater>
int dispatchFlowComp(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<numComp, EnableWater>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
// dispatchFlowComp() is only declared here; each (numComp, EnableWater)
// combination is defined as an explicit specialization in its own translation
// unit (flow_comp_dispatch<N>.cpp / flow_comp_dispatch<N>_2p.cpp). Keeping the
// definition out of this header limits each translation unit to a single
// instantiation of the simulator stack, so per-process compile memory stays
// bounded and the configurations compile in parallel.
#endif
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<10, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<10, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<10, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<10, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<2, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<2, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<2, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<2, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<3, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<3, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<3, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<3, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<4, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<4, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<4, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<4, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<5, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<5, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<5, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<5, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<6, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<6, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<6, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<6, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<7, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<7, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<7, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<7, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<8, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<8, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<8, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<8, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<9, true>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<9, true>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm
@@ -0,0 +1,38 @@
/*
Copyright 2026, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include "flow_comp.hpp"
namespace Opm {
template<>
int dispatchFlowComp<9, false>(int argc, char** argv)
{
using TypeTag = Properties::TTag::FlowCompProblem<9, false>;
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
const auto ret = mainObject->runStatic<TypeTag>();
mainObject.reset();
return ret;
}
} // namespace Opm