Skip to content

Commit

Permalink
Xpetra HIP support
Browse files Browse the repository at this point in the history
Adding more HIP specialization for Epetra class when HAVE_TPETRA_INST_HIP
is defined.
  • Loading branch information
lucbv committed Jul 21, 2021
1 parent 8f2c8c9 commit 4670ef8
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 6 deletions.
10 changes: 10 additions & 0 deletions packages/xpetra/src/Export/Xpetra_EpetraExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
template class EpetraExportT<int, default_node_type >;
template RCP<const Export<int, int, default_node_type> > toXpetra<int,default_node_type>(const Epetra_Export *);
#endif
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraExportT<int, default_node_type >;
template RCP<const Export<int, int, default_node_type> > toXpetra<int,default_node_type>(const Epetra_Export *);
#endif
#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down Expand Up @@ -118,6 +123,11 @@ typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
template class EpetraExportT<long long, default_node_type >;
template RCP<const Export<int, long long, default_node_type> > toXpetra<long long,default_node_type>(const Epetra_Export *);
#endif
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraExportT<long long, default_node_type >;
template RCP<const Export<int, long long, default_node_type> > toXpetra<long long,default_node_type>(const Epetra_Export *);
#endif
#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down
9 changes: 7 additions & 2 deletions packages/xpetra/src/Import/Xpetra_EpetraImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
template class EpetraImportT<int, default_node_type >;
template RCP<const Import<int, int, default_node_type> > toXpetra<int,default_node_type>(const Epetra_Import *);
#endif
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraImportT<int, default_node_type >;
template RCP<const Import<int, int, default_node_type> > toXpetra<int,default_node_type>(const Epetra_Import *);
#endif
#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down Expand Up @@ -114,8 +119,8 @@ template RCP<const Import<int,long long,Kokkos::Compat::KokkosThreadsWrapperNode
template class EpetraImportT<long long, Kokkos::Compat::KokkosOpenMPWrapperNode >;
template RCP<const Import<int, long long, Kokkos::Compat::KokkosOpenMPWrapperNode> > toXpetra<long long,Kokkos::Compat::KokkosOpenMPWrapperNode>(const Epetra_Import *);
#endif
#ifdef HAVE_TPETRA_INST_CUDA
typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraImportT<long long, default_node_type >;
template RCP<const Import<int, long long, default_node_type> > toXpetra<long long,default_node_type>(const Epetra_Import *);
#endif
Expand Down
15 changes: 15 additions & 0 deletions packages/xpetra/src/Map/Xpetra_EpetraMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ template const RCP< const Map<int, int, default_node_type > > toXpetra<int, defa
template const Epetra_Map & toEpetra<int, default_node_type >(const RCP< const Map<int, int, default_node_type > > &map);
template const Epetra_Map & toEpetra<int, default_node_type >(const Map< int, int, default_node_type> & map);
#endif
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
//template class EpetraMapT<int, default_node_type >;
template const RCP< const Map<int, int, default_node_type > > toXpetra<int, default_node_type>(const Epetra_BlockMap &map);
template const Epetra_Map & toEpetra<int, default_node_type >(const RCP< const Map<int, int, default_node_type > > &map);
template const Epetra_Map & toEpetra<int, default_node_type >(const Map< int, int, default_node_type> & map);
#endif
#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down Expand Up @@ -161,6 +168,14 @@ template const Epetra_Map & toEpetra<long long, default_node_type >(const RCP< c
template const Epetra_Map & toEpetra<long long, default_node_type >(const Map< int, long long, default_node_type> & map);
#endif

#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
//template class EpetraMapT<long long, default_node_type >;
template const RCP< const Map<int, long long, default_node_type > > toXpetra<long long, default_node_type>(const Epetra_BlockMap &map);
template const Epetra_Map & toEpetra<long long, default_node_type >(const RCP< const Map<int, long long, default_node_type > > &map);
template const Epetra_Map & toEpetra<long long, default_node_type >(const Map< int, long long, default_node_type> & map);
#endif

