Xmipp
v3.23.11-Nereus
|
#include <cuda_runtime_api.h>
#include "reconstruction_cuda/cuda_asserts.h"
#include "cuda_gpu_reconstruct_fourier.h"
#include "reconstruction_cuda/cuda_basic_math.h"
#include "gpu.h"
Go to the source code of this file.
Classes | |
struct | RecFourierBufferDataGPU |
Functions | |
__device__ float | bessi0Fast (float x) |
__device__ float | bessi0 (float x) |
__device__ float | bessi1 (float x) |
__device__ float | bessi2 (float x) |
__device__ float | bessi3 (float x) |
__device__ float | bessi4 (float x) |
template<int order> | |
__device__ float | kaiserValue (float r, float a) |
__device__ float | kaiserValueFast (float distSqr) |
float * | allocateTempVolumeGPU (float *&ptr, int size, int typeSize) |
void | copyTempVolumes (std::complex< float > ***tempVol, float ***tempWeights, float *tempVolGPU, float *tempWeightsGPU, int size) |
void | releaseTempVolumeGPU (float *&ptr) |
__device__ float | FFT_IDX2DIGFREQ (int idx, int size) |
__device__ float | getZ (float x, float y, const Point3D< float > &n, const Point3D< float > &p0) |
__device__ float | getY (float x, float z, const Point3D< float > &n, const Point3D< float > &p0) |
__device__ float | getX (float y, float z, const Point3D< float > &n, const Point3D< float > &p0) |
__device__ void | multiply (const float transform[3][3], Point3D< float > &inOut) |
__device__ void | computeAABB (Point3D< float > *AABB, Point3D< float > *cuboid) |
template<bool hasCTF> | |
__device__ void | processVoxel (float2 *tempVolumeGPU, float *tempWeightsGPU, int x, int y, int z, int xSize, int ySize, const float *__restrict__ CTF, const float *__restrict__ modulator, const float2 *__restrict__ FFT, const RecFourierProjectionTraverseSpace *const space) |
template<bool hasCTF, int blobOrder, bool useFastKaiser> | |
__device__ void | processVoxelBlob (float2 *tempVolumeGPU, float *tempWeightsGPU, int x, int y, int z, int xSize, int ySize, const float *__restrict__ CTF, const float *__restrict__ modulator, const float2 *__restrict__ FFT, const RecFourierProjectionTraverseSpace *const space, const float *blobTableSqrt, int imgCacheDim) |
template<bool useFast, bool hasCTF, int blobOrder, bool useFastKaiser> | |
__device__ void | processProjection (float2 *tempVolumeGPU, float *tempWeightsGPU, int xSize, int ySize, const float *__restrict__ CTF, const float *__restrict__ modulator, const float2 *__restrict__ FFT, const RecFourierProjectionTraverseSpace *const tSpace, const float *devBlobTableSqrt, int imgCacheDim) |
__device__ void | rotate (Point3D< float > *box, const float transform[3][3]) |
__device__ void | calculateAABB (const RecFourierProjectionTraverseSpace *tSpace, const RecFourierBufferDataGPU *buffer, Point3D< float > *dest) |
__device__ bool | isWithin (Point3D< float > *AABB, int imgXSize, int imgYSize) |
__device__ void | getImgData (Point3D< float > *AABB, int tXindex, int tYindex, RecFourierBufferDataGPU *const buffer, int imgIndex, float &vReal, float &vImag) |
__device__ void | copyImgToCache (float2 *dest, Point3D< float > *AABB, RecFourierBufferDataGPU *const buffer, int imgIndex, int imgCacheDim) |
template<bool useFast, bool hasCTF, int blobOrder, bool useFastKaiser> | |
__global__ void | processBufferKernel (float *tempVolumeGPU, float *tempWeightsGPU, RecFourierBufferDataGPU *buffer, float *devBlobTableSqrt, int imgCacheDim) |
__global__ void | convertImagesKernel (std::complex< float > *iFouriers, int iSizeX, int iSizeY, int iLength, RecFourierBufferDataGPU *oBuffer, float maxResolutionSqr) |
void | convertImages (FRecBufferDataGPUWrapper *wrapper, float maxResolutionSqr, int streamIndex) |
void | waitForGPU () |
void | createStreams (int count) |
void | deleteStreams (int count) |
void | pinMemory (RecFourierBufferData *buffer) |
void | unpinMemory (RecFourierBufferData *buffer) |
void | allocateWrapper (RecFourierBufferData *buffer, int streamIndex) |
void | copyBlobTable (float *blobTableSqrt, int blobTableSize) |
void | releaseBlobTable () |
void | releaseWrapper (int streamIndex) |
void | copyConstants (int maxVolIndexX, int maxVolIndexYZ, float blobRadius, float blobAlpha, float iDeltaSqrt, float iw0, float oneOverBessiOrderAlpha) |
template<int blobOrder, bool useFastKaiser> | |
void | processBufferGPU_ (float *tempVolumeGPU, float *tempWeightsGPU, RecFourierBufferData *buffer, float blobRadius, int maxVolIndexYZ, bool useFast, float maxResolutionSqr, int streamIndex) |
void | processBufferGPU (float *tempVolumeGPU, float *tempWeightsGPU, RecFourierBufferData *buffer, float blobRadius, int maxVolIndexYZ, bool useFast, float maxResolutionSqr, int streamIndex, int blobOrder, float blobAlpha) |
Variables | |
cudaStream_t * | streams |
FRecBufferDataGPUWrapper ** | wrappers |
float * | devBlobTableSqrt = NULL |
__device__ __constant__ int | cMaxVolumeIndexX = 0 |
__device__ __constant__ int | cMaxVolumeIndexYZ = 0 |
__device__ __constant__ float | cBlobRadius = 0.f |
__device__ __constant__ float | cOneOverBlobRadiusSqr = 0.f |
__device__ __constant__ float | cBlobAlpha = 0.f |
__device__ __constant__ float | cIw0 = 0.f |
__device__ __constant__ float | cIDeltaSqrt = 0.f |
__device__ __constant__ float | cOneOverBessiOrderAlpha = 0.f |
__device__ float bessi0 | ( | float | x | ) |
Definition at line 86 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ float bessi0Fast | ( | float | x | ) |
Definition at line 62 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ float bessi1 | ( | float | x | ) |
Definition at line 109 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ float bessi2 | ( | float | x | ) |
Definition at line 133 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ float bessi3 | ( | float | x | ) |
Definition at line 139 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ float bessi4 | ( | float | x | ) |
Definition at line 145 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ void calculateAABB | ( | const RecFourierProjectionTraverseSpace * | tSpace, |
const RecFourierBufferDataGPU * | buffer, | ||
Point3D< float > * | dest | ||
) |
Method calculates an Axis Aligned Bounding Box in the image space. AABB is guaranteed to be big enough that all threads in the block, while processing the traverse space, will not read image data outside of the AABB
Definition at line 774 of file cuda_gpu_reconstruct_fourier.cpp.
Compute Axis Aligned Bounding Box of given cuboid
Definition at line 428 of file cuda_gpu_reconstruct_fourier.cpp.
void convertImages | ( | FRecBufferDataGPUWrapper * | wrapper, |
float | maxResolutionSqr, | ||
int | streamIndex | ||
) |
Method takes padded input pictures, performs FFT and convert resulting images as necessary for the algorithm. Asynchronous method.
Definition at line 1008 of file cuda_gpu_reconstruct_fourier.cpp.
__global__ void convertImagesKernel | ( | std::complex< float > * | iFouriers, |
int | iSizeX, | ||
int | iSizeY, | ||
int | iLength, | ||
RecFourierBufferDataGPU * | oBuffer, | ||
float | maxResolutionSqr | ||
) |
Method will process the 'paddedFourier' (not shifted, i.e. low frequencies are in corners) in the following way: high frequencies are skipped (replaced by zero (0)) space is shifted, so that low frequencies are in the middle of the Y axis resulting space is cropped. Method returns a 2D array with Fourier coefficients, shifted so that low frequencies are in the center of the Y axis (i.e. semicircle)
Definition at line 963 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ void copyImgToCache | ( | float2 * | dest, |
Point3D< float > * | AABB, | ||
RecFourierBufferDataGPU *const | buffer, | ||
int | imgIndex, | ||
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 883 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ float FFT_IDX2DIGFREQ | ( | int | idx, |
int | size | ||
) |
Index to frequency
Given an index and a size of the FFT, this function returns the corresponding digital frequency (-1/2 to 1/2)
Definition at line 382 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ void getImgData | ( | Point3D< float > * | AABB, |
int | tXindex, | ||
int | tYindex, | ||
RecFourierBufferDataGPU *const | buffer, | ||
int | imgIndex, | ||
float & | vReal, | ||
float & | vImag | ||
) |
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 856 of file cuda_gpu_reconstruct_fourier.cpp.
Calculates X coordinate of the point [y, z] on the plane defined by p0 (origin) and normal
Definition at line 410 of file cuda_gpu_reconstruct_fourier.cpp.
Calculates Y coordinate of the point [x, z] on the plane defined by p0 (origin) and normal
Definition at line 400 of file cuda_gpu_reconstruct_fourier.cpp.
Calculates Z coordinate of the point [x, y] on the plane defined by p0 (origin) and normal
Definition at line 391 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ bool isWithin | ( | Point3D< float > * | AABB, |
int | imgXSize, | ||
int | imgYSize | ||
) |
Method returns true if AABB lies within the image boundaries
Definition at line 842 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ float kaiserValue | ( | float | r, |
float | a | ||
) |
Definition at line 153 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ float kaiserValueFast | ( | float | distSqr | ) |
Definition at line 200 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ void multiply | ( | const float | transform[3][3], |
Point3D< float > & | inOut | ||
) |
Do 3x3 x 1x3 matrix-vector multiplication
Definition at line 417 of file cuda_gpu_reconstruct_fourier.cpp.
void processBufferGPU_ | ( | float * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
RecFourierBufferData * | buffer, | ||
float | blobRadius, | ||
int | maxVolIndexYZ, | ||
bool | useFast, | ||
float | maxResolutionSqr, | ||
int | streamIndex | ||
) |
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 1136 of file cuda_gpu_reconstruct_fourier.cpp.
__global__ void processBufferKernel | ( | float * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
RecFourierBufferDataGPU * | buffer, | ||
float * | devBlobTableSqrt, | ||
int | imgCacheDim | ||
) |
Method will use data stored in the buffer and update temporal storages appropriately.
Definition at line 900 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ void processProjection | ( | float2 * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
int | xSize, | ||
int | ySize, | ||
const float *__restrict__ | CTF, | ||
const float *__restrict__ | modulator, | ||
const float2 *__restrict__ | FFT, | ||
const RecFourierProjectionTraverseSpace *const | tSpace, | ||
const float * | devBlobTableSqrt, | ||
int | imgCacheDim | ||
) |
Method will process one projection image and add result to temporal spaces.
Definition at line 660 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ void processVoxel | ( | float2 * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
int | x, | ||
int | y, | ||
int | z, | ||
int | xSize, | ||
int | ySize, | ||
const float *__restrict__ | CTF, | ||
const float *__restrict__ | modulator, | ||
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 457 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ void processVoxelBlob | ( | float2 * | tempVolumeGPU, |
float * | tempWeightsGPU, | ||
int | x, | ||
int | y, | ||
int | z, | ||
int | xSize, | ||
int | ySize, | ||
const float *__restrict__ | CTF, | ||
const float *__restrict__ | modulator, | ||
const float2 *__restrict__ | FFT, | ||
const RecFourierProjectionTraverseSpace *const | space, | ||
const float * | blobTableSqrt, | ||
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 512 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ void rotate | ( | Point3D< float > * | box, |
const float | transform[3][3] | ||
) |
Method will rotate box using transformation matrix around center of the working space
Definition at line 751 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ __constant__ float cBlobAlpha = 0.f |
Definition at line 56 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ __constant__ float cBlobRadius = 0.f |
Definition at line 54 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ __constant__ float cIDeltaSqrt = 0.f |
Definition at line 58 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ __constant__ float cIw0 = 0.f |
Definition at line 57 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ __constant__ int cMaxVolumeIndexX = 0 |
Definition at line 52 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ __constant__ int cMaxVolumeIndexYZ = 0 |
Definition at line 53 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ __constant__ float cOneOverBessiOrderAlpha = 0.f |
Definition at line 59 of file cuda_gpu_reconstruct_fourier.cpp.
__device__ __constant__ float cOneOverBlobRadiusSqr = 0.f |
Definition at line 55 of file cuda_gpu_reconstruct_fourier.cpp.
float* devBlobTableSqrt = NULL |
Definition at line 50 of file cuda_gpu_reconstruct_fourier.cpp.
cudaStream_t* streams |
Definition at line 44 of file cuda_gpu_reconstruct_fourier.cpp.
FRecBufferDataGPUWrapper** wrappers |
Definition at line 47 of file cuda_gpu_reconstruct_fourier.cpp.