Skip to content

Commit

Permalink
ddc sync
Browse files Browse the repository at this point in the history
- Workaround #183 by using Gmres in place of BiCGStab
- Minor changes

See merge request gysela-developpers/gyselalibxx!429

--------------------------------------------
  • Loading branch information
EmilyBourne committed Apr 2, 2024
1 parent 63fd821 commit eabafe5
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 37 deletions.
4 changes: 1 addition & 3 deletions vendor/ddc/.github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ jobs:
export CXX=clang++
cmake \
-DDDC_BUILD_DOCUMENTATION=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_STANDARD=20 \
-DMDSPAN_CXX_STANDARD=20 \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-DCMAKE_CXX_FLAGS="-Wno-gnu-zero-variadic-macro-arguments -Wno-unused-command-line-argument" \
/src
make VERBOSE=1 doc
cmake --build . --verbose --target doc
mv docs/html /src/docs_out
EOF
mkdir docs_out
Expand Down
2 changes: 1 addition & 1 deletion vendor/ddc/docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if("${DOXYGEN_VERSION}" VERSION_GREATER_EQUAL 1.9.4 AND CMAKE_CXX_COMPILER_ID ST
set(DOXYGEN_CLANG_ASSISTED_PARSING YES)
set(DOXYGEN_CLANG_DATABASE_PATH "${CMAKE_BINARY_DIR}")
else()
set(DOXYGEN_WARN_AS_ERROR "FAIL_ON_WARNINGS")
set(DOXYGEN_WARN_AS_ERROR YES)
endif()
set(DOXYGEN_DISABLE_INDEX YES)
set(DOXYGEN_ENUM_VALUES_PER_LINE 1)
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions vendor/ddc/include/ddc/ddc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#include "ddc/uniform_point_sampling.hpp"

// Algorithms
#include "ddc/create_mirror.hpp"
#include "ddc/for_each.hpp"
#include "ddc/mirror.hpp"
#include "ddc/parallel_deepcopy.hpp"
#include "ddc/parallel_fill.hpp"
#include "ddc/parallel_for_each.hpp"
Expand All @@ -42,7 +42,3 @@
#if defined(DDC_BUILD_PDI_WRAPPER)
#include "ddc/pdi.hpp"
#endif

#if ginkgo_AVAIL
#include "misc/ginkgo_executors.hpp"
#endif
11 changes: 5 additions & 6 deletions vendor/ddc/include/ddc/discrete_space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ void init_discrete_space(Args&&... args)
* @param a - the discrete space to move at index 0
* - the arguments to pass through at index 1
*/
template <class DDimImpl, class Arg>
Arg init_discrete_space(std::tuple<DDimImpl, Arg>&& a)
template <class DDimImpl, class Arg0>
Arg0 init_discrete_space(std::tuple<DDimImpl, Arg0>&& a)
{
using DDim = typename DDimImpl::discrete_dimension_type;
init_discrete_space<DDim>(std::move(std::get<0>(a)));
Expand All @@ -188,13 +188,12 @@ Arg init_discrete_space(std::tuple<DDimImpl, Arg>&& a)
* @param a - the discrete space to move at index 0
* - the (2+) arguments to pass through in other indices
*/
template <class DDimImpl, class... Args>
std::enable_if_t<2 <= sizeof...(Args), std::tuple<Args...>> init_discrete_space(
std::tuple<DDimImpl, Args...>&& a)
template <class DDimImpl, class Arg0, class Arg1, class... Args>
std::tuple<Arg0, Arg1, Args...> init_discrete_space(std::tuple<DDimImpl, Arg0, Arg1, Args...>&& a)
{
using DDim = typename DDimImpl::discrete_dimension_type;
init_discrete_space<DDim>(std::move(std::get<0>(a)));
return detail::extract_after(std::move(a), std::index_sequence_for<Args...>());
return detail::extract_after(std::move(a), std::index_sequence_for<Arg0, Arg1, Args...>());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class UniformBSplines
*
* @param rmin the real ddc::coordinate of the first knot
* @param rmax the real ddc::coordinate of the last knot
* @param n_knots the number of knots
* @param ncells the number of cells in the range [rmin, rmax]
*/
explicit Impl(ddc::Coordinate<Tag> rmin, ddc::Coordinate<Tag> rmax, std::size_t ncells)
: m_domain(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct ConstantExtrapolationRule<DimI>
*/
template <class CoordType, class BSplines, class Layout, class MemorySpace>
KOKKOS_FUNCTION double operator()(
CoordType,
[[maybe_unused]] CoordType pos,
ddc::ChunkSpan<double const, ddc::DiscreteDomain<BSplines>, Layout, MemorySpace> const
spline_coef) const
{
Expand Down Expand Up @@ -91,7 +91,7 @@ struct ConstantExtrapolationRule<DimI, DimNI>
* dimension off-interest (the complementary dimension of the boundary condition),
* because the evaluator can receive coordinates outside the domain in both dimension.
*
* @param[in] eval_pos_bc
* @param[in] eval_pos
* Coordinate in the dimension given inside the domain where we will evaluate
* each points outside the domain.
* @param[in] eval_pos_not_interest_min
Expand All @@ -117,7 +117,7 @@ struct ConstantExtrapolationRule<DimI, DimNI>
* No second and third parameters are needed in case of periodic splines on the
* dimension off-interest (the complementary dimension of the boundary condition).
*
* @param[in] eval_pos_bc
* @param[in] eval_pos
* Coordinate in the dimension given inside the domain where we will evaluate
* each points outside the domain.
*/
Expand Down
11 changes: 5 additions & 6 deletions vendor/ddc/include/ddc/kernels/splines/matrix_sparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

#include <Kokkos_Core.hpp>

#include "ddc/misc/ginkgo_executors.hpp"

#include "ginkgo_executors.hpp"
#include "matrix.hpp"

namespace ddc::detail {
Expand Down Expand Up @@ -78,7 +77,7 @@ unsigned int default_preconditionner_max_block_size() noexcept
#endif
#ifdef KOKKOS_ENABLE_OPENMP
if (std::is_same_v<ExecSpace, Kokkos::OpenMP>) {
return 32u;
return 1u;
}
#endif
#ifdef KOKKOS_ENABLE_CUDA
Expand All @@ -105,7 +104,7 @@ class Matrix_Sparse : public Matrix

std::shared_ptr<matrix_sparse_type> m_matrix_sparse;

std::shared_ptr<gko::solver::Bicgstab<double>> m_solver;
std::shared_ptr<gko::solver::Gmres<double>> m_solver;
std::shared_ptr<gko::LinOp> m_solver_tr;

int m_cols_per_chunk; // Maximum number of columns of B to be passed to a Ginkgo solver
Expand Down Expand Up @@ -153,7 +152,7 @@ class Matrix_Sparse : public Matrix

// Create the solver factory
std::shared_ptr const residual_criterion
= gko::stop::ResidualNorm<double>::build().with_reduction_factor(1e-19).on(
= gko::stop::ResidualNorm<double>::build().with_reduction_factor(1e-16).on(
gko_exec);

std::shared_ptr const iterations_criterion
Expand All @@ -165,7 +164,7 @@ class Matrix_Sparse : public Matrix
.on(gko_exec);

std::unique_ptr const solver_factory
= gko::solver::Bicgstab<double>::build()
= gko::solver::Gmres<double>::build()
.with_preconditioner(preconditioner)
.with_criteria(residual_criterion, iterations_criterion)
.on(gko_exec);
Expand Down
20 changes: 11 additions & 9 deletions vendor/ddc/include/ddc/kernels/splines/spline_builder_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ class SplineBuilder2D
/**
* @brief Create a new SplineBuilder2D.
*
* @param interpolation_domain
* @param vals_domain
* The 2D domain on which points will be provided in order to
* create the 2D spline approximation.
* @param cols_per_chunk The number of columns in the rhs passed to the underlying linear solver.
* @param preconditionner_max_block_size The block size of in the block Jacobi preconditioner.
*/
explicit SplineBuilder2D(
vals_domain_type const& vals_domain,
Expand Down Expand Up @@ -263,24 +265,24 @@ class SplineBuilder2D
* The coefficients of the spline calculated by the function.
* @param[in] vals
* The values of the function at the grid points.
* @param[in] derivs_xmin
* @param[in] derivs_min1
* The values of the derivatives at the lower boundary in the first dimension.
* @param[in] derivs_xmax
* @param[in] derivs_max1
* The values of the derivatives at the upper boundary in the first dimension.
* @param[in] derivs_ymin
* @param[in] derivs_min2
* The values of the derivatives at the lower boundary in the second dimension.
* @param[in] derivs_ymax
* @param[in] derivs_max2
* The values of the derivatives at the upper boundary in the second dimension.
* @param[in] mixed_derivs_xmin_ymin
* @param[in] mixed_derivs_min1_min2
* The values of the the cross-derivatives at the lower boundary in the first dimension
* and the lower boundary in the second dimension.
* @param[in] mixed_derivs_xmax_ymin
* @param[in] mixed_derivs_max1_min2
* The values of the the cross-derivatives at the upper boundary in the first dimension
* and the lower boundary in the second dimension.
* @param[in] mixed_derivs_xmin_ymax
* @param[in] mixed_derivs_min1_max2
* The values of the the cross-derivatives at the lower boundary in the first dimension
* and the upper boundary in the second dimension.
* @param[in] mixed_derivs_xmax_ymax
* @param[in] mixed_derivs_max1_max2
* The values of the the cross-derivatives at the upper boundary in the first dimension
* and the upper boundary in the second dimension.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,10 @@ class SplineEvaluator2D

/**
* @brief Get the the integral of the function on B-splines on the domain.
*
* @param[out] integrals
* The integrals of the function
* @param[in] spline_coef
* The B-splines coefficients of the function we want to integrate.
*
* @return A double with the value of the integral of the function.
*/
template <class Layout1, class Layout2>
void integrate(
Expand Down

0 comments on commit eabafe5

Please sign in to comment.