Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add long int support for data #6

Open
mkstoyanov opened this issue Dec 14, 2017 · 5 comments
Open

Add long int support for data #6

mkstoyanov opened this issue Dec 14, 2017 · 5 comments

Comments

@mkstoyanov
Copy link
Collaborator

No need to overhaul the index set class, only the values storage class and the associated load/unload commands. Check to see how this would affect the ML capabilities.

@mkstoyanov
Copy link
Collaborator Author

Updated design decision:

  • keep the number of multi-indexes, number of outputs, and number of points to evaluate, all as int type
  • make sure that there is no chance of overflow when multiplying large integers, mostly by type-casting the indexes to size_t

@mkstoyanov
Copy link
Collaborator Author

  • added Data2D template, which wraps around a vector or array and splits contiguous memory into strips
  • Data2D can be called with only integers inputs and still prevent overflow by ensuring proper type-casting
  • Data2D is used in many places, but not everywhere yet (some places may need other solutions too)

@mkstoyanov
Copy link
Collaborator Author

  • The 2D wrappers are used everywhere in the code
  • Internal indexing mostly converted to size_t, very few places left that still use int indexing
  • Note: OpenMP implementations on some platforms require signed indexing, int or long long

@mkstoyanov
Copy link
Collaborator Author

  • when the file format is updated, all sizes and indexes would be updated to size_t or long long

  • the internal integers can also be updated

  • the cuda kernels remain working with 32-bit int due to the cuBlas interface

@mkstoyanov
Copy link
Collaborator Author

Decision: switch internal indexing to long long

Unsigned nature of size_t limits some algorithms, such as searching and special traversals of tensor points. The signed integers also don't suffer from OpenMP limitations on some platforms.

The unsigned indexing also causes issues, since without warnings enabled, using negative numbers in size_t does not result in compile time error but in using maximum number. Hence, signed integers do not provide reasonable safety. Signed indexing is good.

@mkstoyanov mkstoyanov pinned this issue May 15, 2020
@mkstoyanov mkstoyanov unpinned this issue Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant