summaryrefslogtreecommitdiff
path: root/julia/julia.cu
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2024-12-05 19:29:56 -0800
committer3gg <3gg@shellblade.net>2024-12-05 19:29:56 -0800
commit1dedcb258f9fe4c99fa21c6edd28efe3a2bce6a7 (patch)
treeb313086d7f19d1dc3ea70b6ecf30f5af79a164db /julia/julia.cu
parentc8be8496c8a15d0ede8338939a7512109b8e5e46 (diff)
Use gridDimHEADmain
Diffstat (limited to 'julia/julia.cu')
-rw-r--r--julia/julia.cu8
1 files changed, 4 insertions, 4 deletions
diff --git a/julia/julia.cu b/julia/julia.cu
index f3ecb80..ed7b00a 100644
--- a/julia/julia.cu
+++ b/julia/julia.cu
@@ -39,7 +39,7 @@ __device__ int julia(int width, int height, int x, int y) {
39 return 1; 39 return 1;
40} 40}
41 41
42__global__ void juliaMain(int width, int height, Pixel* image) { 42__global__ void juliaMain(Pixel* image) {
43 const int x = blockIdx.x; 43 const int x = blockIdx.x;
44 const int y = blockIdx.y; 44 const int y = blockIdx.y;
45 45
@@ -47,9 +47,9 @@ __global__ void juliaMain(int width, int height, Pixel* image) {
47 constexpr Pixel juliaColour{228, 192, 135}; 47 constexpr Pixel juliaColour{228, 192, 135};
48 48
49 const Pixel pixel = 49 const Pixel pixel =
50 julia(width, height, x, y) == 1 ? juliaColour : background; 50 julia(gridDim.x, gridDim.y, x, y) == 1 ? juliaColour : background;
51 51
52 image[y * width + x] = pixel; 52 image[y * gridDim.x + x] = pixel;
53} 53}
54 54
55bool write_pbm(const Pixel* image, int width, int height, const char* path) { 55bool write_pbm(const Pixel* image, int width, int height, const char* path) {
@@ -85,7 +85,7 @@ int main(int argc, const char** argv) {
85 goto cleanup; 85 goto cleanup;
86 } 86 }
87 87
88 juliaMain<<<dim, 1>>>(width, height, image_dev); 88 juliaMain<<<dim, 1>>>(image_dev);
89 89
90 if (cudaMemcpy( 90 if (cudaMemcpy(
91 image_host, image_dev, image_size_bytes, cudaMemcpyDeviceToHost) != 91 image_host, image_dev, image_size_bytes, cudaMemcpyDeviceToHost) !=