Skip to content

Commit

Permalink
Fix missed renames to Trajectory.
Browse files Browse the repository at this point in the history
  • Loading branch information
DinoBektesevic committed Sep 25, 2023
1 parent e7c0ad5 commit aacd59a
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/kbmod/search/kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ __device__ float ReadEncodedPixel(void *image_vect, int index, int n_bytes, cons
*/
__global__ void searchFilterImages(int num_images, int width, int height, void *psi_vect, void *phi_vect,
PerImageData image_data, SearchParameters params, int num_trajectories,
trajectory *trajectories, trajectory *results) {
Trajectory *trajectories, Trajectory *results) {
// Get the x and y coordinates within the search space.
const int x_i = blockIdx.x * THREAD_DIM_X + threadIdx.x;
const int y_i = blockIdx.y * THREAD_DIM_Y + threadIdx.y;
Expand All @@ -114,7 +114,7 @@ __global__ void searchFilterImages(int num_images, int width, int height, void *
// Create an initial set of best results with likelihood -1.0.
// We also set (x, y) because they are used in the later python
// functions.
trajectory best[RESULTS_PER_PIXEL];
Trajectory best[RESULTS_PER_PIXEL];
for (int r = 0; r < RESULTS_PER_PIXEL; ++r) {
best[r].x = x;
best[r].y = y;
Expand All @@ -124,7 +124,7 @@ __global__ void searchFilterImages(int num_images, int width, int height, void *
// For each trajectory we'd like to search
for (int t = 0; t < num_trajectories; ++t) {
// Create a trajectory for this search.
trajectory curr_trj;
Trajectory curr_trj;
curr_trj.x = x;
curr_trj.y = y;
curr_trj.vx = trajectories[t].vx;
Expand Down Expand Up @@ -221,7 +221,7 @@ __global__ void searchFilterImages(int num_images, int width, int height, void *

// Insert the new trajectory into the sorted list of results.
// Only sort the values with valid likelihoods.
trajectory temp;
Trajectory temp;
for (int r = 0; r < RESULTS_PER_PIXEL; ++r) {
if (curr_trj.lh > best[r].lh && curr_trj.lh > -1.0) {
temp = best[r];
Expand Down Expand Up @@ -293,13 +293,13 @@ void *encodeImageFloat(float *image_vect, unsigned int vectLength, bool debug) {

extern "C" void deviceSearchFilter(int num_images, int width, int height, float *psi_vect, float *phi_vect,
PerImageData img_data, SearchParameters params, int num_trajectories,
trajectory *trj_to_search, int num_results, trajectory *best_results) {
Trajectory *trj_to_search, int num_results, Trajectory *best_results) {
// Allocate Device memory
trajectory *device_tests;
Trajectory *device_tests;
float *device_img_times;
void *device_psi;
void *device_phi;
trajectory *device_search_results;
Trajectory *device_search_results;
BaryCorrection *device_bary_corrs = nullptr;
scaleParameters *device_psi_params = nullptr;
scaleParameters *device_phi_params = nullptr;
Expand All @@ -310,22 +310,22 @@ extern "C" void deviceSearchFilter(int num_images, int width, int height, float
}

if (params.debug) {
printf("Allocating %lu bytes for testing grid.\n", sizeof(trajectory) * num_trajectories);
printf("Allocating %lu bytes for testing grid.\n", sizeof(Trajectory) * num_trajectories);
}
checkCudaErrors(cudaMalloc((void **)&device_tests, sizeof(trajectory) * num_trajectories));
checkCudaErrors(cudaMalloc((void **)&device_tests, sizeof(Trajectory) * num_trajectories));

if (params.debug) {
printf("Allocating %lu bytes for time data.\n", sizeof(float) * num_images);
}
checkCudaErrors(cudaMalloc((void **)&device_img_times, sizeof(float) * num_images));

if (params.debug) {
printf("Allocating %lu bytes for testing grid.\n", sizeof(trajectory) * num_trajectories);
printf("Allocating %lu bytes for testing grid.\n", sizeof(Trajectory) * num_trajectories);
}
checkCudaErrors(cudaMalloc((void **)&device_search_results, sizeof(trajectory) * num_results));
checkCudaErrors(cudaMalloc((void **)&device_search_results, sizeof(Trajectory) * num_results));

// Copy trajectories to search
checkCudaErrors(cudaMemcpy(device_tests, trj_to_search, sizeof(trajectory) * num_trajectories,
checkCudaErrors(cudaMemcpy(device_tests, trj_to_search, sizeof(Trajectory) * num_trajectories,
cudaMemcpyHostToDevice));

// Copy image times
Expand Down Expand Up @@ -397,7 +397,7 @@ extern "C" void deviceSearchFilter(int num_images, int width, int height, float
device_search_results);

// Read back results
checkCudaErrors(cudaMemcpy(best_results, device_search_results, sizeof(trajectory) * num_results,
checkCudaErrors(cudaMemcpy(best_results, device_search_results, sizeof(Trajectory) * num_results,
cudaMemcpyDeviceToHost));

// Free the on GPU memory.
Expand All @@ -412,12 +412,12 @@ extern "C" void deviceSearchFilter(int num_images, int width, int height, float
}

__global__ void deviceGetCoaddStamp(int num_images, int width, int height, float *image_vect,
PerImageData image_data, int num_trajectories, trajectory *trajectories,
PerImageData image_data, int num_trajectories, Trajectory *trajectories,
StampParameters params, int *use_index_vect, float *results) {
// Get the trajectory that we are going to be using.
const int trj_index = blockIdx.x * blockDim.x + threadIdx.x;
if (trj_index < 0 || trj_index >= num_trajectories) return;
trajectory trj = trajectories[trj_index];
Trajectory trj = trajectories[trj_index];

// Get the pixel coordinates within the stamp to use.
const int stamp_width = 2 * params.radius + 1;
Expand Down Expand Up @@ -513,10 +513,10 @@ __global__ void deviceGetCoaddStamp(int num_images, int width, int height, float
}

void deviceGetCoadds(ImageStack &stack, PerImageData image_data, int num_trajectories,
trajectory *trajectories, StampParameters params,
Trajectory *trajectories, StampParameters params,
std::vector<std::vector<bool>> &use_index_vect, float *results) {
// Allocate Device memory
trajectory *device_trjs;
Trajectory *device_trjs;
int *device_use_index = nullptr;
float *device_times;
float *device_img;
Expand All @@ -533,8 +533,8 @@ void deviceGetCoadds(ImageStack &stack, PerImageData image_data, int num_traject
const unsigned int num_stamp_pixels = num_trajectories * stamp_ppi;

// Allocate and copy the trajectories.
checkCudaErrors(cudaMalloc((void **)&device_trjs, sizeof(trajectory) * num_trajectories));
checkCudaErrors(cudaMemcpy(device_trjs, trajectories, sizeof(trajectory) * num_trajectories,
checkCudaErrors(cudaMalloc((void **)&device_trjs, sizeof(Trajectory) * num_trajectories));
checkCudaErrors(cudaMemcpy(device_trjs, trajectories, sizeof(Trajectory) * num_trajectories,
cudaMemcpyHostToDevice));

// Check if we need to create a vector of per-trajectory, per-image use.
Expand Down

0 comments on commit aacd59a

Please sign in to comment.