Xmipp
v3.23.11-Nereus
|
#include <atomic>
#include <core/multidim_array.h>
#include <core/xmipp_fft.h>
#include <core/xmipp_fftw.h>
#include <reconstruction/reconstruct_fourier_projection_traverse_space.h>
#include <reconstruction_cuda/cuda_basic_math.h>
#include <reconstruction_cuda/cuda_xmipp_utils.h>
#include <reconstruction_cuda/cuda_asserts.h>
#include <cuda_runtime_api.h>
#include <starpu.h>
#include "reconstruct_fourier_codelets.h"
#include "reconstruct_fourier_defines.h"
Go to the source code of this file.
Classes | |
struct | CodeletConstants |
Functions | |
void | reconstruct_cuda_initialize_constants (int maxVolIndexX, int maxVolIndexYZ, float blobRadius, float blobAlpha, float iDeltaSqrt, float iw0, float oneOverBessiOrderAlpha) |
__host__ __device__ float | bessi0Fast (float x) |
__host__ __device__ float | bessi0 (float x) |
__host__ __device__ float | bessi1 (float x) |
__host__ __device__ float | bessi2 (float x) |
__host__ __device__ float | bessi3 (float x) |
__host__ __device__ float | bessi4 (float x) |
template<int order> | |
__host__ __device__ float | kaiserValue (float r, float a) |
__host__ __device__ float | kaiserValueFast (float distSqr) |
__host__ __device__ float | getZ (float x, float y, const Point3D< float > &n, const Point3D< float > &p0) |
__host__ __device__ float | getY (float x, float z, const Point3D< float > &n, const Point3D< float > &p0) |
__host__ __device__ float | getX (float y, float z, const Point3D< float > &n, const Point3D< float > &p0) |
__host__ __device__ void | multiply (const float transform[3][3], Point3D< float > &inOut) |
__host__ __device__ void | rotate (Point3D< float > box[8], const float transform[3][3]) |
__host__ __device__ void | computeAABB (Point3D< float > AABB[2], const Point3D< float > cuboid[8]) |
__device__ void | processVoxel (float2 *tempVolumeGPU, float *tempWeightsGPU, int x, int y, int z, int xSize, int ySize, const float2 *__restrict__ FFT, const RecFourierProjectionTraverseSpace *const space) |
template<int blobOrder, bool useFastKaiser> | |
__device__ void | processVoxelBlob (float2 *tempVolumeGPU, float *tempWeightsGPU, const int x, const int y, const int z, const int xSize, const int ySize, const float2 *__restrict__ FFT, const RecFourierProjectionTraverseSpace *const space, const float *blobTableSqrt, const int imgCacheDim) |
template<bool useFast, int blobOrder, bool useFastKaiser> | |
__device__ void | processProjection (float2 *tempVolumeGPU, float *tempWeightsGPU, const int xSize, const int ySize, const float2 *__restrict__ FFT, const RecFourierProjectionTraverseSpace *const tSpace, const float *blobTableSqrt, const int imgCacheDim) |
__device__ void | getImgData (const Point3D< float > AABB[2], const int tXindex, const int tYindex, const float2 *FFTs, const int fftSizeX, const int fftSizeY, const int imgIndex, float2 &vComplex) |
__device__ void | copyImgToCache (float2 *dest, const Point3D< float > AABB[2], const float2 *FFTs, const int fftSizeX, const int fftSizeY, const int imgIndex, const int imgCacheDim) |
template<bool fastLateBlobbing, int blobOrder, bool useFastKaiser> | |
__global__ void | processBufferKernel (float2 *outVolumeBuffer, float *outWeightsBuffer, const int fftSizeX, const int fftSizeY, const int traverseSpaceCount, const RecFourierProjectionTraverseSpace *traverseSpaces, const float2 *FFTs, const float *blobTableSqrt, int imgCacheDim) |
template<int blobOrder, bool useFastKaiser> | |
void | processBufferGPU (float2 *outVolumeBuffer, float *outWeightsBuffer, const int fftSizeX, const int fftSizeY, const int traverseSpaceCount, const RecFourierProjectionTraverseSpace *traverseSpaces, const float2 *inFFTs, const float *blobTableSqrt, const bool fastLateBlobbing, const float blobRadius, const int maxVolIndexYZ) |
void | func_reconstruct_cuda (void *buffers[], void *cl_arg) |
void | atomicAddFloat (volatile float *ptr, float addedValue) |
void | processVoxelCPU (float2 *const tempVolumeGPU, float *const tempWeightsGPU, const int x, const int y, const int z, const int xSize, const int ySize, const float2 *const __restrict__ FFT, const RecFourierProjectionTraverseSpace *const space) |
template<int blobOrder, bool useFastKaiser, bool usePrecomputedInterpolation> | |
void | processVoxelBlobCPU (float2 *const tempVolumeGPU, float *const tempWeightsGPU, const int x, const int y, const int z, const int xSize, const int ySize, const float2 *const __restrict__ FFT, const RecFourierProjectionTraverseSpace *const space, const float *blobTableSqrt) |
template<bool useFast, int blobOrder, bool useFastKaiser, bool usePrecomputedInterpolation> | |
void | processProjectionCPU (float2 *tempVolumeGPU, float *tempWeightsGPU, const int xSize, const int ySize, const float2 *__restrict__ FFT, const RecFourierProjectionTraverseSpace *const tSpace, const float *blobTableSqrt) |
template<int blobOrder, bool useFastKaiser, bool usePrecomputedInterpolation> | |
void | processBufferCPU (float2 *outVolumeBuffer, float *outWeightsBuffer, const int fftSizeX, const int fftSizeY, const int traverseSpaceCount, const RecFourierProjectionTraverseSpace *traverseSpaces, const float2 *inFFTs, const float *blobTableSqrt, const bool fastLateBlobbing) |
template<bool usePrecomputedInterpolation> | |
void | func_reconstruct_cpu_template (void *buffers[], void *cl_arg) |
void | func_reconstruct_cpu_lookup_interpolation (void *buffers[], void *cl_arg) |
void | func_reconstruct_cpu_dynamic_interpolation (void *buffers[], void *cl_arg) |
Variables | |
__shared__ float | BLOB_TABLE [BLOB_TABLE_SIZE_SQRT] |
__device__ __constant__ CodeletConstants | gpuC |
CodeletConstants | cpuC |
void atomicAddFloat | ( | volatile float * | ptr, |
float | addedValue | ||
) |
Atomically increments the value pointed at by ptr by value. Uses relaxed memory model with no reordering guarantees.
Definition at line 892 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float bessi0 | ( | float | x | ) |
Definition at line 123 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float bessi0Fast | ( | float | x | ) |
Definition at line 99 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float bessi1 | ( | float | x | ) |
Definition at line 144 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float bessi2 | ( | float | x | ) |
Definition at line 167 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float bessi3 | ( | float | x | ) |
Definition at line 172 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float bessi4 | ( | float | x | ) |
Definition at line 177 of file reconstruct_fourier_codelet_reconstruct.cpp.
Compute Axis Aligned Bounding Box of given cuboid
Definition at line 317 of file reconstruct_fourier_codelet_reconstruct.cpp.
__device__ void copyImgToCache | ( | float2 * | dest, |
const Point3D< float > | AABB[2], | ||
const float2 * | FFTs, | ||
const int | fftSizeX, | ||
const int | fftSizeY, | ||
const int | imgIndex, | ||
const int | imgCacheDim | ||
) |
Method will copy imgIndex(th) data from buffer to given destination (shared memory). Only data within AABB will be copied. Destination is expected to be continuous array of sufficient size (imgCacheDim^2)
Definition at line 695 of file reconstruct_fourier_codelet_reconstruct.cpp.
void func_reconstruct_cpu_dynamic_interpolation | ( | void * | buffers[], |
void * | cl_arg | ||
) |
Definition at line 1209 of file reconstruct_fourier_codelet_reconstruct.cpp.
void func_reconstruct_cpu_lookup_interpolation | ( | void * | buffers[], |
void * | cl_arg | ||
) |
Definition at line 1205 of file reconstruct_fourier_codelet_reconstruct.cpp.
void func_reconstruct_cpu_template | ( | void * | buffers[], |
void * | cl_arg | ||
) |
Definition at line 1141 of file reconstruct_fourier_codelet_reconstruct.cpp.
void func_reconstruct_cuda | ( | void * | buffers[], |
void * | cl_arg | ||
) |
Definition at line 815 of file reconstruct_fourier_codelet_reconstruct.cpp.
__device__ void getImgData | ( | const Point3D< float > | AABB[2], |
const int | tXindex, | ||
const int | tYindex, | ||
const float2 * | FFTs, | ||
const int | fftSizeX, | ||
const int | fftSizeY, | ||
const int | imgIndex, | ||
float2 & | vComplex | ||
) |
Method will load data from image at position tXindex, tYindex and return them. In case the data lies outside of the image boundaries, zeros (0,0) are returned
Definition at line 670 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float getX | ( | float | y, |
float | z, | ||
const Point3D< float > & | n, | ||
const Point3D< float > & | p0 | ||
) |
Calculates X coordinate of the point [y, z] on the plane defined by p0 (origin) and normal
Definition at line 269 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float getY | ( | float | x, |
float | z, | ||
const Point3D< float > & | n, | ||
const Point3D< float > & | p0 | ||
) |
Calculates Y coordinate of the point [x, z] on the plane defined by p0 (origin) and normal
Definition at line 261 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float getZ | ( | float | x, |
float | y, | ||
const Point3D< float > & | n, | ||
const Point3D< float > & | p0 | ||
) |
Calculates Z coordinate of the point [x, y] on the plane defined by p0 (origin) and normal
Definition at line 254 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float kaiserValue | ( | float | r, |
float | a | ||
) |
Definition at line 183 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ float kaiserValueFast | ( | float | distSqr | ) |
Definition at line 236 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ void multiply | ( | const float | transform[3][3], |
Point3D< float > & | inOut | ||
) |
Do 3x3 x 1x3 matrix-vector multiplication
Definition at line 276 of file reconstruct_fourier_codelet_reconstruct.cpp.
void processBufferCPU | ( | float2 * | outVolumeBuffer, |
float * | outWeightsBuffer, | ||
const int | fftSizeX, | ||
const int | fftSizeY, | ||
const int | traverseSpaceCount, | ||
const RecFourierProjectionTraverseSpace * | traverseSpaces, | ||
const float2 * | inFFTs, | ||
const float * | blobTableSqrt, | ||
const bool | fastLateBlobbing | ||
) |
Definition at line 1105 of file reconstruct_fourier_codelet_reconstruct.cpp.
void processBufferGPU | ( | float2 * | outVolumeBuffer, |
float * | outWeightsBuffer, | ||
const int | fftSizeX, | ||
const int | fftSizeY, | ||
const int | traverseSpaceCount, | ||
const RecFourierProjectionTraverseSpace * | traverseSpaces, | ||
const float2 * | inFFTs, | ||
const float * | blobTableSqrt, | ||
const bool | fastLateBlobbing, | ||
const float | blobRadius, | ||
const int | maxVolIndexYZ | ||
) |
Method will use data stored in the buffer and update temporal storages appropriately. Actual calculation is done asynchronously, but 'buffer' can be reused once the method returns.
Definition at line 774 of file reconstruct_fourier_codelet_reconstruct.cpp.
__global__ void processBufferKernel | ( | float2 * | outVolumeBuffer, |
float * | outWeightsBuffer, | ||
const int | fftSizeX, | ||
const int | fftSizeY, | ||
const int | traverseSpaceCount, | ||
const RecFourierProjectionTraverseSpace * | traverseSpaces, | ||
const float2 * | FFTs, | ||
const float * | blobTableSqrt, | ||
int | imgCacheDim | ||
) |
Method will use data stored in the buffer and update temporal storages appropriately.
Definition at line 712 of file reconstruct_fourier_codelet_reconstruct.cpp.
__device__ void processProjection | ( | float2 * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
const int | xSize, | ||
const int | ySize, | ||
const float2 *__restrict__ | FFT, | ||
const RecFourierProjectionTraverseSpace *const | tSpace, | ||
const float * | blobTableSqrt, | ||
const int | imgCacheDim | ||
) |
Method will process one projection image and add result to temporal spaces.
Definition at line 579 of file reconstruct_fourier_codelet_reconstruct.cpp.
void processProjectionCPU | ( | float2 * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
const int | xSize, | ||
const int | ySize, | ||
const float2 *__restrict__ | FFT, | ||
const RecFourierProjectionTraverseSpace *const | tSpace, | ||
const float * | blobTableSqrt | ||
) |
Definition at line 1034 of file reconstruct_fourier_codelet_reconstruct.cpp.
__device__ void processVoxel | ( | float2 * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
int | x, | ||
int | y, | ||
int | z, | ||
int | xSize, | ||
int | ySize, | ||
const float2 *__restrict__ | FFT, | ||
const RecFourierProjectionTraverseSpace *const | space | ||
) |
Method will map one voxel from the temporal spaces to the given projection and update temporal spaces using the pixel value of the projection.
Definition at line 435 of file reconstruct_fourier_codelet_reconstruct.cpp.
__device__ void processVoxelBlob | ( | float2 * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
const int | x, | ||
const int | y, | ||
const int | z, | ||
const int | xSize, | ||
const int | ySize, | ||
const float2 *__restrict__ | FFT, | ||
const RecFourierProjectionTraverseSpace *const | space, | ||
const float * | blobTableSqrt, | ||
const int | imgCacheDim | ||
) |
Method will map one voxel from the temporal spaces to the given projection and update temporal spaces using the pixel values of the projection withing the blob distance.
Definition at line 481 of file reconstruct_fourier_codelet_reconstruct.cpp.
void processVoxelBlobCPU | ( | float2 *const | tempVolumeGPU, |
float *const | tempWeightsGPU, | ||
const int | x, | ||
const int | y, | ||
const int | z, | ||
const int | xSize, | ||
const int | ySize, | ||
const float2 *const __restrict__ | FFT, | ||
const RecFourierProjectionTraverseSpace *const | space, | ||
const float * | blobTableSqrt | ||
) |
Definition at line 954 of file reconstruct_fourier_codelet_reconstruct.cpp.
void processVoxelCPU | ( | float2 *const | tempVolumeGPU, |
float *const | tempWeightsGPU, | ||
const int | x, | ||
const int | y, | ||
const int | z, | ||
const int | xSize, | ||
const int | ySize, | ||
const float2 *const __restrict__ | FFT, | ||
const RecFourierProjectionTraverseSpace *const | space | ||
) |
Definition at line 911 of file reconstruct_fourier_codelet_reconstruct.cpp.
void reconstruct_cuda_initialize_constants | ( | int | maxVolIndexX, |
int | maxVolIndexYZ, | ||
float | blobRadius, | ||
float | blobAlpha, | ||
float | iDeltaSqrt, | ||
float | iw0, | ||
float | oneOverBessiOrderAlpha | ||
) |
Copy constants used for calculation to GPU memory. Blocking operation.
Definition at line 74 of file reconstruct_fourier_codelet_reconstruct.cpp.
__host__ __device__ void rotate | ( | Point3D< float > | box[8], |
const float | transform[3][3] | ||
) |
Method will rotate box using transformation matrix around center of the working space
Definition at line 290 of file reconstruct_fourier_codelet_reconstruct.cpp.
__shared__ float BLOB_TABLE[BLOB_TABLE_SIZE_SQRT] |
Definition at line 46 of file reconstruct_fourier_codelet_reconstruct.cpp.
CodeletConstants cpuC |
Definition at line 68 of file reconstruct_fourier_codelet_reconstruct.cpp.
__device__ __constant__ CodeletConstants gpuC |
Definition at line 67 of file reconstruct_fourier_codelet_reconstruct.cpp.