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

Display bytes in base-ten format #97

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PointKernel
Copy link
Member

Similar to #47

This PR updates the code thus numbers of bytes are displayed in base-ten format. i.e. B, MB, KB and GB.

@jrhemstad
Copy link
Collaborator

jrhemstad commented Aug 23, 2022

Seems like we should enable people to choose.

Maybe something like this:

enum class base { TWO, TEN };
template <typename ElementType>
void add_global_memory_reads(std::size_t count, std::string column_name = {}, base b = base::TEN)

or

enum class bytes { BASE_TWO, BASE_TEN };
template <typename ElementType>
void add_global_memory_reads(std::size_t count, std::string column_name = {}, bytes b = bytes::BASE_TEN)

The latter may be clearer at the call site:

state.add_global_memory_reads<nvbench::int32_t>(num_values, "DataSize", base::TEN);
// vs
state.add_global_memory_reads<nvbench::int32_t>(num_values, "DataSize", bytes::BASE_TEN);

And we could make it a template parameter instead in order to avoid forcing specifying a name in order to specify the base:

enum class bytes { BASE_TWO, BASE_TEN };
template <typename ElementType, bytes B = bytes::BASE_TEN>
void add_global_memory_reads(std::size_t count, std::string column_name = {})
...
state.add_global_memory_reads<nvbench::int32_t, bytes::BASE_TEN>(num_values);

I'll defer to what @allisonvacanti thinks is best here.

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

Successfully merging this pull request may close these issues.

None yet

2 participants