-
Notifications
You must be signed in to change notification settings - Fork 0
Kokkos::kokkos_malloc
Defined in header <Kokkos_Core.hpp>
template <class MemorySpace = typename Kokkos::DefaultExecutionSpace::memory_space>
void* kokkos_malloc(const std:string& label, size_t size);
template <class MemorySpace = typename Kokkos::DefaultExecutionSpace::memory_space>
void* kokkos_malloc(size_t size);
Allocate size
bytes of unitialized storage on the specified memory space MemorySpace
plus some extra space for meta data such as the label.
If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any scalar type.
If allocation fails, an exception of type Kokkos::Experimental::RawMemoryAllocationFailure
is thrown.
label
: A user provided string which is used in profiling and debugging tools via the KokkosP Profiling Tools.
size
: The number of bytes to allocate.
-
MemorySpace
: Controls the storage location. If omitted the memory space of the default execution space is used (i.e.Kokkos::DefaultExecutionSpace::memory_space
).
On success, returns the pointer to the beginning of newly allocated memory.
To avoid a memory leak, the returned pointer must be deallocated with Kokkos::kokkos_free()
or Kokkos::realloc()
.
On failure, throws Kokkos::Experimental::RawMemoryAllocationFailure
.
Home:
- Introduction
- Machine Model
- Programming Model
- Compiling
- Initialization
- View
- Parallel Dispatch
- Hierarchical Parallelism
- Custom Reductions
- Atomic Operations
- Subviews
- Interoperability
- Kokkos and Virtual Functions
- Initialization and Finalization
- View
- Data Parallelism
- Execution Policies
- Spaces
- Task Parallelism
- Utilities
- STL Compatibility
- Numerics
- Detection Idiom