(git:e7e05ae)
grid_library.c File Reference
#include <assert.h>
#include <omp.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../offload/offload_runtime.h"
#include "grid_common.h"
#include "grid_constants.h"
#include "grid_library.h"

Go to the source code of this file.

Data Structures

struct  grid_library_globals
 

Macros

#define GRID_NBACKENDS   5
 
#define GRID_NKERNELS   4
 
#define GRID_MAX_LP   20
 

Functions

void grid_library_init (void)
 Initializes the grid library. More...
 
void grid_library_finalize (void)
 Finalizes the grid library. More...
 
grid_sphere_cachegrid_library_get_sphere_cache (void)
 Returns a pointer to the thread local sphere cache. More...
 
void grid_library_set_config (const enum grid_backend backend, const bool validate, const bool apply_cutoff)
 Configures the grid library. More...
 
grid_library_config grid_library_get_config (void)
 Returns the library config. More...
 
void grid_library_counter_add (const int lp, const enum grid_backend backend, const enum grid_library_kernel kernel, const int increment)
 Adds given increment to counter specified by lp, backend, and kernel. More...
 
static int compare_counters (const void *a, const void *b)
 Comperator passed to qsort to compare two counters. More...
 
void grid_library_print_stats (void(*mpi_sum_func)(long *, int), const int mpi_comm, void(*print_func)(char *, int), const int output_unit)
 Prints statistics gathered by the grid library. More...
 

Variables

static grid_library_globals ** per_thread_globals = NULL
 
static bool library_initialized = false
 
static int max_threads = 0
 
static grid_library_config config
 

Macro Definition Documentation

◆ GRID_NBACKENDS

#define GRID_NBACKENDS   5

Definition at line 21 of file grid_library.c.

◆ GRID_NKERNELS

#define GRID_NKERNELS   4

Definition at line 22 of file grid_library.c.

◆ GRID_MAX_LP

#define GRID_MAX_LP   20

Definition at line 23 of file grid_library.c.

Function Documentation

◆ grid_library_init()

void grid_library_init ( void  )

Initializes the grid library.

Author
Ole Schuett

Definition at line 49 of file grid_library.c.

Here is the caller graph for this function:

◆ grid_library_finalize()

void grid_library_finalize ( void  )

Finalizes the grid library.

Author
Ole Schuett

Definition at line 83 of file grid_library.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ grid_library_get_sphere_cache()

grid_sphere_cache* grid_library_get_sphere_cache ( void  )

Returns a pointer to the thread local sphere cache.

Author
Ole Schuett

Definition at line 102 of file grid_library.c.

Here is the caller graph for this function:

◆ grid_library_set_config()

void grid_library_set_config ( const enum grid_backend  backend,
const bool  validate,
const bool  apply_cutoff 
)

Configures the grid library.

Author
Ole Schuett

Definition at line 112 of file grid_library.c.

◆ grid_library_get_config()

grid_library_config grid_library_get_config ( void  )

Returns the library config.

Author
Ole Schuett

Definition at line 123 of file grid_library.c.

Here is the caller graph for this function:

◆ grid_library_counter_add()

void grid_library_counter_add ( const int  lp,
const enum grid_backend  backend,
const enum grid_library_kernel  kernel,
const int  increment 
)

Adds given increment to counter specified by lp, backend, and kernel.

Author
Ole Schuett

Definition at line 129 of file grid_library.c.

Here is the caller graph for this function:

◆ compare_counters()

static int compare_counters ( const void *  a,
const void *  b 
)
static

Comperator passed to qsort to compare two counters.

Author
Ole Schuett

Definition at line 147 of file grid_library.c.

Here is the caller graph for this function:

◆ grid_library_print_stats()

void grid_library_print_stats ( void(*)(long *, int)  mpi_sum_func,
const int  mpi_comm,
void(*)(char *, int)  print_func,
const int  output_unit 
)

Prints statistics gathered by the grid library.

Author
Ole Schuett

Definition at line 155 of file grid_library.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ per_thread_globals

grid_library_globals** per_thread_globals = NULL
static

Definition at line 30 of file grid_library.c.

◆ library_initialized

bool library_initialized = false
static

Definition at line 31 of file grid_library.c.

◆ max_threads

int max_threads = 0
static

Definition at line 32 of file grid_library.c.

◆ config

grid_library_config config
static
Initial value:
= {
.backend = GRID_BACKEND_AUTO, .validate = false, .apply_cutoff = false}
@ GRID_BACKEND_AUTO

Definition at line 33 of file grid_library.c.