Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TpetraTSQR: Run on NVIDIA GPUs; ensure correct testing; refactor #6488

Merged
merged 101 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
05ef854
TSQR: Remove more use of Node from TSQR adapters
Dec 2, 2019
66f3cca
TSQR: Remove dead method prepareNodeTsqr
Dec 2, 2019
91ae70a
TSQR: Remove dead code from NodeTsqrFactory
Dec 2, 2019
47287f9
TSQR::Tsqr: Use NodeTsqr subclasses only thru base class
Dec 2, 2019
6da8b0c
TSQR::NodeTsqrFactory no longer refers to node_type
Dec 2, 2019
037f650
TSQR: "Factory-ify" NodeTsqr subclass creation
Dec 3, 2019
157fe6b
TSQR: Make sure "full" test exercises KokkosNodeTsqr
Dec 3, 2019
31b3f35
TSQR: Improve full TSQR test; prevent test failures for now
Dec 4, 2019
0071167
TSQR: Improve Combine test; add more test cases
Dec 4, 2019
5ba5088
TSQR::Combine: Make methods nonconst
Dec 5, 2019
70b27aa
TSQR: Make Combine test exercise both Combine implementations
Dec 5, 2019
83a4838
TSQR: Add CombineNodeTsqr
Dec 6, 2019
d8752dc
TSQR: Fix Clang build warnings in {KokkosNode,Sequential}Tsqr
Dec 6, 2019
517da93
TSQR: In full test, check if R factor is all zeros
Dec 6, 2019
c4fe0bd
TSQR::NodeTsqrFactory: Let user specify NodeTsqr type as string
Dec 6, 2019
aa92092
TSQR: Add generic NodeTsqr test
Dec 6, 2019
bd40849
TSQR: Minor changes to generic NodeTsqr test
Dec 7, 2019
d6689cf
TSQR: Make Combine test output consistent with NodeTsqr test
Dec 7, 2019
d88d48f
TSQR: Fix saveMatrices option in generic NodeTsqr test
Dec 7, 2019
d2688e8
TSQR::CombineNodeTsqr::factor: Fix bug
Dec 7, 2019
a83f5d9
TSQR::SequentialTsqr: Minor fix (not affecting tests)
Dec 7, 2019
f5dc094
TSQR: Add accuracy bounds to generic NodeTsqr test
Dec 7, 2019
3cf037c
TSQR: Use generic NodeTsqr test to test SequentialTsqr
Dec 7, 2019
cecc610
TSQR: Remove redundant test files
Dec 7, 2019
9bdffe6
TSQR::NodeTsqrFactory: Change default to work around KokkosNodeTsqr
Dec 8, 2019
7fa8a66
TSQR::CombineNative: Add type aliases to make code more readable
Dec 8, 2019
b42a4d1
TSQR: Purge TbbTsqr; change Combine::apply_pair to take MatView
Dec 9, 2019
ea36c1f
TSQR: Purge any leftover TBB- or TbbTsqr-related code
Dec 9, 2019
f98fb80
TSQR: Change Combine::apply_inner to take MatView
Dec 9, 2019
b1bf6ab
TSQR::SequentialTsqr: Remove dependency on MatView layout
Dec 9, 2019
93a5376
TSQR::Combine: Add work_size
Dec 9, 2019
1dc3200
TSQR: Use Combine::work_size in all places TSQR uses Combine
Dec 9, 2019
5de3733
TSQR::CombineDefault: Use LAPACK lwork query to get workspace size
Dec 9, 2019
8a617eb
TSQR::KokkosNodeTsqr: Fix unused variable warning
Dec 9, 2019
386dd10
TSQR::NodeTsqrFactory: Fix tests with CUDA build
Dec 9, 2019
c7262eb
TSQR::MatView: Make split_top a nonmember function
Dec 9, 2019
fff9fb5
TSQR::MatView: Make split_bottom a nonmember function
Dec 9, 2019
7937368
TSQR::MatView: Remove unused row_block instance method
Dec 9, 2019
a094897
TSQR::Mat{View,trix}: Make empty nonmember; remove op{==,!=}
Dec 9, 2019
390355b
TSQR: Make copy_upper_triangle work with MatView, not raw pointers
Dec 10, 2019
d1b43a7
TSQR: Remove unused comparison operators
Dec 10, 2019
0277a89
TSQR: Add fill_with_identity_columns function
Dec 10, 2019
48069b2
TSQR: Remove unused functions (un)pack_R_factor
Dec 10, 2019
f6617bc
TSQR: Add CUSOLVER & CUBLAS TPLs; test handle creation
Dec 10, 2019
7d7e62f
TSQR: Add interface to CuSolver _GEQRF and _ORMQR / _UNMQR
Dec 11, 2019
0c4de16
TSQR: Add interface to CuBlas _GEMM
Dec 11, 2019
117b195
TSQR: Add CuBlas, CuSolver, & CudaValue tests
Dec 12, 2019
75ea9a7
TSQR: Add CuSolverNodeTsqr to NodeTsqrFactory
Dec 12, 2019
92524ed
TSQR: Fix NodeTsqr test to initialize & finalize Kokkos
Dec 12, 2019
f829337
TSQR: CuSolverNodeTsqr runs in NodeTsqr test w/out crashing
Dec 12, 2019
d4913a0
TSQR::Impl::Lapack: Use extern template instead of macros
Dec 12, 2019
a7f72dd
TSQR::Impl::CuSolver: Take info in constructor, not methods
Dec 12, 2019
5ae9db3
TSQR: Add lwork versions of compute_QR & compute_explicit_Q
Dec 12, 2019
27127fd
TSQR: Add apply_Q_factor_lwork to Impl::Lapack
Dec 13, 2019
00ead42
TSQR: Rename unmqr* methods of CuSolver to apply_Q_factor*
Dec 13, 2019
7aa668c
TSQR: Add all 3 lwork query methods to Impl::RawQR
Dec 13, 2019
ed8c9e3
TSQR: Make CuSolver methods all const, to match RawQR
Dec 13, 2019
c903515
TSQR: Make CuSolver inherit from RawQR
Dec 13, 2019
706d15c
TSQR: Add wants_device_memory method to RawQR; override in CuSolver
Dec 13, 2019
6863ec0
TSQR: Start refactoring test to exercise Impl::CuSolver
Dec 16, 2019
9f2fed4
TSQR: Start making Lapack test work with CuSolver
Dec 16, 2019
9c144e5
TSQR: Test Impl::CuSolver along with LAPACK; tests pass
Dec 16, 2019
7074ea0
TSQR::CuSolverNodeTsqr runs & passes tests
Dec 16, 2019
43acd24
TSQR::Tsqr: Start refactoring to work with CuSolverNodeTsqr
Dec 17, 2019
87271a6
TSQR::Tsqr: Add comments for things to fix; clean up code a bit
Dec 17, 2019
04c9ce2
TSQR: Prepare Tsqr for working with device memory
Dec 17, 2019
54f9b7b
TSQR::CuSolverNodeTsqr: Implement NodeTsqr::fill_with_identity_columns
Dec 17, 2019
4ea72ff
TSQR: Remove nonmember fill_with_identity_columns function
Dec 17, 2019
cad85a4
TSQR: fill_with_identity_columns -> set_diagonal_entries_to_one
Dec 17, 2019
dfa8261
TSQR::CuSolverNodeTsqr: Ensure contiguous storage for temp matrices
Dec 17, 2019
e322867
TSQR::Tsqr: Full test passes with CuSolverNodeTsqr
Dec 18, 2019
606d86a
TSQR::NodeTsqrFactory: Return CuSolverNodeTsqr by default if available
Dec 19, 2019
7825917
TSQR: Add more tests
Dec 19, 2019
2758f72
TSQR: Start converting NodeTsqr benchmark to permit device memory
Dec 19, 2019
99e54e2
TSQR: NodeTsqr benchmark works w/ CuSolverNodeTsqr now
Dec 19, 2019
6034d25
TSQR: NodeTsqr benchmark can now test all NodeTsqr subclasses
Dec 19, 2019
cb93936
TSQR: Remove unused test header file
Dec 19, 2019
b116ba6
TSQR: Add lwork parameter to Combine::apply_first
Dec 19, 2019
e1a7ccd
TSQR: Add lwork parameter to Combine::factor_first
Dec 19, 2019
32c56c7
TSQR: Add lwork parameter to Combine::{factor,apply}_inner
Dec 19, 2019
8d555f2
TSQR: Add lwork parameter to Combine::{factor,apply}_pair
Dec 19, 2019
70778c7
TSQR: Remove KokkosNodeTsqr
Dec 19, 2019
c6db49b
TSQR::CuSolverNodeTsqr: Fix CUDA build warning
Dec 20, 2019
ee8f1d8
TSQR::SequentialTsqr: Remove unnecessary helper functions
Dec 20, 2019
0fe2de1
TSQR::CombineNodeTsqr: Refactor a bit in prep for CombineFactory
Dec 20, 2019
74f9aec
TSQR: Refactor Combine into abstract base class
Dec 20, 2019
2010f7a
TSQR: Remove superfluous test files
Dec 21, 2019
b68ae0f
TSQR: Move DistTsqr test code into test directory
Dec 21, 2019
4ab6fe1
TSQR::Combine: Make work_size return ordinal_type, not size_t
Dec 21, 2019
e5ffed7
TSQR::Impl::Lapack: Attempt to address Intel 17 link errors
Dec 22, 2019
b379071
TSQR: Make sure DistTsqr test initializes & finalizes Kokkos
Dec 22, 2019
6384388
TSQR::CombineDefault: Fix build warning (unused variable)
Dec 22, 2019
57acdc8
TSQR: Add class to simplify MPI & Kokkos init & finalize in tests
Dec 22, 2019
f8430af
TSQR: Make Combine test initialize & finalize Kokkos
Dec 22, 2019
5c1c90a
TSQR: Clean up Combine test
Dec 22, 2019
b765b60
TSQR: Clean up Combine & DistTsqr tests more
Dec 22, 2019
ee28545
TSQR: Clean up "full" TSQR test
Dec 22, 2019
50530d7
TSQR: Clean up NodeTsqr test
Dec 22, 2019
21b6a6a
TSQR: Add debugging code to Test::MpiAndKokkosScope
Dec 23, 2019
6923ae4
TSQR: Work around possible Intel 17 bug
Dec 23, 2019
842320a
Tpetra: Make TsqrAdaptor use device memory if TSQR wants it
Dec 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions TPLsList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ TRIBITS_REPOSITORY_DEFINE_TPLS(
yaml-cpp "cmake/TPLs/" EX
Peano "cmake/TPLs/" EX
CUDA "${${PROJECT_NAME}_TRIBITS_DIR}/core/std_tpls/" PT
CUBLAS "cmake/TPLs/" PT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm adding new TPLs. On the other hand, these are trivial to enable when CUDA is enabled: just set TPL_ENABLE_CUBLAS=ON etc. I will work on automating that.

CUSOLVER "cmake/TPLs/" PT
CUSPARSE "cmake/TPLs/" PT
Thrust "cmake/TPLs/" ST
Cusp "cmake/TPLs/" ST
Expand Down
70 changes: 70 additions & 0 deletions cmake/TPLs/FindTPLCUBLAS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# @HEADER
# ************************************************************************
#
# Trilinos: An Object-Oriented Solver Framework
# Copyright (2001) Sandia Corporation
#
#
# Copyright (2001) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000, there is a non-exclusive license for use of this
# work by or on behalf of the U.S. Government. Export of this program
# may require a license from the United States Government.
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# NOTICE: The United States Government is granted for itself and others
# acting on its behalf a paid-up, nonexclusive, irrevocable worldwide
# license in this data to reproduce, prepare derivative works, and
# perform publicly and display publicly. Beginning five (5) years from
# July 25, 2001, the United States Government is granted for itself and
# others acting on its behalf a paid-up, nonexclusive, irrevocable
# worldwide license in this data to reproduce, prepare derivative works,
# distribute copies to the public, perform publicly and display
# publicly, and to permit others to do so.
#
# NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT
# OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES
# ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR
# RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY
# INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS
# THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#
# ************************************************************************
# @HEADER

IF (NOT TPL_ENABLE_CUDA)
MESSAGE(FATAL_ERROR "\nCUBLAS: This TPL requires CUDA")
ELSE()
find_library(CUDA_cublas_LIBRARY
cublas
HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib
)
IF(CUDA_cublas_LIBRARY STREQUAL "CUDA_cublas_LIBRARY-NOTFOUND")
MESSAGE(FATAL_ERROR "\nCUBLAS: could not find cublas library.")
ENDIF()
GLOBAL_SET(TPL_CUBLAS_LIBRARY_DIRS)
GLOBAL_SET(TPL_CUBLAS_INCLUDE_DIRS ${TPL_CUDA_INCLUDE_DIRS})
GLOBAL_SET(TPL_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY})
ENDIF()

