Mise à jour terminée. Pour connaître les apports de la version 13.8.4 par rapport à notre ancienne version vous pouvez lire les "Release Notes" suivantes :
https://about.gitlab.com/releases/2021/02/11/security-release-gitlab-13-8-4-released/
https://about.gitlab.com/releases/2021/02/05/gitlab-13-8-3-released/

Commit 52c6a5cd authored by GILLES Sebastien's avatar GILLES Sebastien

#1531 Make InitVertexMatching work in a run from prepartitioned data.

parent 99ac0112
......@@ -14,6 +14,8 @@
#include "ThirdParty/Wrappers/Petsc/Matrix/MatrixPattern.hpp"
#include "Utilities/LuaOptionFile/LuaOptionFile.hpp"
#include "Core/NumberingSubset/NumberingSubset.hpp"
#include "FiniteElement/FiniteElementSpace/FEltSpace.hpp"
......@@ -224,27 +226,133 @@ namespace MoReFEM
void FromVertexMatching::Print(const Wrappers::Mpi& mpi,
const FilesystemNS::Directory& directory) const
{
const auto matrix_file = directory.AddFile("matrix.m");
#ifndef NDEBUG
{
switch(directory.GetBehaviour())
{
case FilesystemNS::behaviour::overwrite:
case FilesystemNS::behaviour::create:
break;
case FilesystemNS::behaviour::ask:
case FilesystemNS::behaviour::quit:
case FilesystemNS::behaviour::ignore:
case FilesystemNS::behaviour::read:
assert(false && "Invalid choice for this method!");
exit(EXIT_FAILURE);
}
}
#endif // NDEBUG
decltype(auto) matrix = GetInterpolationMatrix();
{
const auto matrix_file = directory.AddFile("matrix.m");
GetInterpolationMatrix().View(mpi,
matrix_file,
__FILE__, __LINE__,
PETSC_VIEWER_ASCII_MATLAB);
matrix.ViewBinary(mpi,
matrix_file,
__FILE__, __LINE__);
}
if (matrix_pattern_ != nullptr)
{
const auto matrix_pattern_file = directory.AddFile("matrix_pattern.lua");
const auto info_file = directory.AddFile("informations.lua");
std::ofstream out;
FilesystemNS::File::Create(out, info_file, __FILE__, __LINE__);
out << "row_numbering_subset = " << matrix.GetRowNumberingSubset().GetUniqueId() << std::endl;
out << "column_numbering_subset = " << matrix.GetColNumberingSubset().GetUniqueId() << std::endl;
const auto& [Nrow_processor_wise, Ncol_processor_wise] = matrix.GetProcessorWiseSize(__FILE__, __LINE__);
const auto& [Nrow_program_wise, Ncol_program_wise] = matrix.GetProgramWiseSize(__FILE__, __LINE__);
FilesystemNS::File::Create(out, matrix_pattern_file, __FILE__, __LINE__);
out << "Nrow_processor_wise = " << Nrow_processor_wise << std::endl;
out << "Ncol_processor_wise = " << Ncol_processor_wise << std::endl;
out << "Nrow_program_wise = " << Nrow_program_wise << std::endl;
out << "Ncol_program_wise = " << Ncol_program_wise << std::endl;
out << "iCSR = ";
Utilities::PrintContainer<>::Do(matrix_pattern_->GetICsr(), out, ", ", "{", "}");
if (matrix_pattern_ != nullptr)
{
out << "iCSR = ";
Utilities::PrintContainer<>::Do(matrix_pattern_->GetICsr(), out, ", ", "{", "}");
out << "\njCSR = ";
Utilities::PrintContainer<>::Do(matrix_pattern_->GetJCsr(), out, ", ", "{", "}");
}
}
}
out << "\njCSR = ";
Utilities::PrintContainer<>::Do(matrix_pattern_->GetJCsr(), out, ", ", "{", "}");
FromVertexMatching::FromVertexMatching(const Wrappers::Mpi& mpi,
const FilesystemNS::Directory& interpolator_directory)
{
#ifndef NDEBUG
{
switch(interpolator_directory.GetBehaviour())
{
case FilesystemNS::behaviour::read:
break;
case FilesystemNS::behaviour::overwrite:
case FilesystemNS::behaviour::create:
case FilesystemNS::behaviour::ask:
case FilesystemNS::behaviour::quit:
case FilesystemNS::behaviour::ignore:
assert(false && "Invalid choice for this method!");
exit(EXIT_FAILURE);
}
}
#endif // NDEBUG
LuaOptionFile lua_file(interpolator_directory.AddFile("informations.lua"),
__FILE__, __LINE__);
#ifndef NDEBUG
do_store_matrix_pattern_ = store_matrix_pattern::yes;
#endif // NDEBUG
std::vector<PetscInt> iCSR, jCSR;
lua_file.Read("iCSR", "", iCSR, __FILE__, __LINE__);
lua_file.Read("jCSR", "", jCSR, __FILE__, __LINE__);
matrix_pattern_ = std::make_unique<Wrappers::Petsc::MatrixPattern>(std::move(iCSR),
std::move(jCSR));
unsigned int row_numbering_subset_index, col_numbering_subset_index;
lua_file.Read("row_numbering_subset", "", row_numbering_subset_index, __FILE__, __LINE__);
lua_file.Read("column_numbering_subset", "", col_numbering_subset_index, __FILE__, __LINE__);
unsigned int Nrow_processor_wise, Ncol_processor_wise, Nrow_program_wise, Ncol_program_wise;
lua_file.Read("Nrow_processor_wise", "", Nrow_processor_wise, __FILE__, __LINE__);
lua_file.Read("Ncol_processor_wise", "", Ncol_processor_wise, __FILE__, __LINE__);
lua_file.Read("Nrow_program_wise", "", Nrow_program_wise, __FILE__, __LINE__);
lua_file.Read("Ncol_program_wise", "", Ncol_program_wise, __FILE__, __LINE__);
decltype(auto) numbering_subset_manager =
Internal::NumberingSubsetNS::NumberingSubsetManager::GetInstance(__FILE__, __LINE__);
decltype(auto) row_numbering_subset =
numbering_subset_manager.GetNumberingSubset(row_numbering_subset_index);
decltype(auto) col_numbering_subset =
numbering_subset_manager.GetNumberingSubset(col_numbering_subset_index);
interpolation_matrix_ =
std::make_unique<GlobalMatrix>(row_numbering_subset, col_numbering_subset);
const auto matrix_file = interpolator_directory.AddFile("matrix.m");
interpolation_matrix_->InitParallelMatrix(Nrow_processor_wise,
Ncol_processor_wise,
Nrow_program_wise,
Ncol_program_wise,
*matrix_pattern_,
mpi,
__FILE__, __LINE__);
interpolation_matrix_->LoadBinary(mpi,
matrix_file,
__FILE__, __LINE__);
}
......
......@@ -116,12 +116,19 @@ namespace MoReFEM
///@{
/*!
* \class doxygen_hide_from_vertex_matching_do_store_matrix_pattern_arg
*
* \param[in] do_store_matrix_pattern Whether matrix pattern should be stored.
* 'yes' is relevant only for some Test executables; otherwise 'no' is fine and is hence the default choice.
*/
/*!
* \class doxygen_hide_from_vertex_matching_constructor_arg
*
* \param[in] source_index Unique id of the source InitVertexMatchingInterpolator in the input data file.
* \param[in] target_index Unique id of the target InitVertexMatchingInterpolator in the input data file.
* \param[in] do_store_matrix_pattern Whether matrix pattern should be stored.
* \copydoc doxygen_hide_from_vertex_matching_do_store_matrix_pattern_arg
* 'yes' is relevant only for some Test executables; otherwise 'no' is fine and is hence the default choice.
*/
......@@ -137,6 +144,23 @@ namespace MoReFEM
unsigned int target_index,
store_matrix_pattern do_store_matrix_pattern = store_matrix_pattern::no);
/*! Constructor from data written on disk.
*
* This constructor is for instance useful for a run from prepartitioned data: in this case the matrix and possibly the pattern have been written on disk.
*
* \copydoc doxygen_hide_mpi_param
* \param[in] interpolator_directory Directory which includes the data relevant to rebuild an object. It should include at least a file
* 'matrix.m' and possibly another named "matrix_pattern.lua" (see below).
* \copydoc doxygen_hide_from_vertex_matching_do_store_matrix_pattern_arg
* If \a do_store_matrix_pattern is 'yes' \a interpolator_directory is expected to have a file named "matrix_pattern.lua"
*
* If you want to see how this can be deployed in one of your model have a look at the \a FromVertexMatching Model, which shows the lines
* to be written in normal and from prepartitioned data runs (it boils down to call the \a Print() method of current interpolator in normal run and
* current constructor in the one from prepartitioned data).
*/
explicit FromVertexMatching(const Wrappers::Mpi& mpi,
const FilesystemNS::Directory& interpolator_directory);
//! Destructor.
~FromVertexMatching() = default;
......@@ -208,7 +232,7 @@ namespace MoReFEM
# ifndef NDEBUG
//! Whether matrix pattern is kept within the class or not. If 'no', GetMatrixPattern() shouldn't be called.
const store_matrix_pattern do_store_matrix_pattern_;
store_matrix_pattern do_store_matrix_pattern_ = store_matrix_pattern::no;
# endif // NDEBUG
};
......
......@@ -21,12 +21,12 @@ add_executable(MoReFEMTestFromVertexMatching_vectorial_P1
target_link_libraries(MoReFEMTestFromVertexMatching_vectorial_P1 MoReFEMTestFromVertexMatching_lib)
# add_executable(MoReFEMTestFromVertexMatching_vectorial_P1_from_prepartitioned_data
# ${CMAKE_CURRENT_LIST_DIR}/main_vectorial_P1_from_prepartitioned_data.cpp
# )
#
# target_link_libraries(MoReFEMTestFromVertexMatching_vectorial_P1_from_prepartitioned_data
# MoReFEMTestFromVertexMatching_lib)
add_executable(MoReFEMTestFromVertexMatching_vectorial_P1_from_prepartitioned_data
${CMAKE_CURRENT_LIST_DIR}/main_vectorial_P1_from_prepartitioned_data.cpp
)
target_link_libraries(MoReFEMTestFromVertexMatching_vectorial_P1_from_prepartitioned_data
MoReFEMTestFromVertexMatching_lib)
add_executable(MoReFEMTestFromVertexMatching_vectorial_P1b
${CMAKE_CURRENT_LIST_DIR}/main_vectorial_P1b.cpp
......@@ -65,17 +65,17 @@ add_test(FromVertexMatching_VectorialP1
set_tests_properties(FromVertexMatching_VectorialP1 PROPERTIES TIMEOUT 20)
#add_test(FromVertexMatching_VectorialP1_from_prepartitioned_data
# ${OPEN_MPI_INCL_DIR}/../bin/mpirun
# --oversubscribe
# -np 4
# MoReFEMTestFromVertexMatching_vectorial_P1_from_prepartitioned_data
# --
# ${MOREFEM_ROOT}
# ${MOREFEM_TEST_OUTPUT_DIR}
# )
# set_tests_properties(FromVertexMatching_VectorialP1_from_prepartitioned_data PROPERTIES TIMEOUT 20)
add_test(FromVertexMatching_VectorialP1_from_prepartitioned_data
${OPEN_MPI_INCL_DIR}/../bin/mpirun
--oversubscribe
-np 4
MoReFEMTestFromVertexMatching_vectorial_P1_from_prepartitioned_data
--
${MOREFEM_ROOT}
${MOREFEM_TEST_OUTPUT_DIR}
)
set_tests_properties(FromVertexMatching_VectorialP1_from_prepartitioned_data PROPERTIES TIMEOUT 20)
add_test(FromVertexMatching_VectorialP1b
......
......@@ -81,8 +81,6 @@ namespace MoReFEM
};
//! \copydoc doxygen_hide_input_data_tuple
using InputDataTuple = std::tuple
<
......
......@@ -36,6 +36,12 @@ namespace MoReFEM
assert(!(!parallelism_ptr));
const auto& parallelism = *parallelism_ptr;
decltype(auto) parallelism_dir = parallelism.GetDirectory();
FilesystemNS::Directory interpolator_directory(parallelism_dir,
"Solid2FluidInterpolator",
__FILE__, __LINE__);
if (parallelism.GetParallelismStrategy() != Advanced::parallelism_strategy::run_from_preprocessed)
{
unknown_solid_2_fluid_ =
......@@ -45,18 +51,13 @@ namespace MoReFEM
NonConformInterpolatorNS::store_matrix_pattern::yes);
// Store the interpolator data inside an ad hoc directory.
decltype(auto) parallelism_dir = parallelism.GetDirectory();
FilesystemNS::Directory interpolator_directory(parallelism_dir,
"Solid2FluidInterpolator",
__FILE__, __LINE__);
unknown_solid_2_fluid_->Print(GetMpi(), interpolator_directory);
}
else
{
// Init directly from the matrix stored during prepartition.
unknown_solid_2_fluid_ =
std::make_unique<type>(GetMpi(), interpolator_directory);
}
}
......
-- Comment lines are introduced by "--".
-- In a section (i.e. within braces), all entries must be separated by a comma.
transient = {
-- Time at the beginning of the code (in seconds).
-- Expected format: VALUE
-- Constraint: v >= 0.
init_time = 0.,
-- Time step between two iterations, in seconds.
-- Expected format: VALUE
-- Constraint: v > 0.
timeStep = 0.1,
-- Maximum time, if set to zero run a static case.
-- Expected format: VALUE
-- Constraint: v >= 0.
timeMax = 0.
} -- transient
NumberingSubset10 = {
-- Name of the numbering subset (not really used; at the moment I just need one input parameter to ground
-- the possible values to choose elsewhere).
-- Expected format: "VALUE"
name = 'Unknown on fluid',
-- Whether a vector defined on this numbering subset might be used to compute a movemesh. If true, a
-- FEltSpace featuring this numbering subset will compute additional quantities to enable fast computation.
-- This should be false for most numbering subsets, and when it's true the sole unknown involved should be a
-- displacement.
-- Expected format: 'true' or 'false' (without the quote)
do_move_mesh = false
} -- NumberingSubset10
NumberingSubset20 = {
-- Name of the numbering subset (not really used; at the moment I just need one input parameter to ground
-- the possible values to choose elsewhere).
-- Expected format: "VALUE"
name = 'Unknown on solid',
-- Whether a vector defined on this numbering subset might be used to compute a movemesh. If true, a
-- FEltSpace featuring this numbering subset will compute additional quantities to enable fast computation.
-- This should be false for most numbering subsets, and when it's true the sole unknown involved should be a
-- displacement.
-- Expected format: 'true' or 'false' (without the quote)
do_move_mesh = false
} -- NumberingSubset20
NumberingSubset22 = {
-- Name of the numbering subset (not really used; at the moment I just need one input parameter to ground
-- the possible values to choose elsewhere).
-- Expected format: "VALUE"
name = 'Chaos',
-- Whether a vector defined on this numbering subset might be used to compute a movemesh. If true, a
-- FEltSpace featuring this numbering subset will compute additional quantities to enable fast computation.
-- This should be false for most numbering subsets, and when it's true the sole unknown involved should be a
-- displacement.
-- Expected format: 'true' or 'false' (without the quote)
do_move_mesh = false
} -- NumberingSubset22
Unknown1 = {
-- Name of the unknown (used for displays in output).
-- Expected format: "VALUE"
name = 'unknown',
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'scalar', 'vectorial'})
nature = 'vectorial'
} -- Unknown1
Unknown3 = {
-- Name of the unknown (used for displays in output).
-- Expected format: "VALUE"
name = 'chaos',
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'scalar', 'vectorial'})
nature = 'scalar'
} -- Unknown3
Mesh1 = {
-- Path of the mesh file to use.
-- Expected format: "VALUE"
mesh = '${MOREFEM_ROOT}/Data/Mesh/elasticity_Nx50_Ny20_force_label.mesh',
-- Format of the input mesh.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'Ensight', 'Medit'})
format = "Medit",
-- Highest dimension of the input mesh. This dimension might be lower than the one effectively read in the
-- mesh file; in which case Coords will be reduced provided all the dropped values are 0. If not, an
-- exception is thrown.
-- Expected format: VALUE
-- Constraint: v <= 3 and v > 0
dimension = 2,
-- Space unit of the mesh.
-- Expected format: VALUE
space_unit = 1.
} -- Mesh1
Mesh2 = {
-- Path of the mesh file to use.
-- Expected format: "VALUE"
mesh = '${MOREFEM_ROOT}/Data/Mesh/elasticity_Nx50_Ny20_force_label.mesh',
-- Format of the input mesh.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'Ensight', 'Medit'})
format = "Medit",
-- Highest dimension of the input mesh. This dimension might be lower than the one effectively read in the
-- mesh file; in which case Coords will be reduced provided all the dropped values are 0. If not, an
-- exception is thrown.
-- Expected format: VALUE
-- Constraint: v <= 3 and v > 0
dimension = 2,
-- Space unit of the mesh.
-- Expected format: VALUE
space_unit = 1.
} -- Mesh2
-- Domain10
Domain10 = {
-- Index of the geometric mesh upon which the domain is defined (as defined in the present file). Might be
-- left empty if domain not limited to one mesh; at most one value is expected here.
-- Expected format: {VALUE1, VALUE2, ...}
mesh_index = { 1 },
-- List of dimensions encompassed by the domain. Might be left empty if no restriction at all upon
-- dimensions.
-- Expected format: {VALUE1, VALUE2, ...}
-- Constraint: value_in(v, {0, 1, 2, 3})
dimension_list = { 2 },
-- List of mesh labels encompassed by the domain. Might be left empty if no restriction at all upon mesh
-- labels. This parameter does not make sense if no mesh is defined for the domain.
-- Expected format: {VALUE1, VALUE2, ...}
mesh_label_list = { },
-- List of geometric element types considered in the domain. Might be left empty if no restriction upon
-- these. No constraint is applied at LuaOptionFile level, as some geometric element types could be added after
-- generation of current input data file. Current list is below; if an incorrect value is put there it
-- will be detected a bit later when the domain object is built.
-- The known types when this file was generated are:
-- . Point1
-- . Segment2, Segment3
-- . Triangle3, Triangle6
-- . Quadrangle4, Quadrangle8, Quadrangle9
-- . Tetrahedron4, Tetrahedron10
-- . Hexahedron8, Hexahedron20, Hexahedron27.
-- Expected format: {"VALUE1", "VALUE2", ...}
geometric_element_type_list = { }
}
-- Domain20
Domain20 = {
-- Index of the geometric mesh upon which the domain is defined (as defined in the present file). Might be
-- left empty if domain not limited to one mesh; at most one value is expected here.
-- Expected format: {VALUE1, VALUE2, ...}
mesh_index = { 2 },
-- List of dimensions encompassed by the domain. Might be left empty if no restriction at all upon
-- dimensions.
-- Expected format: {VALUE1, VALUE2, ...}
-- Constraint: value_in(v, {0, 1, 2, 3})
dimension_list = { 2 },
-- List of mesh labels encompassed by the domain. Might be left empty if no restriction at all upon mesh
-- labels. This parameter does not make sense if no mesh is defined for the domain.
-- Expected format: {VALUE1, VALUE2, ...}
mesh_label_list = { },
-- List of geometric element types considered in the domain. Might be left empty if no restriction upon
-- these. No constraint is applied at LuaOptionFile level, as some geometric element types could be added after
-- generation of current input data file. Current list is below; if an incorrect value is put there it
-- will be detected a bit later when the domain object is built.
-- The known types when this file was generated are:
-- . Point1
-- . Segment2, Segment3
-- . Triangle3, Triangle6
-- . Quadrangle4, Quadrangle8, Quadrangle9
-- . Tetrahedron4, Tetrahedron10
-- . Hexahedron8, Hexahedron20, Hexahedron27.
-- Expected format: {"VALUE1", "VALUE2", ...}
geometric_element_type_list = { }
}
FiniteElementSpace10 = {
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: VALUE
god_of_dof_index = 1,
-- Index of the domain onto which the finite element space is defined. This domain must be unidimensional.
-- Expected format: VALUE
domain_index = 10,
-- List of all unknowns defined in the finite element space. Unknowns here must be defined in this file as
-- an 'Unknown' block; expected name/identifier is the name given there.
-- Expected format: {"VALUE1", "VALUE2", ...}
unknown_list = { 'unknown' },
-- List of the shape function to use for each unknown;
-- Expected format: {"VALUE1", "VALUE2", ...}
shape_function_list = { 'P1' },
-- List of the numbering subset to use for each unknown;
-- Expected format: {VALUE1, VALUE2, ...}
numbering_subset_list = { 10 }
} -- FiniteElementSpace10
FiniteElementSpace20 = {
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: VALUE
god_of_dof_index = 2,
-- Index of the domain onto which the finite element space is defined. This domain must be unidimensional.
-- Expected format: VALUE
domain_index = 20,
-- List of all unknowns defined in the finite element space. Unknowns here must be defined in this file as
-- an 'Unknown' block; expected name/identifier is the name given there.
-- Expected format: {"VALUE1", "VALUE2", ...}
unknown_list = { 'unknown', 'chaos' },
-- List of the shape function to use for each unknown;
-- Expected format: {"VALUE1", "VALUE2", ...}