diff --git a/CMakeLists.txt b/CMakeLists.txt index 95d9626fb..4c1a3a268 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ if((NOT OGL_ALLOW_REFERENCE_ONLY) AND (NOT OGL_USE_EXTERNAL_GINKGO)) endif() set(GINKGO_CHECKOUT_VERSION - "ogl_rebase_1.8.0" + "multilevel-schwarz" CACHE STRING "Use specific version of ginkgo") include(CheckIncludeFileCXX) @@ -158,6 +158,8 @@ target_sources( PRIVATE common/common.C ${CMAKE_CURRENT_BINARY_DIR}/version.C lduLduBase/lduLduBase.C + HostMatrix/HostMatrix.C + HostMatrix/HostMatrixFreeFunctions.C StoppingCriterion/StoppingCriterion.C DevicePersistent/Base/Base.C DevicePersistent/Partition/Partition.C @@ -170,6 +172,8 @@ target_sources( BaseWrapper/CoupledLduBase/GKOCoupledLduBase.C Solver/CG/GKOCG.C Solver/BiCGStab/GKOBiCGStab.C + # Solver / IR / GKOIR.C + Solver/Multigrid/GKOMultigrid.C Solver/GMRES/GKOGMRES.C PUBLIC common/common.H StoppingCriterion/StoppingCriterion.H diff --git a/DevicePersistent/Array/Array.H b/DevicePersistent/Array/Array.H index 2981ad885..fd701f346 100644 --- a/DevicePersistent/Array/Array.H +++ b/DevicePersistent/Array/Array.H @@ -97,8 +97,6 @@ class PersistentArray mutable label size_; - const ExecutorHandler &exec_; - // indicating if the underlying array needs to // updated even if was found in the object registry const bool update_; @@ -133,7 +131,6 @@ public: ArrayInitFunctor(exec, name, size, verbose, on_device), update, verbose), size_(size), - exec_(exec), update_(update) {} @@ -160,7 +157,6 @@ public: update, verbose), memory_(memory), size_(size), - exec_(exec), update_(update) {} @@ -183,16 +179,16 @@ public: /* Create a Dense vector from underlying data * */ - std::shared_ptr> get_dense_vec() const - { - auto array = get_array(); - auto result = gko::share(vec::create( - exec_.get_device_exec(), gko::dim<2>(array->get_num_elems(), 1), - gko::array::view(exec_.get_device_exec(), array->get_num_elems(), - get_data()), - 1)); - return result; - } + // std::shared_ptr> get_dense_vec() const + // { + // auto array = get_array(); + // auto result = gko::share(vec::create( + // exec_.get_device_exec(), gko::dim<2>(array->get_num_elems(), 1), + // gko::array::view(exec_.get_device_exec(), array->get_num_elems(), + // get_data()), + // 1)); + // return result; + // } /* Copies from a distributed::Vector back into raw host memory * @@ -201,31 +197,28 @@ public: void copy_back( const std::shared_ptr> dist_x) { - auto host_view = gko::array::view(exec_.get_ref_exec(), size_, + auto dist_device_exec = dist_x->get_executor(); + auto host_view = gko::array::view(dist_device_exec->get_master(), size_, const_cast(memory_)); - auto dist_device_exec = dist_x->get_executor(); auto x_view = gko::array::view(dist_device_exec, size_, dist_x->get_local()->get_values()); host_view = x_view; } - void copy_back(const std::shared_ptr> device_x) - { - auto host_view = gko::array::view(exec_.get_ref_exec(), size_, - const_cast(memory_)); - - auto x_view = gko::array::view(exec_.get_device_exec(), size_, - device_x->get_values()); - - host_view = x_view; - } + // void copy_back(const std::shared_ptr> device_x) + // { + // auto host_view = gko::array::view(exec_.get_ref_exec(), size_, + // const_cast(memory_)); + // + // auto x_view = gko::array::view(exec_.get_device_exec(), size_, + // device_x->get_values()); + // + // host_view = x_view; + // } void set_size(const label size) const { size_ = size; } - - - const ExecutorHandler &get_exec_handler() const { return exec_; } }; } // namespace Foam diff --git a/DevicePersistent/Base/Base.C b/DevicePersistent/Base/Base.C index abf416eef..9801a6621 100644 --- a/DevicePersistent/Base/Base.C +++ b/DevicePersistent/Base/Base.C @@ -29,4 +29,10 @@ defineTemplateTypeNameWithName(DevicePersistentBase, typedef gko::experimental::distributed::Matrix GkoMatrix; defineTemplateTypeNameWithName(DevicePersistentBase, "PersistentMatrix"); + +// typedef needed to avoid confusion with the comma separated template +// arguments as macro arguments +typedef gko::experimental::distributed::Partition Partition; +defineTemplateTypeNameWithName(DevicePersistentBase, + "PersistentPartition"); } // namespace Foam diff --git a/DevicePersistent/CsrMatrixWrapper/CsrMatrixWrapper.H b/DevicePersistent/CsrMatrixWrapper/CsrMatrixWrapper.H index 8962e1b39..a03c5b9db 100644 --- a/DevicePersistent/CsrMatrixWrapper/CsrMatrixWrapper.H +++ b/DevicePersistent/CsrMatrixWrapper/CsrMatrixWrapper.H @@ -38,6 +38,8 @@ struct MatrixInitFunctor { const PersistentArray &non_local_coeffs_; + const CommunicationPattern &communication_pattern_; + const word matrix_format_; const bool regenerate_; @@ -54,6 +56,7 @@ struct MatrixInitFunctor { const PersistentArray