From fb0d1e4c1aaa2a51083d15fe8375c24b1aa6d1e3 Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Tue, 16 Jun 2026 20:46:16 +0200 Subject: [PATCH] Fix basic usage pencil initialization Signed-off-by: Minh Vu --- docs/basic_usage.rst | 4 ++-- examples/cc/basic_usage/basic_usage.cu | 4 ++-- examples/cc/basic_usage/basic_usage_autotune.cu | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/basic_usage.rst b/docs/basic_usage.rst index 4f9e7c9..a8bf420 100644 --- a/docs/basic_usage.rst +++ b/docs/basic_usage.rst @@ -395,7 +395,7 @@ access pattern as the flattened array example above: int64_t l = blockIdx.x * blockDim.x + threadIdx.x; - if (l > pinfo.size) return; + if (l >= pinfo.size) return; int i = l % pinfo.shape[0]; int j = l / pinfo.shape[0] % pinfo.shape[1]; @@ -410,7 +410,7 @@ access pattern as the flattened array example above: gx[pinfo.order[1]] -= pinfo.halo_extents[pinfo.order[1]]; gx[pinfo.order[2]] -= pinfo.halo_extents[pinfo.order[2]]; - data[i] = gx[0] + gx[1] + gx[2]; + data[l] = gx[0] + gx[1] + gx[2]; } diff --git a/examples/cc/basic_usage/basic_usage.cu b/examples/cc/basic_usage/basic_usage.cu index fb11044..63249d9 100644 --- a/examples/cc/basic_usage/basic_usage.cu +++ b/examples/cc/basic_usage/basic_usage.cu @@ -70,7 +70,7 @@ __global__ void initialize_pencil(double* data, cudecompPencilInfo_t pinfo) { int64_t l = blockIdx.x * blockDim.x + threadIdx.x; - if (l > pinfo.size) return; + if (l >= pinfo.size) return; int i = l % pinfo.shape[0]; int j = l / pinfo.shape[0] % pinfo.shape[1]; @@ -85,7 +85,7 @@ __global__ void initialize_pencil(double* data, cudecompPencilInfo_t pinfo) { gx[pinfo.order[1]] -= pinfo.halo_extents[pinfo.order[1]]; gx[pinfo.order[2]] -= pinfo.halo_extents[pinfo.order[2]]; - data[i] = gx[0] + gx[1] + gx[2]; + data[l] = gx[0] + gx[1] + gx[2]; } int main(int argc, char** argv) { diff --git a/examples/cc/basic_usage/basic_usage_autotune.cu b/examples/cc/basic_usage/basic_usage_autotune.cu index eb86d29..3f76d14 100644 --- a/examples/cc/basic_usage/basic_usage_autotune.cu +++ b/examples/cc/basic_usage/basic_usage_autotune.cu @@ -70,7 +70,7 @@ __global__ void initialize_pencil(double* data, cudecompPencilInfo_t pinfo) { int64_t l = blockIdx.x * blockDim.x + threadIdx.x; - if (l > pinfo.size) return; + if (l >= pinfo.size) return; int i = l % pinfo.shape[0]; int j = l / pinfo.shape[0] % pinfo.shape[1]; @@ -85,7 +85,7 @@ __global__ void initialize_pencil(double* data, cudecompPencilInfo_t pinfo) { gx[pinfo.order[1]] -= pinfo.halo_extents[pinfo.order[1]]; gx[pinfo.order[2]] -= pinfo.halo_extents[pinfo.order[2]]; - data[i] = gx[0] + gx[1] + gx[2]; + data[l] = gx[0] + gx[1] + gx[2]; } int main(int argc, char** argv) {