ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
CUDA kernels to convert the particles AoS to a SoA on the device. More...
#include "config/config.hpp"
#include "GpuParticleData.hpp"
#include "ResourceCleanup.hpp"
#include "System.hpp"
#include "ParticleRange.hpp"
#include "errorhandling.hpp"
#include "cuda/init.hpp"
#include "cuda/utils.cuh"
#include <thrust/copy.h>
#include <thrust/device_vector.h>
#include <cuda.h>
#include <cstddef>
#include <cstdio>
#include <memory>
#include <span>
Go to the source code of this file.
Classes | |
class | GpuParticleData::Storage |
Host and device containers for particle data. More... | |
Functions | |
template<class T > | |
T * | raw_data_pointer (thrust::device_vector< T > &vec) |
template<class SpanLike > | |
std::size_t | byte_size (SpanLike const &v) |
template<class T > | |
void | resize_or_replace (thrust::device_vector< T > &vec, std::size_t n) |
Resize a thrust::device_vector . | |
template<typename T > | |
void | free_device_vector (thrust::device_vector< T > &vec) |
__global__ void | split_kernel_r (GpuParticleData::GpuParticle *particles, float *r, std::size_t n) |
__global__ void | split_kernel_rq (GpuParticleData::GpuParticle *particles, float *r, float *q, std::size_t n) |
__global__ void | split_kernel_q (GpuParticleData::GpuParticle *particles, float *q, std::size_t n) |
__global__ void | split_kernel_dip (GpuParticleData::GpuParticle *particles, float *dip, std::size_t n) |
CUDA kernels to convert the particles AoS to a SoA on the device.
Definition in file GpuParticleData_cuda.cu.
std::size_t byte_size | ( | SpanLike const & | v | ) |
Definition at line 54 of file GpuParticleData_cuda.cu.
Referenced by GpuParticleData::Storage::copy_particles_to_device().
void free_device_vector | ( | thrust::device_vector< T > & | vec | ) |
Definition at line 84 of file GpuParticleData_cuda.cu.
T * raw_data_pointer | ( | thrust::device_vector< T > & | vec | ) |
Definition at line 50 of file GpuParticleData_cuda.cu.
Referenced by GpuParticleData::Storage::copy_particles_to_device(), GpuParticleData::get_particle_forces_device(), GpuParticleData::get_particle_torques_device(), and GpuParticleData::Storage::split_particle_struct().
void resize_or_replace | ( | thrust::device_vector< T > & | vec, |
std::size_t | n | ||
) |
Resize a thrust::device_vector
.
Due to a bug in thrust (https://github.com/thrust/thrust/issues/939), resizing or appending to default constructed containers causes undefined behavior by dereferencing a null-pointer for certain types. This function is used instead of the resize member function to side-step the problem. This is done by replacing the existing vector by a new one constructed with the desired size if resizing from capacity zero. Behaves as-if vec.resize(n)
was called. This is fixed in Thrust 1.11, shipped in CUDA 11.3 (https://github.com/NVIDIA/thrust/commit/1c4f25d9).
T | Type contained in the vector. |
vec | Vector to resize. |
n | Desired new size of the vector. |
Definition at line 76 of file GpuParticleData_cuda.cu.
Referenced by GpuParticleData::Storage::copy_particles_to_device().
__global__ void split_kernel_dip | ( | GpuParticleData::GpuParticle * | particles, |
float * | dip, | ||
std::size_t | n | ||
) |
Definition at line 342 of file GpuParticleData_cuda.cu.
__global__ void split_kernel_q | ( | GpuParticleData::GpuParticle * | particles, |
float * | q, | ||
std::size_t | n | ||
) |
Definition at line 329 of file GpuParticleData_cuda.cu.
__global__ void split_kernel_r | ( | GpuParticleData::GpuParticle * | particles, |
float * | r, | ||
std::size_t | n | ||
) |
Definition at line 300 of file GpuParticleData_cuda.cu.
__global__ void split_kernel_rq | ( | GpuParticleData::GpuParticle * | particles, |
float * | r, | ||
float * | q, | ||
std::size_t | n | ||
) |
Definition at line 315 of file GpuParticleData_cuda.cu.