70 changes: 70 additions & 0 deletions cmake/TPLs/FindTPLCUSOLVER.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# @HEADER
# ************************************************************************
#
# Trilinos: An Object-Oriented Solver Framework
# Copyright (2001) Sandia Corporation
#
#
# Copyright (2001) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000, there is a non-exclusive license for use of this
# work by or on behalf of the U.S. Government. Export of this program
# may require a license from the United States Government.
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# NOTICE: The United States Government is granted for itself and others
# acting on its behalf a paid-up, nonexclusive, irrevocable worldwide
# license in this data to reproduce, prepare derivative works, and
# perform publicly and display publicly. Beginning five (5) years from
# July 25, 2001, the United States Government is granted for itself and
# others acting on its behalf a paid-up, nonexclusive, irrevocable
# worldwide license in this data to reproduce, prepare derivative works,
# distribute copies to the public, perform publicly and display
# publicly, and to permit others to do so.
#
# NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT
# OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES
# ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR
# RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY
# INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS
# THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#
# ************************************************************************
# @HEADER

IF (NOT TPL_ENABLE_CUDA)
MESSAGE(FATAL_ERROR "\nCUSOLVER: This TPL requires CUDA")
ELSE()
find_library(CUDA_cusolver_LIBRARY
cusolver
HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib
)
IF(CUDA_cusolver_LIBRARY STREQUAL "CUDA_cusolver_LIBRARY-NOTFOUND")
MESSAGE(FATAL_ERROR "\nCUSOLVER: could not find cusolver library.")
ENDIF()
GLOBAL_SET(TPL_CUSOLVER_LIBRARY_DIRS)
GLOBAL_SET(TPL_CUSOLVER_INCLUDE_DIRS ${TPL_CUDA_INCLUDE_DIRS})
GLOBAL_SET(TPL_CUSOLVER_LIBRARIES ${CUDA_cusolver_LIBRARY})
ENDIF()

Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux ([email protected])
//
// ************************************************************************
// @HEADER

