RadioImagerGPU 1.0
|
#include "config.hpp"
#include "compute.hpp"
#include <cufft.h>
#include <thrust/complex.h>
#include <thrust/device_vector.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cuda_runtime.h>
Macros | |
#define | CHECK_CUFFT(call) |
Macro to check CUFFT errors and display an error message if an error occurs. | |
#define | CHECK_CUDA(call) |
Macro to check CUDA errors and display an error message if an error occurs. | |
Functions | |
const char * | cufftGetErrorString (cufftResult error) |
Get the error string for a given CUFFT error code. | |
void | checkCudaError (cudaError_t err, const char *msg) |
Check CUDA error and print a message if an error occurs. | |
__global__ void | fftshift_kernel (cufftDoubleComplex *data, cufftDoubleComplex *temp, int width, int height, int shiftX, int shiftY) |
Perform a 2D FFT shift operation on the given data. | |
void | fftshift (thrust::device_vector< cufftDoubleComplex > &data, int width, int height) |
Perform a 2D FFT shift on a thrust::device_vector. | |
__global__ void | mapVisibilitiesMultiDir (cufftDoubleComplex *grid, const cufftDoubleComplex *visibilities, const double *u, const double *v, double uv_max, double grid_res, int image_size, int num_visibilities, int num_directions) |
Map visibilities to a grid for multiple directions (batches). | |
void | uniformImage (const std::vector< std::vector< std::complex< double > > > &visibilities_batch, const std::vector< std::vector< double > > &u_batch, const std::vector< std::vector< double > > &v_batch, int image_size, std::vector< std::vector< double > > &images, bool use_predefined_params) |
Generate a uniform image from visibilities using FFT. | |
__global__ void | computeUVWKernel (const double *x_m, const double *y_m, const double *z_m, const double *HAs, const double *Decs, double *u, double *v, double *w, int N, int num_directions) |
CUDA kernel to compute UVW coordinates from XYZ coordinates for multiple directions. | |
void | computeUVW (const std::vector< double > &x_m, const std::vector< double > &y_m, const std::vector< double > &z_m, const std::vector< double > &HAs, const std::vector< double > &Decs, std::vector< std::vector< double > > &u, std::vector< std::vector< double > > &v, std::vector< std::vector< double > > &w) |
Compute UVW coordinates from XYZ coordinates for multiple directions. | |
#define CHECK_CUDA | ( | call | ) |
Macro to check CUDA errors and display an error message if an error occurs.
call | CUDA function call. |
#define CHECK_CUFFT | ( | call | ) |
Macro to check CUFFT errors and display an error message if an error occurs.
call | CUFFT function call. |
void checkCudaError | ( | cudaError_t | err, |
const char * | msg ) |
Check CUDA error and print a message if an error occurs.
err | CUDA error code. |
msg | Error message to display if an error occurs. |
void computeUVW | ( | const std::vector< double > & | x_m, |
const std::vector< double > & | y_m, | ||
const std::vector< double > & | z_m, | ||
const std::vector< double > & | HAs, | ||
const std::vector< double > & | Decs, | ||
std::vector< std::vector< double > > & | u, | ||
std::vector< std::vector< double > > & | v, | ||
std::vector< std::vector< double > > & | w ) |
Compute UVW coordinates from XYZ coordinates for multiple directions.
x_m | X coordinates of the antennas. |
y_m | Y coordinates of the antennas. |
z_m | Z coordinates of the antennas. |
HAs | Hour angles for multiple directions. |
Decs | Declinations for multiple directions. |
u | Output U coordinates for multiple directions. |
v | Output V coordinates for multiple directions. |
w | Output W coordinates for multiple directions. |
use_predefined_params | Flag to determine if predefined parameters should be used. |
__global__ void computeUVWKernel | ( | const double * | x_m, |
const double * | y_m, | ||
const double * | z_m, | ||
const double * | HAs, | ||
const double * | Decs, | ||
double * | u, | ||
double * | v, | ||
double * | w, | ||
int | N, | ||
int | num_directions ) |
CUDA kernel to compute UVW coordinates from XYZ coordinates for multiple directions.
x_m | X coordinates of the antennas. |
y_m | Y coordinates of the antennas. |
z_m | Z coordinates of the antennas. |
HAs | Hour angles for multiple directions. |
Decs | Declinations for multiple directions. |
u | Output U coordinates. |
v | Output V coordinates. |
w | Output W coordinates. |
N | Number of antennas. |
num_directions | Number of directions. |
const char * cufftGetErrorString | ( | cufftResult | error | ) |
Get the error string for a given CUFFT error code.
error | CUFFT error code. |
void fftshift | ( | thrust::device_vector< cufftDoubleComplex > & | data, |
int | width, | ||
int | height ) |
Perform a 2D FFT shift on a thrust::device_vector.
data | Data to be shifted. |
width | Width of the data array. |
height | Height of the data array. |
__global__ void fftshift_kernel | ( | cufftDoubleComplex * | data, |
cufftDoubleComplex * | temp, | ||
int | width, | ||
int | height, | ||
int | shiftX, | ||
int | shiftY ) |
Perform a 2D FFT shift operation on the given data.
data | Input data to be shifted. |
temp | Temporary data storage for shifting. |
width | Width of the data array. |
height | Height of the data array. |
shiftX | Amount to shift in the X direction. |
shiftY | Amount to shift in the Y direction. |
__global__ void mapVisibilitiesMultiDir | ( | cufftDoubleComplex * | grid, |
const cufftDoubleComplex * | visibilities, | ||
const double * | u, | ||
const double * | v, | ||
double | uv_max, | ||
double | grid_res, | ||
int | image_size, | ||
int | num_visibilities, | ||
int | num_directions ) |
Map visibilities to a grid for multiple directions (batches).
grid | Output grid to store the mapped visibilities. |
visibilities | Input visibilities to map. |
u | U coordinates of visibilities. |
v | V coordinates of visibilities. |
uv_max | Maximum UV coordinate value. |
grid_res | Resolution of the grid. |
image_size | Size of the output image. |
num_visibilities | Number of visibilities. |
num_directions | Number of directions. |
void uniformImage | ( | const std::vector< std::vector< std::complex< double > > > & | visibilities_batch, |
const std::vector< std::vector< double > > & | u_batch, | ||
const std::vector< std::vector< double > > & | v_batch, | ||
int | image_size, | ||
std::vector< std::vector< double > > & | images, | ||
bool | use_predefined_params ) |
Generate a uniform image from visibilities using FFT.
visibilities_batch | Batch of visibilities for multiple directions. |
u_batch | U coordinates for multiple directions. |
v_batch | V coordinates for multiple directions. |
image_size | Size of the output image. |
images | Output images. |
use_predefined_params | Flag to determine if predefined parameters should be used. |