Skip to content

Commit

Permalink
change the type of u to prevent illegal memory access
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Morlock committed Sep 26, 2024
1 parent b33b809 commit 834f2e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions implicit/gpu/als.cu
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ least_squares_cg_kernel(int factors, size_t user_count, size_t item_count, T *X,

// Stride over users in the grid:
// https://devblogs.nvidia.com/parallelforall/cuda-pro-tip-write-flexible-kernels-grid-stride-loops/
for (int u = blockIdx.x; u < user_count; u += gridDim.x) {
for (size_t u = blockIdx.x; u < user_count; u += gridDim.x) {
T *x = &X[u * factors];

float x_value = convert<T, float>(x[threadIdx.x]);
Expand Down Expand Up @@ -102,7 +102,7 @@ least_squares_cg_kernel(int factors, size_t user_count, size_t item_count, T *X,
// complain and don't let it perpetuate
if (isnan(rsold)) {
if (threadIdx.x == 0) {
printf("Warning NaN Detected in row %i of %lu\n", u, user_count);
printf("Warning NaN Detected in row %zu of %lu\n", u, user_count);
}
x_value = 0;
}
Expand Down

0 comments on commit 834f2e3

Please sign in to comment.