(git:6a2e663)
grid_cpu_task_list.c File Reference
#include <assert.h>
#include <math.h>
#include <omp.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../common/grid_common.h"
#include "grid_cpu_collocate.h"
#include "grid_cpu_integrate.h"
#include "grid_cpu_task_list.h"

Go to the source code of this file.

Functions

static int compare_tasks (const void *a, const void *b)
 Comperator passed to qsort to compare two tasks. More...
 
void grid_cpu_create_task_list (const bool orthorhombic, const int ntasks, const int nlevels, const int natoms, const int nkinds, const int nblocks, const int block_offsets[nblocks], const double atom_positions[natoms][3], const int atom_kinds[natoms], const grid_basis_set *basis_sets[nkinds], const int level_list[ntasks], const int iatom_list[ntasks], const int jatom_list[ntasks], const int iset_list[ntasks], const int jset_list[ntasks], const int ipgf_list[ntasks], const int jpgf_list[ntasks], const int border_mask_list[ntasks], const int block_num_list[ntasks], const double radius_list[ntasks], const double rab_list[ntasks][3], const int npts_global[nlevels][3], const int npts_local[nlevels][3], const int shift_local[nlevels][3], const int border_width[nlevels][3], const double dh[nlevels][3][3], const double dh_inv[nlevels][3][3], grid_cpu_task_list **task_list_out)
 Allocates a task list for the cpu backend. See grid_task_list.h for details. More...
 
void grid_cpu_free_task_list (grid_cpu_task_list *task_list)
 Deallocates given task list, basis_sets have to be freed separately. More...
 
void dgemm_ (const char *transa, const char *transb, const int *m, const int *n, const int *k, const double *alpha, const double *a, const int *lda, const double *b, const int *ldb, const double *beta, double *c, const int *ldc)
 Prototype for BLAS dgemm. More...
 
static void dgemm (const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
 Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b. More...
 
static void load_pab (const grid_basis_set *ibasis, const grid_basis_set *jbasis, const int iset, const int jset, const bool transpose, const double *block, double *pab)
 Transforms pab from contracted spherical to prim. cartesian basis. More...
 
static void collocate_one_grid_level (const grid_cpu_task_list *task_list, const int *first_block_task, const int *last_block_task, const enum grid_func func, const int npts_global[3], const int npts_local[3], const int shift_local[3], const int border_width[3], const double dh[3][3], const double dh_inv[3][3], const double *pab_blocks, offload_buffer *grid)
 Collocate a range of tasks which are destined for the same grid level. More...
 
void grid_cpu_collocate_task_list (const grid_cpu_task_list *task_list, const enum grid_func func, const int nlevels, const offload_buffer *pab_blocks, offload_buffer *grids[nlevels])
 Collocate all tasks of in given list onto given grids. See grid_task_list.h for details. More...
 
static void store_hab (const grid_basis_set *ibasis, const grid_basis_set *jbasis, const int iset, const int jset, const bool transpose, const double *hab, double *block)
 Transforms hab from prim. cartesian to contracted spherical basis. More...
 
static void integrate_one_grid_level (const grid_cpu_task_list *task_list, const int *first_block_task, const int *last_block_task, const bool compute_tau, const int natoms, const int npts_global[3], const int npts_local[3], const int shift_local[3], const int border_width[3], const double dh[3][3], const double dh_inv[3][3], const offload_buffer *pab_blocks, const offload_buffer *grid, offload_buffer *hab_blocks, double forces[natoms][3], double virial[3][3])
 Integrate a range of tasks that belong to the same grid level. More...
 
void grid_cpu_integrate_task_list (const grid_cpu_task_list *task_list, const bool compute_tau, const int natoms, const int nlevels, const offload_buffer *pab_blocks, const offload_buffer *grids[nlevels], offload_buffer *hab_blocks, double forces[natoms][3], double virial[3][3])
 Integrate all tasks of in given list from given grids. See grid_task_list.h for details. More...
 

Function Documentation

◆ compare_tasks()

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

Comperator passed to qsort to compare two tasks.

Author
Ole Schuett

Definition at line 25 of file grid_cpu_task_list.c.

Here is the caller graph for this function:

◆ grid_cpu_create_task_list()

void grid_cpu_create_task_list ( const bool  orthorhombic,
const int  ntasks,
const int  nlevels,
const int  natoms,
const int  nkinds,
const int  nblocks,
const int  block_offsets[nblocks],
const double  atom_positions[natoms][3],
const int  atom_kinds[natoms],
const grid_basis_set basis_sets[nkinds],
const int  level_list[ntasks],
const int  iatom_list[ntasks],
const int  jatom_list[ntasks],
const int  iset_list[ntasks],
const int  jset_list[ntasks],
const int  ipgf_list[ntasks],
const int  jpgf_list[ntasks],
const int  border_mask_list[ntasks],
const int  block_num_list[ntasks],
const double  radius_list[ntasks],
const double  rab_list[ntasks][3],
const int  npts_global[nlevels][3],
const int  npts_local[nlevels][3],
const int  shift_local[nlevels][3],
const int  border_width[nlevels][3],
const double  dh[nlevels][3][3],
const double  dh_inv[nlevels][3][3],
grid_cpu_task_list **  task_list_out 
)

Allocates a task list for the cpu backend. See grid_task_list.h for details.

Author
Ole Schuett

Definition at line 42 of file grid_cpu_task_list.c.

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

◆ grid_cpu_free_task_list()

void grid_cpu_free_task_list ( grid_cpu_task_list task_list)

Deallocates given task list, basis_sets have to be freed separately.

Author
Ole Schuett

Definition at line 163 of file grid_cpu_task_list.c.

Here is the caller graph for this function:

◆ dgemm_()

void dgemm_ ( const char *  transa,
const char *  transb,
const int *  m,
const int *  n,
const int *  k,
const double *  alpha,
const double *  a,
const int *  lda,
const double *  b,
const int *  ldb,
const double *  beta,
double *  c,
const int *  ldc 
)

Prototype for BLAS dgemm.

Author
Ole Schuett

◆ dgemm()

static void dgemm ( const char  transa,
const char  transb,
const int  m,
const int  n,
const int  k,
const double  alpha,
const double *  a,
const int  lda,
const double *  b,
const int  ldb,
const double  beta,
double *  c,
const int  ldc 
)
static

Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.

Author
Ole Schuett

Definition at line 195 of file grid_cpu_task_list.c.

◆ load_pab()

static void load_pab ( const grid_basis_set ibasis,
const grid_basis_set jbasis,
const int  iset,
const int  jset,
const bool  transpose,
const double *  block,
double *  pab 
)
static

Transforms pab from contracted spherical to prim. cartesian basis.

Author
Ole Schuett

Definition at line 207 of file grid_cpu_task_list.c.

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

◆ collocate_one_grid_level()

static void collocate_one_grid_level ( const grid_cpu_task_list task_list,
const int *  first_block_task,
const int *  last_block_task,
const enum grid_func  func,
const int  npts_global[3],
const int  npts_local[3],
const int  shift_local[3],
const int  border_width[3],
const double  dh[3][3],
const double  dh_inv[3][3],
const double *  pab_blocks,
offload_buffer grid 
)
static

Collocate a range of tasks which are destined for the same grid level.

Author
Ole Schuett

Definition at line 247 of file grid_cpu_task_list.c.

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

◆ grid_cpu_collocate_task_list()

void grid_cpu_collocate_task_list ( const grid_cpu_task_list task_list,
const enum grid_func  func,
const int  nlevels,
const offload_buffer pab_blocks,
offload_buffer grids[nlevels] 
)

Collocate all tasks of in given list onto given grids. See grid_task_list.h for details.

Author
Ole Schuett

Definition at line 396 of file grid_cpu_task_list.c.

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

◆ store_hab()

static void store_hab ( const grid_basis_set ibasis,
const grid_basis_set jbasis,
const int  iset,
const int  jset,
const bool  transpose,
const double *  hab,
double *  block 
)
inlinestatic

Transforms hab from prim. cartesian to contracted spherical basis.

Author
Ole Schuett

Definition at line 419 of file grid_cpu_task_list.c.

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

◆ integrate_one_grid_level()

static void integrate_one_grid_level ( const grid_cpu_task_list task_list,
const int *  first_block_task,
const int *  last_block_task,
const bool  compute_tau,
const int  natoms,
const int  npts_global[3],
const int  npts_local[3],
const int  shift_local[3],
const int  border_width[3],
const double  dh[3][3],
const double  dh_inv[3][3],
const offload_buffer pab_blocks,
const offload_buffer grid,
offload_buffer hab_blocks,
double  forces[natoms][3],
double  virial[3][3] 
)
static

Integrate a range of tasks that belong to the same grid level.

Author
Ole Schuett

Definition at line 462 of file grid_cpu_task_list.c.

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

◆ grid_cpu_integrate_task_list()

void grid_cpu_integrate_task_list ( const grid_cpu_task_list task_list,
const bool  compute_tau,
const int  natoms,
const int  nlevels,
const offload_buffer pab_blocks,
const offload_buffer grids[nlevels],
offload_buffer hab_blocks,
double  forces[natoms][3],
double  virial[3][3] 
)

Integrate all tasks of in given list from given grids. See grid_task_list.h for details.

Author
Ole Schuett

Definition at line 611 of file grid_cpu_task_list.c.

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