LLNL / lbann

Livermore Big Artificial Neural Network Toolkit
http://software.llnl.gov/lbann/
Other
221 stars 80 forks source link

Integer data type #91

Open timmoon10 opened 7 years ago

timmoon10 commented 7 years ago

As of d2c414a1846b072ea6607c85a0254c5b1277d4e7, int is the standard integer data type. However, we may need 64-bit integers for very large matrices. Variables susceptible to overflow should be changed to El::Int. As a rule of thumb, indices into Elemental matrices should be El::Ints.

ndryden commented 7 years ago

With these changes, I'm getting a lot of warnings about narrowing casts.

ndryden commented 7 years ago

(Background/refresher: fundamental C++ types and fixed-width integer types)

Just to add some context for this discussion, these are our main sources/issues with integers, as far as I can recall:

Ideally, we should come up with a consistent use of integers that satisfies all of these.

Edit: An additional thought: while we don't want to do it for production, we could compile with -ftrapv, which will trap for signed overflow on addition, subtraction, and multiplication.