mem_utils.hpp 821 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * \file mat_utils.hpp
  3. * \author Dhairya Malhotra, dhairya.malhotra@gmail.com
  4. * \date 11-5-2013
  5. * \brief This file contains memory management utilities.
  6. */
  7. #include <pvfmm_common.hpp>
  8. #ifndef _PVFMM_MEM_UTILS_
  9. #define _PVFMM_MEM_UTILS_
  10. #ifdef __INTEL_OFFLOAD
  11. #pragma offload_attribute(push,target(mic))
  12. #endif
  13. namespace pvfmm{
  14. namespace mem{
  15. // Aligned memory allocation.
  16. // Alignment must be power of 2 (1,2,4,8,16...)
  17. template <class T>
  18. T* aligned_malloc(size_t size_, size_t alignment=MEM_ALIGN);
  19. // Aligned memory free.
  20. template <class T>
  21. void aligned_free(T* p_);
  22. void * memcopy ( void * destination, const void * source, size_t num );
  23. }//end namespace
  24. }//end namespace
  25. #ifdef __INTEL_OFFLOAD
  26. #pragma offload_attribute(pop)
  27. #endif
  28. #include <mem_utils.txx>
  29. #endif //_PVFMM_MEM_UTILS_