ROCK 1.9.1
Relativistic Oscillator Calculation Kit
Loading...
Searching...
No Matches
cr_cache Struct Reference

Read the detailed description! More...

#include <crock.h>

Data Fields

void(* free )(struct cr_cache *self)

Detailed Description

Read the detailed description!

General Principle of ROCK Caches:

To avoid re-allocate NUMA or GPU memory in every iteration, the memory buffers are stored in cache structures. The typical signature of a function making use of caches is

func(..., struct cr_cache **pp_cache);
Read the detailed description!
Definition crock.h:167

The user defines a pointer to the structure, and invoke the func() with

struct cr_cache *ptr_cache = NULL;
func(..., &ptr_cache); // or func(..., NULL);

Notes:

  • If call the function with func(..., NULL) i.e. pp_cache == NULL then no cache is assumed (e.g. for a diagnostic step with fewer electrons).
  • If ptr_cache == NULL then a new cache will be allocated.
  • To release the cached memory for sanitizer checks:
    if (ptr_cache) {
    ptr_cache->free(ptr_cache);
    ptr_cache = NULL;
    }
    void(* free)(struct cr_cache *self)
    Definition crock.h:168
  • Caches require the same dim_* and the same parallelization setup (e.g. number of threads), as they are determining the size of memory.
  • Caveat: Do not mix caches for different functions! If there multiple functions need to be cached, one should invoke func_1(..., ptr_cache_1) and func_2(..., ptr_cache_2). Accelerated functions have *_gpu() (using device pointers) and *_offload() (using host pointers) variants, Mixing caches between them is also not supported.

Field Documentation

◆ free

void(* cr_cache::free) (struct cr_cache *self)

The documentation for this struct was generated from the following file: