Skip to content

Commit

Permalink
Small ~4% improvement in performance, hint to use large pages for the…
Browse files Browse the repository at this point in the history
… Vector allocations and then shift the offset.
  • Loading branch information
nmhamster committed Oct 26, 2016
1 parent 2dd873a commit 48553e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openmp-opt-knl/src/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ struct Vector {
#ifdef MINIFE_HUGE_PAGES
coefs = (MINIFE_SCALAR*) malloc_huge_pages((sizeof(MINIFE_SCALAR) * local_size) + 64);
#else
posix_memalign((void**) &coefs, offset, sizeof(MINIFE_SCALAR) * local_size);
// posix_memalign((void**) &coefs, offset, sizeof(MINIFE_SCALAR) * local_size);
posix_memalign((void**) &real_coefs, 2 * 1024 * 1024, (sizeof(MINIFE_SCALAR) * local_size) + offset);
coefs = real_coefs + (offset / sizeof(MINIFE_SCALAR));
#endif

if(((unsigned long long int) coefs) % 64 > 0) {
Expand All @@ -101,6 +103,7 @@ struct Vector {
const LocalOrdinal local_size;
// std::vector<Scalar> coefs;

MINIFE_SCALAR* real_coefs;
MINIFE_SCALAR* MINIFE_RESTRICT coefs __attribute__ ((aligned (64)));
};

Expand Down

0 comments on commit 48553e1

Please sign in to comment.