fundamental_coords_gpu¶
API documentation for fundamental_coords_gpu.cpp
Device methods to calculate interferometric coorindates \(u,v,w\) and \(l,m,n\).
Functions
-
__device__ void calc_uvw(double *d_X_diff, double *d_Y_diff, double *d_Z_diff, double sdec0, double cdec0, double sha0, double cha0, int iBaseline, int num_baselines, int num_times, int num_freqs, user_precision_t *u, user_precision_t *v, user_precision_t *w)¶
Use the given baseline lengths in local
X,Y,Zcoords, and a given phase centre, calculateu,v,wcoordinates.Performs Equation 4.1 from TMS https://link.springer.com/book/10.1007/978-3-319-44431-4. This
__device__function is called bykern_calc_uvw, which calculatesu,v,wfor multiple time steps. Using the indexiBaseline,num_baselines,num_times,num_freqs, this function does a modulus to indexd_X_diff,d_Y_diff,d_Z_diffcorrectly, as the diff arrays do not change with frequency (but change with time).- Parameters:
d_X_diff – [in] Baseline length in the
Xdirection (metres)d_Y_diff – [in] Baseline length in the
Ydirection (metres)d_Z_diff – [in] Baseline length in the
Zdirection (metres)sdec0 – [in] Sine of the declination of the phase centre
cdec0 – [in] Cosine of the declination of the phase centre
sha0 – [in] Sine of the hour angle of the phase centre
cha0 – [in] Cosine of the hour angle of the phase centre
iBaseline – [in] Index passed from
kern_calc_uvwnum_baselines – [in] Number of baselines for a single time step
num_times – [in] Number of time steps
num_freqs – [in] Number of frequency steps
u – [inout] Output
ucoord (metres)v – [inout] Output
vcoord (metres)w – [inout] Output
wcoord (metres)
-
__global__ void kern_calc_uvw(double *d_X_diff, double *d_Y_diff, double *d_Z_diff, user_precision_t *d_u_metres, user_precision_t *d_v_metres, user_precision_t *d_w_metres, user_precision_t *d_u, user_precision_t *d_v, user_precision_t *d_w, user_precision_t *d_wavelengths, double sdec0, double cdec0, double *d_cha0s, double *d_sha0s, int num_cross, int num_baselines, int num_times, int num_freqs)¶
Calculate the \(u,v,w\) in metres and in wavelengths for multiple time steps and frequencies.
d_X_diff,d_Y_diff,d_Z_diffcontain baseline lengths in localX,Y,Zcoords, which can change with time (when precessed back to J2000), so should be of lengthnum_baselines*num_times. To keep indexing simple, the wavelengths ind_wavelengthsand hour angles ind_cha0s, d_sha0sshould contain values for all baselines, all frequencies, and all time steps. .When called with
dim3 grid, threads, kernel should be called withgrid.xset, where:grid.x * threads.x >=
num_visis
- Parameters:
d_X_diff – [in] Baseline lengths in the
Xdirection (metres)d_Y_diff – [in] Baseline lengths in the
Ydirection (metres)d_Z_diff – [in] Baseline lengths in the
Zdirection (metres)d_u_metres – [inout] Output
ucoords (metres)d_v_metres – [inout] Output
vcoords (metres)d_w_metres – [inout] Output
wcoords (metres)d_u – [inout] Output
ucoord (wavelengths)d_v – [inout] Output
vcoord (wavelengths)d_w – [inout] Output
wcoord (wavelengths)d_wavelengths – [in] Wavelengths for all baselines, frequencies, and time steps (metres)
sdec0 – [in] Sine of the declination of the phase centre
cdec0 – [in] Cosine of the declination of the phase centre
d_cha0s – [in] Cosine of the hour angle of the phase centre for all baselines, frequencies, and time steps
d_sha0s – [in] Sine of the hour angle of the phase centre for all baselines, frequencies, and time steps
num_cross – [in] Total number of
u,v,wcoords to be calculated (number of cross correlations)num_baselines – [in] Number of baselines for a single time step
num_times – [in] Number of time steps
num_freqs – [in] Number of frequency steps
-
void calc_uvw_gpu(double *d_X_diff, double *d_Y_diff, double *d_Z_diff, user_precision_t *d_u_metres, user_precision_t *d_v_metres, user_precision_t *d_w_metres, user_precision_t *d_us, user_precision_t *d_vs, user_precision_t *d_ws, user_precision_t *d_allsteps_wavelengths, double *d_allsteps_cha0s, double *d_allsteps_sha0s, woden_settings_t *woden_settings)¶
This is just a wrapper to launch
kern_calc_uvwto calculateu,v,wcoords on the GPU. Wrapper means we can call this function from the CPU. All arrays should be initialised and filled on the GPU before calling this function.External GPU code linked in from fundamental_coords_gpu.cpp, see fundamental_coords_gpu.h for full details.
- Parameters:
d_X_diff – [in] Baseline lengths in the
Xdirection (metres)d_Y_diff – [in] Baseline lengths in the
Ydirection (metres)d_Z_diff – [in] Baseline lengths in the
Zdirection (metres)d_u_metres – [inout] Output
ucoords (metres)d_v_metres – [inout] Output
vcoords (metres)d_w_metres – [inout] Output
wcoords (metres)d_us – [inout] Output
ucoord (wavelengths)d_vs – [inout] Output
vcoord (wavelengths)d_ws – [inout] Output
wcoord (wavelengths)d_allsteps_wavelengths – [in] Wavelengths for all baselines, frequencies, and time steps (metres)
d_allsteps_cha0s – [in] Cosine of the hour angle of the phase centre for all baselines, frequencies, and time steps
d_allsteps_sha0s – [in] Sine of the hour angle of the phase centre for all baselines, frequencies, and time steps
woden_settings – [in] Struct containing simulation settings
-
__global__ void kern_calc_uv_shapelet(double *d_X_diff, double *d_Y_diff, double *d_Z_diff, user_precision_t *d_u_shapes, user_precision_t *d_v_shapes, double *d_lsts, double *d_ras, double *d_decs, const int num_baselines, const int num_times, const int num_shapes)¶
The SHAPELET visibility envelope calculation uses a
u,vcoordinate system where the phase centre is set to the RA/Dec of that particular SHAPELET COMPONENT. This kernel calculates multiple \(u,v\) coodinates with varying phase centres to be used later bysource_components.kern_calc_visi_shapelets.The output arrays
d_u_shapes,d_v_shapes, contain coordinates for all baselines (fastest changing), all times, and all SHAPELET components (slowest changing), in units of metres.When called with
dim3 grid, threads, kernel should be called with bothgrid.xandgrid.yset, where:grid.x * threads.x >=
num_baselines*num_timesgrid.y * threads.y >=
num_shapes
- Parameters:
d_X_diff – [in] Baseline lengths in the
Xdirection (metres)d_Y_diff – [in] Baseline lengths in the
Ydirection (metres)d_Z_diff – [in] Baseline lengths in the
Zdirection (metres)d_u_shapes – [inout] Output
ucoords with various phase centres for SHAPELET components (metres)d_v_shapes – [inout] Output
vcoords with various phase centres for SHAPELET components (metres)d_lsts – [in] The local sidereal times of all time steps in simulation (radians)
d_ras – [in] Array of SHAPELET Right Ascensions (radians)
d_decs – [in] Array of SHAPELET Declinations (radians)
num_baselines – [in] Number of baselines for a single time step
num_times – [in] Number of time steps
num_shapes – [in] Number of SHAPELET COMPONENTs
-
void calc_uv_shapelet_gpu(user_precision_t *d_u_shapes, user_precision_t *d_v_shapes, int num_shapes, double *d_X_diff, double *d_Y_diff, double *d_Z_diff, double *d_ras, double *d_decs, woden_settings_t *woden_settings)¶
This is just a wrapper to launch
kern_calc_uv_shapeletto calculateu,vcoords on the GPU. Wrapper means we can call this function from the CPU.All
d_*arrays should be initialised and filled on the GPU before calling this. The function will copywoden_settings->lststo the GPU, use it, then free it. Must also havewoden_settings->num_baselines,woden_settings->num_time_stepsintialised.External GPU code linked in from fundamental_coords_gpu.cpp, see fundamental_coords_gpu.h for full details.
- Parameters:
d_u_shapes – [inout] Output
ucoords with various phase centres for SHAPELET components (wavelengths)d_v_shapes – [inout] Output
vcoords with various phase centres for SHAPELET components (wavelengths)num_shapes – [in] Number of SHAPELET COMPONENTs
d_X_diff – [in] Baseline lengths in the
Xdirection (metres)d_Y_diff – [in] Baseline lengths in the
Ydirection (metres)d_Z_diff – [in] Baseline lengths in the
Zdirection (metres)d_ras – [in] Array of SHAPELET Right Ascensions (radians)
d_decs – [in] Array of SHAPELET Declinations (radians)
woden_settings – [in] Struct containing simulation settings
-
__device__ void calc_lmn(double ra0, double sdec0, double cdec0, double ra, double dec, double *l, double *m, double *n)¶
Calculate interferometric \(l,m,n\) image coords for a given RA,Dec and phase centre.
Here it is assumed the phase centre is not changing with time
- Parameters:
ra0 – [in] Right Ascension of the phase centre (radians)
sdec0 – [in] Sine of Declination of the phase centre
cdec0 – [in] Cosine of Declination of the phase centre
ra – [in] Right Ascension (radians)
dec – [in] Declination (radians)
l – [in] Output \(l\) coodinate
m – [in] Output \(m\) coodinate
n – [in] Output \(n\) coodinate
-
__global__ void kern_calc_lmn(double ra0, double sdec0, double cdec0, double *d_ras, double *d_decs, double *d_l, double *d_m, double *d_n, int num_components)¶
Calculate interferometric \(l,m,n\) image coords for a set of RA,Dec coodinates, with a single RA/Dec phase centre.
When called with
dim3 grid, threads, kernel should be called withgrid.xset, where:grid.x * threads.x >=
num_components
- Parameters:
ra0 – [in] Right Ascension of the phase centre (radians)
sdec0 – [in] Sine of Declination of the phase centre
cdec0 – [in] Cosine of Declination of the phase centre
d_ras – [in] Array of Right Ascensions (radians)
d_decs – [in] Array of Declinations (radians)
d_l – [inout] Output \(l\) coodinates
d_m – [inout] Output \(m\) coodinates
d_n – [inout] Output \(n\) coodinates
num_components – [in] Number of RA,Dec coords
-
void calc_lmn_for_components_gpu(components_t *d_components, int num_components, woden_settings_t *woden_settings)¶
Calculates the \(l,m,n\) image coords for an intialised
d_componentsstruct. Assumes d_components->ras, d_components->decs have been allocated and set on the device.Runs
kern_calc_lmnusing d_components->ras, d_components->decs and woden_settings->ra0, woden_settings->sdec0, woden_settings->cdec0 as inputs. This function allocates device memory ford_components->ls,d_components->ms, andd_components->ns, and puts the results in these arrays.- Parameters:
d_components – [inout] Initialised
components_tstruct containing the ra and dec arraysnum_components – [in] Number of RA,Dec coords in
d_componentswoden_settings – [in] Woden settings struct containing the phase centre
-
__global__ void kern_set_auto_uvw_to_zero(int num_cross, int num_autos, user_precision_t *d_u, user_precision_t *d_v, user_precision_t *d_w)¶
Internally to WODEN C/GPU, all cross-correlations are stored first, then the autos after. All autos have zero length, so use this function to set all autos uvw to zero.
num_crossis the number of cross-correlations, so fill any uvw after this by addingiAuto = threadIdx.x + (blockDim.x*blockIdx.x), meaning you should run this kernel withgrid.xset, where:grid.x * threads.x >=
num_autos
- Parameters:
num_cross – [in] Number of cross-correlations
num_autos – [in] Number of auto-correlations
d_u – [inout] u coords
d_v – [inout] v coords
d_w – [inout] w coords
-
void set_auto_uvw_to_zero_gpu(int num_cross, int num_autos, user_precision_t *d_u, user_precision_t *d_v, user_precision_t *d_w)¶
This is just a wrapper to launch
kern_set_auto_uvw_to_zeroto set all auto-correlations to zero. Wrapper means we can call this function from the CPU.All
d_*arrays should be initialised and filled on the GPU before calling this.External GPU code linked in from fundamental_coords_gpu.cpp, see fundamental_coords_gpu.h for full details.
- Parameters:
num_cross – [in] Number of cross-correlations
num_autos – [in] Number of auto-correlations
d_u – [inout] u coords
d_v – [inout] v coords
d_w – [inout] w coords