calculate_visibilities_gpu¶
API documentation for calculate_visibilities_gpu.cpp
Primary function to take the simulation settings and sky models generated on the host, transfer everything over to the device, run the simulation through the GPU code, and grab everything back off the device and onto the host.
- Author
J.L.B. Line
Functions
-
calc_visi_inouts_t *create_calc_visi_inouts_gpu(array_layout_t *array_layout, visibility_set_t *visibility_set, visibility_set_t *d_visibility_set, user_precision_t *sbf, woden_settings_t *woden_settings, int num_shapelets, int use_twobeams)¶
Creates and initialises the
calc_visi_inouts_tstructure for GPU calculations. This function gathers all inputs into one struct, and allocates memory for intermediate outputs. Makes it easy to pass all the inputs and outputs to the GPU functions.Specifically, we copy the following into GPU mempory:
d_calc_visi_inouts->X_difffromarray_layout->X_diff_metresd_calc_visi_inouts->Y_difffromarray_layout->Y_diff_metresd_calc_visi_inouts->Z_difffromarray_layout->Z_diff_metresd_calc_visi_inouts->allsteps_sha0sfromvisibility_set->allsteps_sha0sd_calc_visi_inouts->allsteps_cha0sfromvisibility_set->allsteps_cha0sd_calc_visi_inouts->allsteps_wavelengthsfromvisibility_set->allsteps_wavelengthsd_calc_visi_inouts->freqsfromvisibility_set->channel_frequenciesd_calc_visi_inouts->sbffromsbf(if we have shapelets in our sky model)
and depending on the number of shapelets and whether we using a unique beam for each station, we allocate GPU memory for:
d_calc_visi_inouts->u_metresd_calc_visi_inouts->v_metresd_calc_visi_inouts->w_metresd_calc_visi_inouts->usd_calc_visi_inouts->vsd_calc_visi_inouts->wsd_calc_visi_inouts->d_u_shapesd_calc_visi_inouts->d_v_shapesd_calc_visi_inouts->d_ant1_to_baseline_mapd_calc_visi_inouts->d_ant2_to_baseline_mapd_visibility_set->sum_visi_XX_reald_visibility_set->sum_visi_XX_imagd_visibility_set->sum_visi_XY_reald_visibility_set->sum_visi_XY_imagd_visibility_set->sum_visi_YX_reald_visibility_set->sum_visi_YX_imagd_visibility_set->sum_visi_YY_reald_visibility_set->sum_visi_YY_imag
External GPU code linked in from calculate_visibilities_gpu.c, see calculate_visibilities_gpu.h for full details.
- Parameters:
array_layout – Pointer to the array layout structure.
visibility_set – Pointer to the visibility set structure.
d_visibility_set – Pointer to the GPU visibility set structure (shouldn’t have any attribute initialised)
sbf – Pointer to shapelet basis function array
woden_settings – Pointer to the WODEN settings structure.
num_shapelets – Number of shapelets in the source_catalogue
use_twobeams – Flag indicating whether to use two beams per baseline (1) or not (0) (assumes all primary beams are unique)
- Returns:
Pointer to the initialised calc_visi_inouts_t structure.
-
void set_visibilities_to_zero_gpu(visibility_set_t *d_visibility_set, visibility_set_t *chunk_visibility_set, int num_visis)¶
Sets the visibility set to zero.
This function sets the real and imaginary parts of all visibilities in the GPU visibility set to zero, by copying the zeroed arrays in the
chunk_visibility_setto thed_visibility_set.External GPU code linked in from calculate_visibilities_gpu.c, see calculate_visibilities_gpu.h for full details.
- Parameters:
d_visibility_set – Pointer to the GPU visibility set structure.
chunk_visibility_set – Pointer to the CPU visibility set structure. This should have it’s visibilities set to zero
num_visis – Number of visibilities to be set to zero.
-
void copy_gpu_visi_set_to_host(visibility_set_t *d_visibility_set, calc_visi_inouts_t *d_calc_visi_inouts, visibility_set_t *chunk_visibility_set, int num_visis)¶
Copies the GPU visibilities and
uvwcoords set back to the CPU visibility set.This function copies the GPU visibility arrays out of
d_visibility_set, and theuvwcoords out ofd_calc_visi_inoutsintochunk_visibility_set.External GPU code linked in from calculate_visibilities_gpu.c, see calculate_visibilities_gpu.h for full details.
- Parameters:
d_visibility_set – Pointer to the GPU visibility set structure.
d_calc_visi_inouts – Pointer to the GPU calc_visi_inouts structure.
chunk_visibility_set – Pointer to the CPU visibility set structure.
num_visis – Number of visibilities to be copied.
-
void free_calc_visi_inouts_gpu(calc_visi_inouts_t *d_calc_visi_inouts, visibility_set_t *d_visibility_set, int num_shapelets, int use_twobeams)¶
Frees the GPU memory allocated for the
calc_visi_inouts_tstructure.Frees everything that was allocated in
create_calc_visi_inouts_gpu.External GPU code linked in from calculate_visibilities_gpu.c, see calculate_visibilities_gpu.h for full details.
- Parameters:
d_calc_visi_inouts – Pointer to the GPU
calc_visi_inouts_tstructure.d_visibility_set – Pointer to the GPU
visibility_set_tstructure.num_shapelets – Number of shapelets in the original source_catalogue.
use_twobeams – Flag indicating whether to use two beams per baseline (1) or not (0) (assumes all primary beams are unique)