QMCPACK
test_aligned_allocator.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include "catch.hpp"
14 
15 #include <iostream>
16 #include "config.h"
18 
19 namespace qmcplusplus
20 {
21 TEST_CASE("Aligned allocator", "[numerics]")
22 {
23  bool not_aligned;
24 
25  aligned_vector<float> a(311);
26  std::cout << "address=" << a.data() << " require=" << (void*)(QMC_SIMD_ALIGNMENT - 1) << std::endl;
27  not_aligned = (size_t)a.data() & (QMC_SIMD_ALIGNMENT - 1);
28  REQUIRE(!not_aligned);
29  a.resize(829);
30  std::cout << "address=" << a.data() << " require=" << (void*)(QMC_SIMD_ALIGNMENT - 1) << std::endl;
31  not_aligned = (size_t)a.data() & (QMC_SIMD_ALIGNMENT - 1);
32  REQUIRE(!not_aligned);
33 
35  std::cout << "address=" << b.data() << " require=" << (void*)(QMC_SIMD_ALIGNMENT - 1) << std::endl;
36  not_aligned = (size_t)b.data() & (QMC_SIMD_ALIGNMENT - 1);
37  REQUIRE(!not_aligned);
38  b.resize(829);
39  std::cout << "address=" << b.data() << " require=" << (void*)(QMC_SIMD_ALIGNMENT - 1) << std::endl;
40  not_aligned = (size_t)b.data() & (QMC_SIMD_ALIGNMENT - 1);
41  REQUIRE(!not_aligned);
42 }
43 
44 } // namespace qmcplusplus
std::vector< T, aligned_allocator< T > > aligned_vector
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
TEST_CASE("complex_helper", "[type_traits]")
REQUIRE(std::filesystem::exists(filename))