StarPU Handbook

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Macros | Functions
Standard Memory Library

## Macros
#define | starpu_data_malloc_pinned_if_possible
#define | starpu_data_free_pinned_if_possible
#define | STARPU_MALLOC_PINNED
#define | STARPU_MALLOC_COUNT

## Functions
int | starpu_malloc_flags (void **A, size_t dim, int flags)
void | starpu_malloc_set_align (size_t align)
int | starpu_malloc (void **A, size_t dim)
int | starpu_free (void *A)
int | starpu_free_flags (void *A, size_t dim, int flags)
starpu_ssize_t | starpu_memory_get_total (unsigned node)
starpu_ssize_t | starpu_memory_get_available (unsigned node)

## Detailed Description

## Macro Definition Documentation

#define starpu_data_malloc_pinned_if_possible

Deprecated:
  Equivalent to starpu_malloc(). This macro is provided to avoid breaking old codes.

#define starpu_data_free_pinned_if_possible

Deprecated:
  Equivalent to starpu_free(). This macro is provided to avoid breaking old codes.

#define STARPU_MALLOC_PINNED

Value passed to the function starpu_malloc_flags() to indicate the memory allocation should be pinned.

#define STARPU_MALLOC_COUNT

Value passed to the function starpu_malloc_flags() to indicate the memory allocation should be in the limit defined by the environment variables STARPU_LIMIT_CUDA_devid_MEM, STARPU_LIMIT_CUDA_MEM, STARPU_LIMIT_OPENCL_devid_MEM, STARPU_LIMIT_OPENCL_MEM and STARPU_LIMIT_CPU_MEM (see Section How to limit memory per node). If no memory is available, it tries to reclaim memory from StarPU. Memory allocated this way needs to be freed by calling the function starpu_free_flags() with the same flag.

## Function Documentation

int starpu_malloc_flags | ( | void ** | A,
|  | size_t | dim,
|  | int | flags
| ) |  |

Performs a memory allocation based on the constraints defined by the given flag.

void starpu_malloc_set_align | ( | size_t | align | ) |

This function sets an alignment constraints for starpu_malloc() allocations. align must be a power of two. This is for instance called automatically by the OpenCL driver to specify its own alignment constraints.

int starpu_malloc | ( | void ** | A,
|  | size_t | dim
| ) |  |

This function allocates data of the given size in main memory. It will also try to pin it in CUDA or OpenCL, so that data transfers from this buffer can be asynchronous, and thus permit data transfer and computation overlapping. The allocated buffer must be freed thanks to the starpu_free() function.

int starpu_free | ( | void * | A | ) |

This function frees memory which has previously been allocated with starpu_malloc().

int starpu_free_flags | ( | void * | A,
|  | size_t | dim,
|  | int | flags
| ) |  |

This function frees memory by specifying its size. The given flags should be consistent with the ones given to starpu_malloc_flags() when allocating the memory.

ssize_t starpu_memory_get_total | ( | unsigned | node | ) |

If a memory limit is defined on the given node (see Section How to limit memory per node), return the amount of total memory on the node. Otherwise return -1.

ssize_t starpu_memory_get_available | ( | unsigned | node | ) |

If a memory limit is defined on the given node (see Section How to limit memory per node), return the amount of available memory on the node. Otherwise return -1.