#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down
10 changes: 8 additions & 2 deletions packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ template class EpetraIntMultiVectorT<int, default_node_type >;
template Epetra_IntMultiVector & toEpetra<int,default_node_type >(MultiVector<int, int, int, default_node_type> &);
template const Epetra_IntMultiVector & toEpetra<int,default_node_type >(const MultiVector<int, int, int, default_node_type> &);
#endif
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraIntMultiVectorT<int, default_node_type >;
template Epetra_IntMultiVector & toEpetra<int,default_node_type >(MultiVector<int, int, int, default_node_type> &);
template const Epetra_IntMultiVector & toEpetra<int,default_node_type >(const MultiVector<int, int, int, default_node_type> &);
#endif
#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down Expand Up @@ -127,8 +133,8 @@ template class EpetraIntMultiVectorT<long long, Kokkos::Compat::KokkosOpenMPWrap
template Epetra_IntMultiVector & toEpetra<long long,Kokkos::Compat::KokkosOpenMPWrapperNode >(MultiVector<int, int, long long, Kokkos::Compat::KokkosOpenMPWrapperNode> &);
template const Epetra_IntMultiVector & toEpetra<long long, Kokkos::Compat::KokkosOpenMPWrapperNode >(const MultiVector<int, int, long long, Kokkos::Compat::KokkosOpenMPWrapperNode> &);
#endif
#ifdef HAVE_TPETRA_INST_CUDA
typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraIntMultiVectorT<long long, default_node_type >;
template Epetra_IntMultiVector & toEpetra<long long,default_node_type >(MultiVector<int, int, long long, default_node_type> &);
template const Epetra_IntMultiVector & toEpetra<long long,default_node_type >(const MultiVector<int, int, long long, default_node_type> &);
Expand Down
12 changes: 12 additions & 0 deletions packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ template RCP<MultiVector<double, int, int, Kokkos::Compat::KokkosCudaWrapperNode
template Epetra_MultiVector & toEpetra<int,Kokkos::Compat::KokkosCudaWrapperNode >(MultiVector<double, int, int,Kokkos::Compat::KokkosCudaWrapperNode> &);
template const Epetra_MultiVector & toEpetra<int, Kokkos::Compat::KokkosCudaWrapperNode >(const MultiVector<double, int, int, Kokkos::Compat::KokkosCudaWrapperNode > &);
#endif
#ifdef HAVE_TPETRA_INST_HIP
template class EpetraMultiVectorT<int, Kokkos::Compat::KokkosHIPWrapperNode >;
template RCP<MultiVector<double, int, int, Kokkos::Compat::KokkosHIPWrapperNode > > toXpetra<int, Kokkos::Compat::KokkosHIPWrapperNode>(RCP<Epetra_MultiVector>);
template Epetra_MultiVector & toEpetra<int,Kokkos::Compat::KokkosHIPWrapperNode >(MultiVector<double, int, int,Kokkos::Compat::KokkosHIPWrapperNode> &);
template const Epetra_MultiVector & toEpetra<int, Kokkos::Compat::KokkosHIPWrapperNode >(const MultiVector<double, int, int, Kokkos::Compat::KokkosHIPWrapperNode > &);
#endif
#else // Tpetra is disabled
typedef Xpetra::EpetraNode default_node_type;
template class EpetraMultiVectorT<int, default_node_type >;
Expand Down Expand Up @@ -187,6 +193,12 @@ template RCP<MultiVector<double, int, long long, Kokkos::Compat::KokkosCudaWrapp
template Epetra_MultiVector & toEpetra<long long,Kokkos::Compat::KokkosCudaWrapperNode >(MultiVector<double, int, long long, Kokkos::Compat::KokkosCudaWrapperNode> &);
template const Epetra_MultiVector & toEpetra<long long, Kokkos::Compat::KokkosCudaWrapperNode >(const MultiVector<double, int, long long, Kokkos::Compat::KokkosCudaWrapperNode > &);
#endif
#ifdef HAVE_TPETRA_INST_HIP
template class EpetraMultiVectorT<long long, Kokkos::Compat::KokkosHIPWrapperNode >;
template RCP<MultiVector<double, int, long long, Kokkos::Compat::KokkosHIPWrapperNode > > toXpetra<long long, Kokkos::Compat::KokkosHIPWrapperNode>(RCP<Epetra_MultiVector>);
template Epetra_MultiVector & toEpetra<long long,Kokkos::Compat::KokkosHIPWrapperNode >(MultiVector<double, int, long long, Kokkos::Compat::KokkosHIPWrapperNode> &);
template const Epetra_MultiVector & toEpetra<long long, Kokkos::Compat::KokkosHIPWrapperNode >(const MultiVector<double, int, long long, Kokkos::Compat::KokkosHIPWrapperNode > &);
#endif
#else // Tpetra is disabled
typedef Xpetra::EpetraNode default_node_type;
template class EpetraMultiVectorT<long long, default_node_type >;
Expand Down
12 changes: 12 additions & 0 deletions packages/xpetra/src/Vector/Xpetra_EpetraIntVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ template class EpetraIntVectorT<int, default_node_type >;
template Epetra_IntVector & toEpetra<int,default_node_type >(Vector<int, int, int, default_node_type> &);
template const Epetra_IntVector & toEpetra<int,default_node_type >(const Vector<int, int, int, default_node_type> &);
#endif
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraIntVectorT<int, default_node_type >;
template Epetra_IntVector & toEpetra<int,default_node_type >(Vector<int, int, int, default_node_type> &);
template const Epetra_IntVector & toEpetra<int,default_node_type >(const Vector<int, int, int, default_node_type> &);
#endif
#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down Expand Up @@ -133,6 +139,12 @@ template class EpetraIntVectorT<long long, default_node_type >;
template Epetra_IntVector & toEpetra<long long,default_node_type >(Vector<int, int, long long, default_node_type> &);
template const Epetra_IntVector & toEpetra<long long,default_node_type >(const Vector<int, int, long long, default_node_type> &);
#endif
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraIntVectorT<long long, default_node_type >;
template Epetra_IntVector & toEpetra<long long,default_node_type >(Vector<int, int, long long, default_node_type> &);
template const Epetra_IntVector & toEpetra<long long,default_node_type >(const Vector<int, int, long long, default_node_type> &);
#endif
#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down
10 changes: 8 additions & 2 deletions packages/xpetra/src/Vector/Xpetra_EpetraVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ template class EpetraVectorT<int, default_node_type >;
template Epetra_Vector & toEpetra<int,default_node_type >(Vector<double, int, int, default_node_type> &);
template const Epetra_Vector & toEpetra<int, default_node_type >(const Vector<double, int, int, default_node_type> &);
#endif
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraVectorT<int, default_node_type >;
template Epetra_Vector & toEpetra<int,default_node_type >(Vector<double, int, int, default_node_type> &);
template const Epetra_Vector & toEpetra<int, default_node_type >(const Vector<double, int, int, default_node_type> &);
#endif
#else
// Tpetra is disabled and Kokkos not available: use dummy node type
typedef Xpetra::EpetraNode default_node_type;
Expand Down Expand Up @@ -128,8 +134,8 @@ template class EpetraVectorT<long long, Kokkos::Compat::KokkosOpenMPWrapperNode
template Epetra_Vector & toEpetra<long long,Kokkos::Compat::KokkosOpenMPWrapperNode>(Vector<double, int, long long, Kokkos::Compat::KokkosOpenMPWrapperNode> &);
template const Epetra_Vector & toEpetra<long long,Kokkos::Compat::KokkosOpenMPWrapperNode>(const Vector<double, int, long long, Kokkos::Compat::KokkosOpenMPWrapperNode> &);
#endif
#ifdef HAVE_TPETRA_INST_CUDA
typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
#ifdef HAVE_TPETRA_INST_HIP
typedef Kokkos::Compat::KokkosHIPWrapperNode default_node_type;
template class EpetraVectorT<long long, default_node_type >;
template Epetra_Vector & toEpetra<long long,default_node_type >(Vector<double, int, long long, default_node_type> &);
template const Epetra_Vector & toEpetra<long long, default_node_type >(const Vector<double, int, long long, default_node_type> &);
Expand Down
8 changes: 8 additions & 0 deletions packages/xpetra/test/CrsMatrix/CrsMatrix_UnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,14 @@ namespace {
TEST_THROW(mx(Teuchos::null, 0), Xpetra::Exceptions::RuntimeError);
}
#endif
#if defined(HAVE_XPETRA_TPETRA) && defined(HAVE_TPETRA_INST_HIP)
{
typedef Xpetra::EpetraMapT<GO, Kokkos::Compat::KokkosHIPWrapperNode> mm;
TEST_THROW(mm(10, 0, comm), Xpetra::Exceptions::RuntimeError);
typedef Xpetra::EpetraCrsMatrixT<GO, Kokkos::Compat::KokkosHIPWrapperNode> mx;
TEST_THROW(mx(Teuchos::null, 0), Xpetra::Exceptions::RuntimeError);
}
#endif

#endif
}
Expand Down
8 changes: 8 additions & 0 deletions packages/xpetra/test/MultiVector/MultiVector_UnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2509,6 +2509,14 @@ namespace {
TEST_THROW(mx(Teuchos::null, 3), Xpetra::Exceptions::RuntimeError);
}
#endif
#if defined(HAVE_XPETRA_TPETRA) && defined(HAVE_TPETRA_INST_HIP)
{
typedef Xpetra::EpetraMapT<GlobalOrdinal, Kokkos::Compat::KokkosHIPWrapperNode> mm;
TEST_THROW(mm(10, 0, comm), Xpetra::Exceptions::RuntimeError);
typedef Xpetra::EpetraMultiVectorT<GlobalOrdinal, Kokkos::Compat::KokkosHIPWrapperNode> mx;
TEST_THROW(mx(Teuchos::null, 3), Xpetra::Exceptions::RuntimeError);
}
#endif

#endif
}
Expand Down

0 comments on commit 4670ef8

Please sign in to comment.