Documentation 6b54b78464
Loading...
Searching...
No Matches
allocation_toolbox.hpp File Reference

Helper function and classes for memory allocation. Focus on portability across platforms. More...

#include <stdlib.h>
#include <cstring>
#include <cassert>

Go to the source code of this file.

Namespaces

namespace  MemoryAllocation
 
namespace  GPUMemoryAllocation
 

Functions

constexpr bool MemoryAllocation::is_power_of_two (size_t x)
 
constexpr size_t MemoryAllocation::round_up (size_t multiple, size_t x)
 
template<class T , bool ZeroInit = false>
T * MemoryAllocation::aligned_alloc (size_t alignment, size_t size) noexcept
 Aligned memory allocation compatible across platforms.
 
template<class T >
void MemoryAllocation::aligned_free (T *ptr) noexcept
 Free memory allocated with su2::aligned_alloc.
 
template<class T , bool ZeroInit = false>
T * GPUMemoryAllocation::gpu_alloc (size_t size) noexcept
 Memory allocation for variables on the GPU.
 
template<class T >
void GPUMemoryAllocation::gpu_free (T *ptr) noexcept
 Free memory allocated on the GPU with gpu_alloc.
 
template<class T >
T * GPUMemoryAllocation::gpu_alloc_cpy (const T *src_ptr, size_t size) noexcept
 Memory allocation for variables on the GPU along with initialization from a source host array.
 
template<class T , bool ZeroInit = false>
T * GPUMemoryAllocation::pinned_alloc (size_t size) noexcept
 Page-locked ("pinned") host memory allocation.
 
template<class T >
void GPUMemoryAllocation::pinned_free (T *ptr) noexcept
 Free memory allocated with pinned_alloc.
 

Detailed Description

Helper function and classes for memory allocation. Focus on portability across platforms.

Note
These are "kernel" functions, only to be used with good reason, always try to use higher level container classes.
Author
P. Gomes, D. Kavolis
Version
8.5.0 "Harrier"

SU2 Project Website: https://su2code.github.io

The SU2 Project is maintained by the SU2 Foundation (http://su2foundation.org)

Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)

SU2 is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

SU2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with SU2. If not, see http://www.gnu.org/licenses/.