[Trilinos-Users] Trilinos-Users Digest, Vol 113, Issue 18

Hoemmen, Mark mhoemme at sandia.gov
Fri Jan 30 16:14:37 MST 2015


On 1/29/15, 12:00 PM, "trilinos-users-request at software.sandia.gov"
<trilinos-users-request at software.sandia.gov> wrote:
>Message: 1
>Date: Thu, 29 Jan 2015 00:52:11 +0000
>From: "Drumm, Clif" <crdrumm at sandia.gov>
>To: "trilinos-users at software.sandia.gov"
>	<trilinos-users at software.sandia.gov>
>Subject: [Trilinos-Users] use of unsigned types with Tpetra Map
>Message-ID: <1422492745276.17089 at sandia.gov>
>Content-Type: text/plain; charset="iso-8859-1"
>
>I'd like to construct a Tpetra Map using size_t as the
>global_ordinal_type and local_ordinal_type.

We recommend using signed integer types only for both LocalOrdinal (LO)
and GlobalOrdinal (GO).  We (reluctantly) permit GO = size_t and have
tested it for a couple years.  Unsigned LO is a bad idea, first because
compilers have an easier time optimizing if loop counters are signed, and
second because some downstream packages' computational kernels do
countdown loops like this:

for (LO i = N - 1; i >= 0; --i) { ... }

If LO is unsigned, i >= 0 is always true, so the loop will go on forever.
I've found some of those loops and rewritten them to be correct for
unsigned LO, but I can't promise correctness for all downstream packages.

If you have a strong interest in using unsigned LO, please send me an
e-mail with a use case and we can talk more.

Thanks!
mfh



More information about the Trilinos-Users mailing list