Skip to content

Commit 6bb7182

Browse files
authored
Merge pull request #290 from sethrj/trilinos-132
Update to support Trilinos 13.2
2 parents 60323bd + 2f783d2 commit 6bb7182

13 files changed

+1781
-1237
lines changed

.jenkins

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pipeline {
3131
dir('build') {
3232
sh '''
3333
cmake \
34+
-GNinja \
3435
-D CMAKE_INSTALL_PREFIX=$FORTRILINOS_DIR \
3536
-D CMAKE_BUILD_TYPE=Debug \
3637
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
@@ -39,7 +40,7 @@ pipeline {
3940
-D ForTrilinos_EXAMPLES=ON \
4041
..
4142
'''
42-
sh 'make -j8 VERBOSE=1'
43+
sh 'ninja -v'
4344
sh 'ctest $CTEST_OPTIONS'
4445
}
4546
}
@@ -49,7 +50,7 @@ pipeline {
4950
xunit reduceLog: false, tools:[CTest(deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/Testing/**/Test.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
5051
}
5152
success {
52-
sh 'cd build && make install'
53+
sh 'cd build && ninja install'
5354
sh 'rm -rf test_install && mkdir -p test_install'
5455
dir('test_install') {
5556
sh 'cp -r ../example/test-installation .'

doc/install.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ The version scheme is based on semantic versioning:
2727
changes for ForTrilinos.
2828

2929
- New features in Trilinos, and new support by ForTrilinos, can result in minor
30-
version number changes. Features removed by a minor version change in
31-
Trilinos may also result in a minor version change.
30+
version number changes. Features removed or deprecated by a minor version
31+
change in Trilinos may also result in a minor version change.
3232

3333
- Minor changes to the SWIG-Fortran implementation (which don't affect the
3434
interface in the .F90 files) result in a patch version.
@@ -43,6 +43,7 @@ in the committed version of the generated wrappers.
4343
=========== ============== ======================
4444
ForTrilinos Trilinos SWIG
4545
=========== ============== ======================
46+
2.1.0 13.2 4.1.0-dev1+fortran
4647
2.0.1 13.0:13.1 4.1.0-dev1+fortran
4748
2.0.0 13.0:13.1 4.0.2+fortran
4849
2.0.0-dev3 12.18.1 4.0.2+fortran
@@ -72,8 +73,8 @@ pre-built binary on a variety of user and HPC systems.
7273
Spack
7374
-----
7475

75-
To install ForTrilinos version ``2.0.1`` through an existing Spack
76-
installation (v0.18 or higher, or the ``develop`` branch):
76+
To install ForTrilinos version ``2.1.0`` through an existing Spack
77+
installation (v0.19 or higher, or the ``develop`` branch):
7778

7879
.. code:: console
7980

docker/Dockerfile

+21-47
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,68 @@
11
# Build command:
2-
# $ docker build -t aprokop/fortrilinos-stack:latest -f Dockerfile .
3-
ARG BASE=nvidia/cuda:11.0.3-devel-ubuntu18.04
2+
# $ docker build -t sethrj/fortrilinos-stack:latest -f Dockerfile .
3+
ARG BASE=nvidia/cuda:11.2.2-devel-ubuntu20.04
44
FROM $BASE
55

66
ARG NPROC=8
77

8-
RUN if test ${NV_CUDA_LIB_VERSION}; then apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub; fi
9-
108
# Avoid tzdata dialog
119
ARG DEBIAN_FRONTEND=noninteractive
1210

13-
RUN apt-get update && apt-get install -yq \
11+
RUN apt-get -yqq update && apt-get install -yq \
1412
autoconf \
1513
bc \
1614
build-essential \
15+
ca-certificates \
1716
ccache \
1817
curl \
19-
environment-modules \
2018
gawk \
2119
gfortran \
20+
g++ \
2221
git \
2322
lcov \
2423
libatlas-base-dev \
2524
libbz2-dev \
26-
python2.7-dev \
27-
tmux \
28-
unzip \
25+
libssl-dev \
26+
mpich \
27+
ninja-build \
28+
python3-dev \
2929
valgrind \
3030
vim \
3131
wget \
3232
&& \
3333
apt-get clean && \
3434
rm -rf /var/lib/apt/lists/*
3535

36-
# Install CMake
3736
ENV CMAKE_DIR=/opt/cmake
38-
RUN CMAKE_VERSION=3.16.4 && \
39-
CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION} && \
40-
CMAKE_SCRIPT=cmake-${CMAKE_VERSION}-Linux-x86_64.sh && \
41-
CMAKE_SHA256=cmake-${CMAKE_VERSION}-SHA-256.txt && \
37+
RUN CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.23.3/cmake-3.23.3.tar.gz && \
38+
CMAKE_ARCHIVE=cmake.tar.gz && \
4239
SCRATCH_DIR=/scratch && mkdir -p ${SCRATCH_DIR} && cd ${SCRATCH_DIR} && \
43-
wget --quiet ${CMAKE_URL}/${CMAKE_SHA256} && \
44-
wget --quiet ${CMAKE_URL}/${CMAKE_SHA256}.asc && \
45-
wget --quiet ${CMAKE_URL}/${CMAKE_SCRIPT} && \
46-
grep ${CMAKE_SCRIPT} ${CMAKE_SHA256} | sha256sum --check && \
40+
wget --quiet ${CMAKE_URL} --output-document=${CMAKE_ARCHIVE} && \
4741
mkdir -p ${CMAKE_DIR} && \
48-
sh ${CMAKE_SCRIPT} --skip-license --prefix=${CMAKE_DIR} && \
42+
tar -xf ${CMAKE_ARCHIVE} --strip-components=1 && \
43+
./bootstrap --prefix=${CMAKE_DIR} --generator=Ninja && \
44+
ninja install && \
4945
rm -rf ${SCRATCH_DIR}
5046
ENV PATH=${CMAKE_DIR}/bin:$PATH
5147

52-
# Install OpenMPI
53-
ENV OPENMPI_DIR=/opt/openmpi
54-
RUN OPENMPI_VERSION=4.0.3 && \
55-
OPENMPI_VERSION_SHORT=$(echo "$OPENMPI_VERSION" | cut -d. -f1,2) && \
56-
OPENMPI_SHA1=d958454e32da2c86dd32b7d557cf9a401f0a08d3 && \
57-
OPENMPI_URL=https://download.open-mpi.org/release/open-mpi/v${OPENMPI_VERSION_SHORT}/openmpi-${OPENMPI_VERSION}.tar.bz2 && \
58-
OPENMPI_ARCHIVE=openmpi-${OPENMPI_VERSION}.tar.bz2 && \
59-
SCRATCH_DIR=/scratch && mkdir -p ${SCRATCH_DIR} && cd ${SCRATCH_DIR} && \
60-
wget --quiet ${OPENMPI_URL} --output-document=${OPENMPI_ARCHIVE} && \
61-
echo "${OPENMPI_SHA1} ${OPENMPI_ARCHIVE}" | sha1sum -c && \
62-
mkdir -p openmpi && \
63-
tar -xf ${OPENMPI_ARCHIVE} -C openmpi --strip-components=1 && \
64-
mkdir -p build && cd build && \
65-
../openmpi/configure --prefix=${OPENMPI_DIR} ${CUDA_OPTIONS} CFLAGS=-w && \
66-
make -j${NPROCS} install && \
67-
rm -rf ${SCRATCH_DIR}
68-
ENV PATH=${OPENMPI_DIR}/bin:$PATH
69-
70-
# Workaround for Kokkos to find libcudart
71-
ENV LD_LIBRARY_PATH=/usr/local/cuda/targets/x86_64-linux/lib:${LD_LIBRARY_PATH}
72-
73-
# Install Trilinos (13.0.0)
48+
# Install Trilinos
7449
ENV TRILINOS_DIR=/opt/trilinos
75-
RUN export TRILINOS_HASH=9fec35276d846a667bc668ff4cbdfd8be0dfea08 && \
76-
export TRILINOS_URL=https://github.com/trilinos/Trilinos/archive/${TRILINOS_HASH}.tar.gz && \
77-
export TRILINOS_ARCHIVE=trilinos-${TRILINOS_HASH}.tar.gz && \
50+
RUN TRILINOS_VERSION=13-2-0 && \
51+
TRILINOS_URL=https://github.com/trilinos/Trilinos/archive/refs/tags/trilinos-release-${TRILINOS_VERSION}.tar.gz && \
52+
TRILINOS_ARCHIVE=trilinos-${TRILINOS_VERSION}.tar.gz && \
7853
SCRATCH_DIR=/scratch && mkdir -p ${SCRATCH_DIR} && cd ${SCRATCH_DIR} && \
7954
wget --quiet ${TRILINOS_URL} --output-document=${TRILINOS_ARCHIVE} && \
8055
mkdir -p trilinos && \
8156
tar -xf ${TRILINOS_ARCHIVE} -C trilinos --strip-components=1 && \
8257
mkdir -p build && cd build && \
8358
cmake \
59+
-G Ninja \
8460
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
8561
-D BUILD_SHARED_LIBS=ON \
8662
\
8763
-D CMAKE_INSTALL_PREFIX=${TRILINOS_DIR} \
8864
\
8965
-D TPL_ENABLE_Boost=OFF \
90-
-D TPL_ENABLE_CUDA=ON \
91-
-D TPL_ENABLE_CUDA=OFF \
9266
-D TPL_ENABLE_DLlib=OFF \
9367
-D TPL_ENABLE_MPI=ON \
9468
\
@@ -129,6 +103,6 @@ RUN export TRILINOS_HASH=9fec35276d846a667bc668ff4cbdfd8be0dfea08 && \
129103
-D Tpetra_ENABLE_DEPRECATED_CODE=OFF \
130104
\
131105
../trilinos && \
132-
make -j${NPROC} install && \
106+
ninja -j${NPROC} install && \
133107
rm -rf ${SCRATCH_DIR}
134108
ENV TRILINOS_DIR=/opt/trilinos

scripts/spack.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ spack:
44
- ninja
55
- openmpi
66
7-
- trilinos@13.0.0:13.1 +amesos2 +anasazi +belos +kokkos +ifpack2 +muelu +nox +tpetra
7+
- trilinos@13.2.0:13.2 +amesos2 +anasazi +belos +kokkos +ifpack2 +muelu +nox +tpetra
88
+stratimikos +mpi gotype=long_long
99
view: true
1010
concretizer:

src/fortpetra/Tpetra_CrsGraph.i

+14
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,20 @@
111111
for (int i = 0; i < nnz; i++)
112112
columnIndices[i] = columnIndicesArrayRCP[i]+1;
113113
}
114+
void
115+
getLocalRowCopy (LO lclRow,
116+
const Teuchos::ArrayView<LO>& lclColInds,
117+
size_t& numColInds) const {
118+
Tpetra::CrsGraph<LO,GO,NO>::nonconst_local_inds_host_view_type temp_i(lclColInds.data(), lclColInds.size());
119+
return $self->getLocalRowCopy(lclRow, temp_i, numColInds);
120+
}
121+
void
122+
getGlobalRowCopy (GO gblRow,
123+
const Teuchos::ArrayView<GO>& gblColInds,
124+
size_t& numColInds) const {
125+
Tpetra::CrsGraph<LO,GO,NO>::nonconst_global_inds_host_view_type temp_i(gblColInds.data(), gblColInds.size());
126+
return $self->getGlobalRowCopy(gblRow, temp_i, numColInds);
127+
}
114128
}
115129

116130
// Add doImport and doExport

src/fortpetra/Tpetra_CrsMatrix.i

+71-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
const Teuchos::ArrayView<const LO>& cols,
6969
Teuchos::ArrayView<const LO> cols}
7070

71-
%apply const Teuchos::ArrayView<int>& INDEX { const Teuchos::ArrayView<LO>& colInds }
71+
%apply const Teuchos::ArrayView<int>& INDEX { const Teuchos::ArrayView<LO>& colInds, const Teuchos::ArrayView<LO>& colInds }
7272

7373
%apply const Teuchos::ArrayRCP<const int>& INDEX {
7474
const Teuchos::ArrayRCP<size_t>& rowPointers,
@@ -104,6 +104,26 @@
104104
values [i] = valuesArrayRCP[i];
105105
}
106106
}
107+
108+
void
109+
getGlobalRowCopy (GO GlobalRow,
110+
const Teuchos::ArrayView<GO>& Indices,
111+
const Teuchos::ArrayView<SC>& Values,
112+
size_t& NumEntries) const {
113+
Tpetra::CrsMatrix<SC,LO,GO,NO>::nonconst_global_inds_host_view_type temp_i(Indices.data(), Indices.size());
114+
Tpetra::CrsMatrix<SC,LO,GO,NO>::nonconst_values_host_view_type temp_v(Values.data(), Values.size());
115+
return $self->getGlobalRowCopy(GlobalRow, temp_i, temp_v, NumEntries);
116+
}
117+
118+
void
119+
getLocalRowCopy (LO localRow,
120+
const Teuchos::ArrayView<LO>& colInds,
121+
const Teuchos::ArrayView<SC>& vals,
122+
size_t& numEntries) const {
123+
Tpetra::CrsMatrix<SC,LO,GO,NO>::nonconst_local_inds_host_view_type temp_i(colInds.data(), colInds.size());
124+
Tpetra::CrsMatrix<SC,LO,GO,NO>::nonconst_values_host_view_type temp_v(vals.data(), vals.size());
125+
return $self->getLocalRowCopy(localRow, temp_i, temp_v, numEntries);
126+
}
107127
}
108128

109129
// Add doImport and doExport
@@ -116,9 +136,59 @@
116136
%ignore Tpetra::CrsMatrix::sumIntoLocalValues (const LocalOrdinal localRow, const LocalOrdinal numEnt, const Scalar vals[], const LocalOrdinal cols[], const bool atomic=useAtomicUpdatesByDefault);
117137

118138

139+
// Define type aliases for Tpetra matrix base class
140+
namespace Tpetra {
141+
template <class Scalar,
142+
class LocalOrdinal,
143+
class GlobalOrdinal,
144+
class Node>
145+
class RowMatrix
146+
{
147+
public:
148+
typedef Scalar scalar_type;
149+
typedef LocalOrdinal local_ordinal_type;
150+
typedef GlobalOrdinal global_ordinal_type;
151+
typedef Node node_type;
152+
153+
using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
154+
using mag_type = typename Kokkos::ArithTraits<Scalar>::mag_type;
155+
typedef typename
156+
Kokkos::View<impl_scalar_type*, typename Node::device_type>::const_type
157+
values_device_view_type;
158+
typedef typename values_device_view_type::HostMirror::const_type
159+
values_host_view_type;
160+
typedef typename values_device_view_type::HostMirror
161+
nonconst_values_host_view_type;
162+
163+
typedef typename
164+
Kokkos::View<LocalOrdinal *, typename Node::device_type>::const_type
165+
local_inds_device_view_type;
166+
typedef typename local_inds_device_view_type::HostMirror::const_type
167+
local_inds_host_view_type;
168+
typedef typename local_inds_device_view_type::HostMirror
169+
nonconst_local_inds_host_view_type;
170+
171+
typedef typename
172+
Kokkos::View<GlobalOrdinal *, typename Node::device_type>::const_type
173+
global_inds_device_view_type;
174+
typedef typename global_inds_device_view_type::HostMirror::const_type
175+
global_inds_host_view_type;
176+
typedef typename global_inds_device_view_type::HostMirror
177+
nonconst_global_inds_host_view_type;
178+
179+
180+
typedef typename
181+
Kokkos::View<const size_t*, typename Node::device_type>::const_type
182+
row_ptrs_device_view_type;
183+
typedef typename row_ptrs_device_view_type::HostMirror::const_type
184+
row_ptrs_host_view_type;
185+
};
186+
}
187+
119188
%include "Tpetra_CrsMatrix_decl.hpp"
120189

121190
%teuchos_rcp(Tpetra::CrsMatrix<SC,LO,GO,NO>)
191+
%template() Tpetra::RowMatrix<SC,LO,GO,NO>;
122192
%template(TpetraCrsMatrix) Tpetra::CrsMatrix<SC,LO,GO,NO>;
123193

124194
// Operator to Matrix conversion

0 commit comments

Comments
 (0)