Skip to content

Commit

Permalink
Aligning columns to the next 64 multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Botched135 committed Jan 15, 2025
1 parent a9a140e commit 75d967c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions labs/memory_bound/mem_alignment_1/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
// This function allows you to change the number of columns in a matrix.
// In other words, it defines how many elements are in each row.
// hint: you need to allocate dummy columns to achieve proper data alignment.
int n_columns(int N) {
return N;
int n_columns(int N) {
constexpr int base = 64;
return (N/base+1)*base;
}
// ******************************************

Expand Down

0 comments on commit 75d967c

Please sign in to comment.