Skip to content

Commit

Permalink
Debug self host test
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Oct 8, 2024
1 parent ac5e71a commit 40ead4c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/CUDA/GradientKernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ int main(void) {

auto test_device = clad::gradient(device_pullback, "out, val");
test_device.execute_kernel(dim3(1), dim3(10, 1, 1), x, y, 5, dy, d_val);
cudaDeviceSynchronize();
printf("%s\n", cudaGetErrorString(cudaGetLastError())); // CHECK-EXEC: no error
double *res = (double*)malloc(sizeof(double));
cudaMemcpy(res, d_val, sizeof(double), cudaMemcpyDeviceToHost);
printf("%0.2f\n", *res); // CHECK-EXEC: 50.00
Expand All @@ -633,6 +635,8 @@ int main(void) {

auto test_kernel_call = clad::gradient(fn);
test_kernel_call.execute(y, x, dy, dx);
cudaDeviceSynchronize();
printf("%s\n", cudaGetErrorString(cudaGetLastError())); // CHECK-EXEC: no error
cudaMemcpy(res, dx, sizeof(double), cudaMemcpyDeviceToHost);
printf("%0.2f\n", *res); // CHECK-EXEC: 50.00

Expand Down

0 comments on commit 40ead4c

Please sign in to comment.