//============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. // // Copyright 2014 Sandia Corporation. // Copyright 2014 UT-Battelle, LLC. // Copyright 2014 Los Alamos National Security. // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ #define vtkm_cont_StorageBasic_cxx #include #if defined(VTKM_POSIX) #define VTKM_MEMALIGN_POSIX #elif defined(_WIN32) #define VTKM_MEMALIGN_WIN #elif defined(__SSE__) #define VTKM_MEMALIGN_SSE #else #define VTKM_MEMALIGN_NONE #endif #if defined(VTKM_MEMALIGN_POSIX) #include #elif defined(VTKM_MEMALIGN_WIN) #include #elif defined(VTKM_MEMALIGN_SSE) #include #else #include #endif #include #include namespace vtkm { namespace cont { namespace internal { void* alloc_aligned(size_t size, size_t align) { #if defined(VTKM_MEMALIGN_POSIX) void* mem = nullptr; if (posix_memalign(&mem, align, size) != 0) { mem = nullptr; } #elif defined(VTKM_MEMALIGN_WIN) void* mem = _aligned_malloc(size, align); #elif defined(VTKM_MEMALIGN_SSE) void* mem = _mm_malloc(size, align); #else void* mem = malloc(size); #endif if (mem == nullptr) { throw std::bad_alloc(); } return mem; } void free_aligned(void* mem) { #if defined(VTKM_MEMALIGN_POSIX) free(mem); #elif defined(VTKM_MEMALIGN_WIN) _aligned_free(mem); #elif defined(VTKM_MEMALIGN_SSE) _mm_free(mem); #else free(mem); #endif } template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; template class VTKM_CONT_EXPORT Storage, StorageTagBasic>; } } } // namespace vtkm::cont::internal