aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-05-20 09:24:00 -0500
committerErik Schnetter <schnetter@gmail.com>2013-05-20 09:24:00 -0500
commit63affbc4c9f953e3471aec55239f64c4906f7658 (patch)
treef2b49c29f78c86e608822b019e7df4972ac48c44 /Carpet/CarpetLib
parentb694764659c6bfedc9e5aeb375635526f8db36e3 (diff)
CarpetLib: Only check cache line size if it is used
Diffstat (limited to 'Carpet/CarpetLib')
-rw-r--r--Carpet/CarpetLib/src/cacheinfo.cc2
-rw-r--r--Carpet/CarpetLib/src/mem.cc4
2 files changed, 5 insertions, 1 deletions
diff --git a/Carpet/CarpetLib/src/cacheinfo.cc b/Carpet/CarpetLib/src/cacheinfo.cc
index 76640d7c2..0a8be7963 100644
--- a/Carpet/CarpetLib/src/cacheinfo.cc
+++ b/Carpet/CarpetLib/src/cacheinfo.cc
@@ -79,11 +79,11 @@ pad_shape(vect<int,D> const& shape)
assert(cache_linesize % sizeof(CCTK_REAL) == 0);
int const linesize = cache_linesize / sizeof(CCTK_REAL);
- assert(is_power_of_2(linesize));
if (npoints * accumulated_npoints < linesize) {
// The extent is less than one cache line long: Ensure that
// the array size divides the cache line size evenly by
// rounding to the next power of 2
+ assert(is_power_of_2(linesize));
npoints = next_power_of_2(npoints);
} else {
// The extent is at least one cache line long: round up to
diff --git a/Carpet/CarpetLib/src/mem.cc b/Carpet/CarpetLib/src/mem.cc
index df374ae3e..77cd6b704 100644
--- a/Carpet/CarpetLib/src/mem.cc
+++ b/Carpet/CarpetLib/src/mem.cc
@@ -103,7 +103,11 @@ mem (size_t const vectorlength, size_t const nelems,
try {
// TODO: use posix_memalign instead, if available
size_t const max_cache_linesize = get_max_cache_linesize();
+#if VECTORISE
size_t const vector_size = CCTK_REAL_VEC_SIZE * sizeof(T);
+#else
+ size_t const vector_size = sizeof(T);
+#endif
size_t const alignment = align_up(max_cache_linesize, vector_size);
assert(alignment >= 1);
// Safety check