Loading Makefile +2 −0 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,8 @@ OPT += -DWRITE_IMAGE #OPT += -DPARALLELIO #OPT += -DPARALLELIO # Normalize uvw in case it is not done in the binMS # Normalize uvw in case it is not done in the binMS OPT += -DNORMALIZE_UVW OPT += -DNORMALIZE_UVW # Gridding kernel: GAUSS, GAUSS_HI_PRECISION OPT += -DGAUSS_HI_PRECISION ifeq (FITSIO,$(findstring FITSIO,$(OPT))) ifeq (FITSIO,$(findstring FITSIO,$(OPT))) LIBS += -L$(FITSIO_LIB) -lcfitsio LIBS += -L$(FITSIO_LIB) -lcfitsio Loading w-stacking.cu +12 −7 Original line number Original line Diff line number Diff line Loading @@ -24,11 +24,12 @@ gauss_kernel_norm(double norm, double std22, double u_dist, double v_dist) void makeGaussKernel(double * kernel, void makeGaussKernel(double * kernel, int KernelLen, int KernelLen, int increaseprecision, double std22) double std22) { { double norm = std22/PI; double norm = std22/PI; int n = KernelLen, mid = n / 2; int n = increaseprecision*KernelLen, mid = n / 2; for (int i = 0; i != mid + 1; i++) { for (int i = 0; i != mid + 1; i++) { double term = (double)i / mid; double term = (double)i / mid; kernel[mid + i] = sqrt(norm) * exp(-(term*term)*std22); kernel[mid + i] = sqrt(norm) * exp(-(term*term)*std22); Loading Loading @@ -201,11 +202,12 @@ void wstack( // initialize the convolution kernel // initialize the convolution kernel // gaussian: // gaussian: int KernelLen = (w_support-1)/2; int KernelLen = (w_support-1)/2; int increaseprecision = 21; // this number must be odd: increaseprecison*w_support must be odd (w_support must be odd) double std = 1.0; double std = 1.0; double std22 = 1.0/(2.0*std*std); double std22 = 1.0/(2.0*std*std); double norm = std22/PI; double norm = std22/PI; double * convkernel = malloc(w_support*sizeof(*convkernel)); double * convkernel = malloc(increaseprecision*w_support*sizeof(*convkernel)); makeGaussKernel(convkernel,w_support,std22); makeGaussKernel(convkernel,w_support,increaseprecision,std22); // Loop over visibilities. // Loop over visibilities. // Switch between CUDA and GPU versions // Switch between CUDA and GPU versions Loading Loading @@ -327,14 +329,17 @@ void wstack( for (j = jmin; j <= jmax; j++) for (j = jmin; j <= jmax; j++) { { int jKer = (int)j-pos_u+KernelLen; int kKer = (int)k-pos_v+KernelLen; double u_dist = (double)j+0.5 - pos_u; double u_dist = (double)j+0.5 - pos_u; long iKer = 2 * (j + k*grid_size_x + grid_w*grid_size_x*grid_size_y); long iKer = 2 * (j + k*grid_size_x + grid_w*grid_size_x*grid_size_y); int jKer = (int)(increaseprecision*u_dist) + KernelLen; int kKer = (int)(increaseprecision*v_dist) + KernelLen; #ifdef GAUSS_HI_PRECISION //double conv_weight = gauss_kernel_norm(norm,std22,u_dist,v_dist); double conv_weight = gauss_kernel_norm(norm,std22,u_dist,v_dist); #endif #ifdef GAUSS double conv_weight = convkernel[jKer]*convkernel[kKer]; double conv_weight = convkernel[jKer]*convkernel[kKer]; #endif // Loops over frequencies and polarizations // Loops over frequencies and polarizations double add_term_real = 0.0; double add_term_real = 0.0; double add_term_img = 0.0; double add_term_img = 0.0; Loading Loading
Makefile +2 −0 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,8 @@ OPT += -DWRITE_IMAGE #OPT += -DPARALLELIO #OPT += -DPARALLELIO # Normalize uvw in case it is not done in the binMS # Normalize uvw in case it is not done in the binMS OPT += -DNORMALIZE_UVW OPT += -DNORMALIZE_UVW # Gridding kernel: GAUSS, GAUSS_HI_PRECISION OPT += -DGAUSS_HI_PRECISION ifeq (FITSIO,$(findstring FITSIO,$(OPT))) ifeq (FITSIO,$(findstring FITSIO,$(OPT))) LIBS += -L$(FITSIO_LIB) -lcfitsio LIBS += -L$(FITSIO_LIB) -lcfitsio Loading
w-stacking.cu +12 −7 Original line number Original line Diff line number Diff line Loading @@ -24,11 +24,12 @@ gauss_kernel_norm(double norm, double std22, double u_dist, double v_dist) void makeGaussKernel(double * kernel, void makeGaussKernel(double * kernel, int KernelLen, int KernelLen, int increaseprecision, double std22) double std22) { { double norm = std22/PI; double norm = std22/PI; int n = KernelLen, mid = n / 2; int n = increaseprecision*KernelLen, mid = n / 2; for (int i = 0; i != mid + 1; i++) { for (int i = 0; i != mid + 1; i++) { double term = (double)i / mid; double term = (double)i / mid; kernel[mid + i] = sqrt(norm) * exp(-(term*term)*std22); kernel[mid + i] = sqrt(norm) * exp(-(term*term)*std22); Loading Loading @@ -201,11 +202,12 @@ void wstack( // initialize the convolution kernel // initialize the convolution kernel // gaussian: // gaussian: int KernelLen = (w_support-1)/2; int KernelLen = (w_support-1)/2; int increaseprecision = 21; // this number must be odd: increaseprecison*w_support must be odd (w_support must be odd) double std = 1.0; double std = 1.0; double std22 = 1.0/(2.0*std*std); double std22 = 1.0/(2.0*std*std); double norm = std22/PI; double norm = std22/PI; double * convkernel = malloc(w_support*sizeof(*convkernel)); double * convkernel = malloc(increaseprecision*w_support*sizeof(*convkernel)); makeGaussKernel(convkernel,w_support,std22); makeGaussKernel(convkernel,w_support,increaseprecision,std22); // Loop over visibilities. // Loop over visibilities. // Switch between CUDA and GPU versions // Switch between CUDA and GPU versions Loading Loading @@ -327,14 +329,17 @@ void wstack( for (j = jmin; j <= jmax; j++) for (j = jmin; j <= jmax; j++) { { int jKer = (int)j-pos_u+KernelLen; int kKer = (int)k-pos_v+KernelLen; double u_dist = (double)j+0.5 - pos_u; double u_dist = (double)j+0.5 - pos_u; long iKer = 2 * (j + k*grid_size_x + grid_w*grid_size_x*grid_size_y); long iKer = 2 * (j + k*grid_size_x + grid_w*grid_size_x*grid_size_y); int jKer = (int)(increaseprecision*u_dist) + KernelLen; int kKer = (int)(increaseprecision*v_dist) + KernelLen; #ifdef GAUSS_HI_PRECISION //double conv_weight = gauss_kernel_norm(norm,std22,u_dist,v_dist); double conv_weight = gauss_kernel_norm(norm,std22,u_dist,v_dist); #endif #ifdef GAUSS double conv_weight = convkernel[jKer]*convkernel[kKer]; double conv_weight = convkernel[jKer]*convkernel[kKer]; #endif // Loops over frequencies and polarizations // Loops over frequencies and polarizations double add_term_real = 0.0; double add_term_real = 0.0; double add_term_img = 0.0; double add_term_img = 0.0; Loading