GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
util.c File Reference
#include "ghost/util.h"
#include "ghost/log.h"
#include "ghost/constants.h"
#include <stdarg.h>
#include <stdlib.h>
#include <errno.h>
Include dependency graph for util.c:

Macros

#define _GNU_SOURCE
 
#define PRINTWIDTH   80
 
#define LABELWIDTH   40
 
#define HEADERHEIGHT   3
 
#define FOOTERHEIGHT   1
 
#define PRINTSEP   ":"
 
#define VALUEWIDTH   (PRINTWIDTH-LABELWIDTH-(int)strlen(PRINTSEP))
 
#define MAXVALUELEN   1024
 

Functions

ghost_error ghost_header_string (char **str, const char *fmt,...)
 
ghost_error ghost_footer_string (char **str)
 
ghost_error ghost_line_string (char **str, const char *label, const char *unit, const char *fmt,...)
 
ghost_error ghost_malloc (void **mem, const size_t size)
 Allocate memory. More...
 
ghost_error ghost_malloc_pinned (void **mem, const size_t size)
 Allocate pinned memory to enable fast CPU-GPU transfers. More...
 
ghost_error ghost_malloc_align (void **mem, const size_t size, const size_t align)
 Allocate aligned memory. More...
 

Macro Definition Documentation

#define _GNU_SOURCE
#define FOOTERHEIGHT   1
#define HEADERHEIGHT   3
#define LABELWIDTH   40
#define MAXVALUELEN   1024
#define PRINTSEP   ":"
#define PRINTWIDTH   80
#define VALUEWIDTH   (PRINTWIDTH-LABELWIDTH-(int)strlen(PRINTSEP))

Function Documentation

ghost_error ghost_footer_string ( char **  str)
ghost_error ghost_header_string ( char **  str,
const char *  fmt,
  ... 
)
ghost_error ghost_line_string ( char **  str,
const char *  label,
const char *  unit,
const char *  fmt,
  ... 
)

Here is the call graph for this function:

ghost_error ghost_malloc ( void **  mem,
const size_t  size 
)

Allocate memory.

Parameters
memWhere to store the allocated memory.
sizeThe size (in bytes) to allocate.
Returns
GHOST_SUCCESS on success or an error indicator.
ghost_error ghost_malloc_align ( void **  mem,
const size_t  size,
const size_t  align 
)

Allocate aligned memory.

Parameters
memWhere to store the allocated memory.
sizeThe size (in bytes) to allocate.
alignThe alignment size.
Returns
GHOST_SUCCESS on success or an error indicator.
ghost_error ghost_malloc_pinned ( void **  mem,
const size_t  size 
)

Allocate pinned memory to enable fast CPU-GPU transfers.

Parameters
memWhere to store the allocated memory.
sizeThe size (in bytes) to allocate.
Returns
GHOST_SUCCESS on success or an error indicator.

If CUDA is not enabled, a normal malloc is done.

Here is the call graph for this function: