ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
barnes_hut_gpu_cuda.cuh File Reference
#include "config/config.hpp"

Go to the source code of this file.

Classes

struct  BHData
 

Macros

#define WARPSIZE   32
 Barnes-Hut warp size.
 
#define MAXDEPTH   32
 Maximal depth of the Barnes-Hut tree branching.
 
Barnes-Hut thread count for different kernels.
#define THREADS1   512
 
#define THREADS2   1024
 
#define THREADS3   1024
 
#define THREADS4   1024
 
#define THREADS5   256
 
Barnes-Hut block factor for different kernels.

block count = factor * number of blocks

#define FACTOR1   2
 
#define FACTOR2   1
 
#define FACTOR3   1 /* must all be resident at the same time */
 
#define FACTOR4   1 /* must all be resident at the same time */
 
#define FACTOR5   4
 

Functions

void setBHPrecision (float epssq, float itolsq)
 Barnes-Hut parameters setter.
 
void allocBHmemCopy (int nbodies, BHData *bh_data)
 An allocation of the GPU device memory and an initialization where it is needed.
 
void deallocBH (BHData *bh_data)
 A deallocation of the GPU device memory.
 
void fill_bh_data (float const *r, float const *dip, BHData const *bh_data)
 Copy Barnes-Hut data to bhpara and copy particle data.
 
void initBHgpu (int blocks)
 Barnes-Hut CUDA initialization.
 
void buildBoxBH (int blocks)
 Building Barnes-Hut spatial min/max position box.
 
void buildTreeBH (int blocks)
 Building Barnes-Hut tree in a linear child array representation of octant cells and particles inside.
 
void summarizeBH (int blocks)
 Calculate octant cells masses and cell index counts. Determine cells centers of mass and total dipole moments on all possible levels of the Barnes-Hut tree.
 
void sortBH (int blocks)
 Sort particle indexes according to the Barnes-Hut tree representation. Crucial for the per-warp performance tuning of forceCalculationKernel and energyCalculationKernel.
 
void forceBH (BHData *bh_data, float k, float *f, float *torque)
 Barnes-Hut force calculation.
 
void energyBH (BHData *bh_data, float k, float *E)
 Barnes-Hut energy calculation.
 

Macro Definition Documentation

◆ FACTOR1

#define FACTOR1   2

Definition at line 73 of file barnes_hut_gpu_cuda.cuh.

◆ FACTOR2

#define FACTOR2   1

Definition at line 74 of file barnes_hut_gpu_cuda.cuh.

◆ FACTOR3

#define FACTOR3   1 /* must all be resident at the same time */

Definition at line 75 of file barnes_hut_gpu_cuda.cuh.

◆ FACTOR4

#define FACTOR4   1 /* must all be resident at the same time */

Definition at line 76 of file barnes_hut_gpu_cuda.cuh.

◆ FACTOR5

#define FACTOR5   4

Definition at line 77 of file barnes_hut_gpu_cuda.cuh.

◆ MAXDEPTH

#define MAXDEPTH   32

Maximal depth of the Barnes-Hut tree branching.

Definition at line 83 of file barnes_hut_gpu_cuda.cuh.

◆ THREADS1

#define THREADS1   512

Definition at line 63 of file barnes_hut_gpu_cuda.cuh.

◆ THREADS2

#define THREADS2   1024

Definition at line 64 of file barnes_hut_gpu_cuda.cuh.

◆ THREADS3

#define THREADS3   1024

Definition at line 65 of file barnes_hut_gpu_cuda.cuh.

◆ THREADS4

#define THREADS4   1024

Definition at line 66 of file barnes_hut_gpu_cuda.cuh.

◆ THREADS5

#define THREADS5   256

Definition at line 67 of file barnes_hut_gpu_cuda.cuh.

◆ WARPSIZE

#define WARPSIZE   32

Barnes-Hut warp size.

Definition at line 81 of file barnes_hut_gpu_cuda.cuh.

Function Documentation

◆ allocBHmemCopy()

void allocBHmemCopy ( int  nbodies,
BHData bh_data 
)

◆ buildBoxBH()

void buildBoxBH ( int  blocks)

Building Barnes-Hut spatial min/max position box.

Definition at line 1040 of file barnes_hut_gpu_cuda.cu.

References block(), cuda_safe_mem, FACTOR1, KERNELCALL, and THREADS1.

◆ buildTreeBH()

void buildTreeBH ( int  blocks)

Building Barnes-Hut tree in a linear child array representation of octant cells and particles inside.

Definition at line 1054 of file barnes_hut_gpu_cuda.cu.

References block(), cuda_safe_mem, FACTOR2, KERNELCALL, and THREADS2.

◆ deallocBH()

void deallocBH ( BHData bh_data)

◆ energyBH()

void energyBH ( BHData bh_data,
float  k,
float *  E 
)

Barnes-Hut energy calculation.

Definition at line 1113 of file barnes_hut_gpu_cuda.cu.

References block(), BHData::blocks, cuda_safe_mem, energySum, BHData::err, FACTOR5, KERNELCALL_shared, and THREADS5.

Referenced by DipolarBarnesHutGpu::long_range_energy().

◆ fill_bh_data()

void fill_bh_data ( float const *  r,
float const *  dip,
BHData const *  bh_data 
)

Copy Barnes-Hut data to bhpara and copy particle data.

Parameters
rdevice particle positions to copy
dipdevice particle dipoles to copy
bh_dataBarnes-Hut container

Definition at line 1258 of file barnes_hut_gpu_cuda.cu.

References bhpara, cuda_safe_mem, BHData::nbodies, BHData::r, and BHData::u.

◆ forceBH()

void forceBH ( BHData bh_data,
float  k,
float *  f,
float *  torque 
)

Barnes-Hut force calculation.

Definition at line 1094 of file barnes_hut_gpu_cuda.cu.

References block(), BHData::blocks, cuda_safe_mem, BHData::err, f, FACTOR5, KERNELCALL, THREADS5, and torque.

Referenced by DipolarBarnesHutGpu::add_long_range_forces().

◆ initBHgpu()

void initBHgpu ( int  blocks)

Barnes-Hut CUDA initialization.

Definition at line 1019 of file barnes_hut_gpu_cuda.cu.

References block(), FACTOR5, initializationKernel(), KERNELCALL, and THREADS5.

◆ setBHPrecision()

void setBHPrecision ( float  epssq,
float  itolsq 
)

Barnes-Hut parameters setter.

Definition at line 1145 of file barnes_hut_gpu_cuda.cu.

References cuda_safe_mem, epssqd, and itolsqd.

Referenced by DipolarBarnesHutGpu::on_activation().

◆ sortBH()

void sortBH ( int  blocks)

Sort particle indexes according to the Barnes-Hut tree representation. Crucial for the per-warp performance tuning of forceCalculationKernel and energyCalculationKernel.

Definition at line 1082 of file barnes_hut_gpu_cuda.cu.

References block(), cuda_safe_mem, FACTOR4, KERNELCALL, and THREADS4.

◆ summarizeBH()

void summarizeBH ( int  blocks)

Calculate octant cells masses and cell index counts. Determine cells centers of mass and total dipole moments on all possible levels of the Barnes-Hut tree.

Definition at line 1068 of file barnes_hut_gpu_cuda.cu.

References block(), cuda_safe_mem, FACTOR3, KERNELCALL, and THREADS3.