Zoltan2
Loading...
Searching...
No Matches
XpetraEpetraMap.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Zoltan2: A package of combinatorial algorithms for scientific computing
4//
5// Copyright 2012 NTESS and the Zoltan2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10// Program to debug segfaults being reported in CDASH when
11// -D KokkosClassic_DefaultNode:STRING=Tpetra::KokkosCompat::KokkosOpenMPWrapperNode
12// -D Trilinos_ENABLE_OpenMP:BOOL=ON
13// Problem appears to be in creation of Xpetra::EpetraMapT
14
15#include <Teuchos_RCP.hpp>
16#include <Teuchos_DefaultComm.hpp>
17#include <Teuchos_Comm.hpp>
18
19#include <Tpetra_Map.hpp>
20#include <Epetra_Map.h>
21#include <Xpetra_EpetraMap.hpp>
22#include <Xpetra_EpetraUtils.hpp>
23
24int main(int narg, char **arg)
25{
26 Tpetra::ScopeGuard tscope(&narg, &arg);
27 Teuchos::RCP<const Teuchos::Comm<int> > tcomm = Tpetra::getDefaultComm();
28 Teuchos::RCP<const Epetra_Comm> ecomm = Xpetra::toEpetra(tcomm);
29
30 const int nGlobRows = 50;
31 const Epetra_Map emap(nGlobRows, 0, *ecomm);
32 Teuchos::RCP<const Epetra_BlockMap> ebmap = Teuchos::rcpFromRef(emap);
33
34 typedef Xpetra::EpetraMapT<int, Tpetra::Map<>::node_type> xemap_t;
35 Teuchos::RCP<const xemap_t> xmap(new xemap_t(ebmap));
36
37 const Teuchos::RCP<const Teuchos::Comm<int> > &xcomm = xmap->getComm();
38
39 std::cout << "Teuchos: Hello from "
40 << tcomm->getRank() << " of "
41 << tcomm->getSize() << std::endl;
42 std::cout << "Epetra: Hello from "
43 << ecomm->MyPID() << " of "
44 << ecomm->NumProc() << std::endl;
45 std::cout << "Xpetra: Hello from "
46 << xcomm->getRank() << " of "
47 << xcomm->getSize() << std::endl;
48}
int main()