Expand All @@ -48,18 +46,18 @@

#include "Stokhos_Sacado_Kokkos_UQ_PCE.hpp"

# include <Tsqr_NodeTsqrFactory.hpp> // create intranode TSQR object
# include <Tsqr.hpp> // full (internode + intranode) TSQR
# include <Tsqr_DistTsqr.hpp> // internode TSQR
# include "Tsqr_NodeTsqrFactory.hpp" // create intranode TSQR object
# include "Tsqr.hpp" // full (internode + intranode) TSQR
# include "Tsqr_DistTsqr.hpp" // internode TSQR
// Subclass of TSQR::MessengerBase, implemented using Teuchos
// communicator template helper functions
# include <Tsqr_TeuchosMessenger.hpp>
# include <Tpetra_MultiVector.hpp>
# include <Teuchos_ParameterListAcceptorDefaultBase.hpp>
# include "Tsqr_TeuchosMessenger.hpp"
# include "Tpetra_MultiVector.hpp"
# include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
# include <stdexcept>

// Base TsqrAdator template we will specialize
# include <Tpetra_TsqrAdaptor.hpp>
# include "Tpetra_TsqrAdaptor.hpp"

namespace Tpetra {

Expand All @@ -81,16 +79,16 @@ namespace Tpetra {
typedef typename mp_scalar_type::scalar_type scalar_type;
typedef typename mp_scalar_type::ordinal_type mp_ordinal_type;
typedef typename MV::local_ordinal_type ordinal_type;
typedef typename MV::node_type node_type;
typedef Teuchos::SerialDenseMatrix<ordinal_type, scalar_type> dense_matrix_type;
typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;

private:
//typedef TSQR::MatView<ordinal_type, scalar_type> matview_type;
typedef TSQR::NodeTsqrFactory<node_type, scalar_type, ordinal_type> node_tsqr_factory_type;
typedef typename node_tsqr_factory_type::node_tsqr_type node_tsqr_type;
typedef TSQR::DistTsqr<ordinal_type, scalar_type> dist_tsqr_type;
typedef TSQR::Tsqr<ordinal_type, scalar_type, node_tsqr_type> tsqr_type;
using node_tsqr_factory_type =
TSQR::NodeTsqrFactory<scalar_type, ordinal_type,
typename MV::device_type>;
using node_tsqr_type = TSQR::NodeTsqr<ordinal_type, scalar_type>;
using dist_tsqr_type = TSQR::DistTsqr<ordinal_type, scalar_type>;
using tsqr_type = TSQR::Tsqr<ordinal_type, scalar_type>;

public:
/// \brief Constructor (that accepts a parameter list).
Expand All @@ -100,7 +98,7 @@ namespace Tpetra {
/// implementation. For details, call \c getValidParameters()
/// and examine the documentation embedded therein.
TsqrAdaptor (const Teuchos::RCP<Teuchos::ParameterList>& plist) :
nodeTsqr_ (new node_tsqr_type),
nodeTsqr_ (node_tsqr_factory_type::getNodeTsqr ()),
distTsqr_ (new dist_tsqr_type),
tsqr_ (new tsqr_type (nodeTsqr_, distTsqr_)),
ready_ (false)
Expand All @@ -110,7 +108,7 @@ namespace Tpetra {

//! Constructor (that uses default parameters).
TsqrAdaptor () :
nodeTsqr_ (new node_tsqr_type),
nodeTsqr_ (new node_tsqr_factory_type::getNodeTsqr ()),
distTsqr_ (new dist_tsqr_type),
tsqr_ (new tsqr_type (nodeTsqr_, distTsqr_)),
ready_ (false)
Expand Down Expand Up @@ -289,20 +287,10 @@ namespace Tpetra {
{
if (! ready_) {
prepareDistTsqr (mv);
prepareNodeTsqr (mv);
ready_ = true;
}
}

/// \brief Finish intraprocess TSQR initialization.
///
/// \note It's OK to call this method more than once; it is idempotent.
void
prepareNodeTsqr (const MV& mv)
{
node_tsqr_factory_type::prepareNodeTsqr (nodeTsqr_);
}

/// \brief Finish interprocess TSQR initialization.
///
/// \param mv [in] A valid Tpetra::MultiVector instance whose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux ([email protected])
//
// ************************************************************************
// @HEADER

Expand All @@ -48,18 +46,18 @@

#include "Stokhos_Sacado_Kokkos_MP_Vector.hpp"

# include <Tsqr_NodeTsqrFactory.hpp> // create intranode TSQR object
# include <Tsqr.hpp> // full (internode + intranode) TSQR
# include <Tsqr_DistTsqr.hpp> // internode TSQR
# include "Tsqr_NodeTsqrFactory.hpp" // create intranode TSQR object
# include "Tsqr.hpp" // full (internode + intranode) TSQR
# include "Tsqr_DistTsqr.hpp" // internode TSQR
// Subclass of TSQR::MessengerBase, implemented using Teuchos
// communicator template helper functions
# include <Tsqr_TeuchosMessenger.hpp>
# include <Tpetra_MultiVector.hpp>
# include <Teuchos_ParameterListAcceptorDefaultBase.hpp>
# include "Tsqr_TeuchosMessenger.hpp"
# include "Tpetra_MultiVector.hpp"
# include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
# include <stdexcept>

// Base TsqrAdator template we will specialize
# include <Tpetra_TsqrAdaptor.hpp>
# include "Tpetra_TsqrAdaptor.hpp"

namespace Tpetra {

Expand All @@ -81,16 +79,16 @@ namespace Tpetra {
typedef typename mp_scalar_type::scalar_type scalar_type;
typedef typename mp_scalar_type::ordinal_type mp_ordinal_type;
typedef typename MV::local_ordinal_type ordinal_type;
typedef typename MV::node_type node_type;
typedef Teuchos::SerialDenseMatrix<ordinal_type, scalar_type> dense_matrix_type;
typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;

private:
//typedef TSQR::MatView<ordinal_type, scalar_type> matview_type;
typedef TSQR::NodeTsqrFactory<node_type, scalar_type, ordinal_type> node_tsqr_factory_type;
typedef typename node_tsqr_factory_type::node_tsqr_type node_tsqr_type;
typedef TSQR::DistTsqr<ordinal_type, scalar_type> dist_tsqr_type;
typedef TSQR::Tsqr<ordinal_type, scalar_type, node_tsqr_type> tsqr_type;
using node_tsqr_factory_type =
TSQR::NodeTsqrFactory<scalar_type, ordinal_type,
typename MV::device_type>;
using node_tsqr_type = TSQR::NodeTsqr<ordinal_type, scalar_type>;
using dist_tsqr_type = TSQR::DistTsqr<ordinal_type, scalar_type>;
using tsqr_type = TSQR::Tsqr<ordinal_type, scalar_type>;

public:
/// \brief Constructor (that accepts a parameter list).
Expand All @@ -100,7 +98,7 @@ namespace Tpetra {
/// implementation. For details, call \c getValidParameters()
/// and examine the documentation embedded therein.
TsqrAdaptor (const Teuchos::RCP<Teuchos::ParameterList>& plist) :
nodeTsqr_ (new node_tsqr_type),
nodeTsqr_ (node_tsqr_factory_type::getNodeTsqr ()),
distTsqr_ (new dist_tsqr_type),
tsqr_ (new tsqr_type (nodeTsqr_, distTsqr_)),
ready_ (false)
Expand All @@ -110,7 +108,7 @@ namespace Tpetra {

//! Constructor (that uses default parameters).
TsqrAdaptor () :
nodeTsqr_ (new node_tsqr_type),
nodeTsqr_ (node_tsqr_factory_type::getNodeTsqr ()),
distTsqr_ (new dist_tsqr_type),
tsqr_ (new tsqr_type (nodeTsqr_, distTsqr_)),
ready_ (false)
Expand Down Expand Up @@ -289,20 +287,10 @@ namespace Tpetra {
{
if (! ready_) {
prepareDistTsqr (mv);
prepareNodeTsqr (mv);
ready_ = true;
}
}

/// \brief Finish intraprocess TSQR initialization.
///
/// \note It's OK to call this method more than once; it is idempotent.
void
prepareNodeTsqr (const MV& mv)
{
node_tsqr_factory_type::prepareNodeTsqr (nodeTsqr_);
}

/// \brief Finish interprocess TSQR initialization.
///
/// \param mv [in] A valid Tpetra::MultiVector instance whose
Expand Down
11 changes: 1 addition & 10 deletions packages/stratimikos/adapters/belos/src/Thyra_TsqrAdaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,6 @@ namespace Thyra {
#endif // HAVE_MPI
}

/// \brief Finish intraprocess TSQR initialization.
///
/// \note It's OK to call this method more than once; it is idempotent.
void
prepareNodeTsqr (const MV& /* X */) {}

/// \brief Finish interprocess TSQR initialization.
///
/// Input X is a valid Thyra::MultiVectorBase instance whose
Expand Down Expand Up @@ -306,10 +300,7 @@ namespace Thyra {
/// All multivector objects used with this adapter must have the
/// same communicator and Kokkos Node instance (if applicable).
void
prepareTsqr (const MV& /* X */)
{
throw std::logic_error ("Thyra adaptor for TSQR not implemented");
}
prepareTsqr (const MV& /* X */) {}
};

} // namespace Tpetra
Expand Down
Loading