# Can't launch 3d grid?

**URL:** <https://forums.developer.nvidia.com/t/cant-launch-3d-grid/53072>\
**Category:** CUDA Programming and Performance\
**Created:** [September 1, 2017, 8:18am UTC](https://forums.developer.nvidia.com/t/cant-launch-3d-grid/53072 "2017-09-01T08:18:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![penguinnn](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@penguinnn](https://forums.developer.nvidia.com/u/penguinnn)\
**Post date:** [September 1, 2017, 8:18am UTC](https://forums.developer.nvidia.com/t/cant-launch-3d-grid/53072/1 "2017-09-01T08:18:24Z")

</div>

I use CUDA8.0 and VS2015, with GTX980.

I tried to launch a kernel using 3D grid and 1D block.

```auto
dim3 radiance_gird = (4, 4, 4);
dim3 radiance_block = (FirePresets::TOTAL_SAMPLES); // 5
radianceKernel << <radiance_gird, radiance_block >> > (dev_le, dev_l, dev_le_mean, dev_T, dev_xm, dev_ym, dev_zm);

```

In NVIDIA NSight CUDA Focus it says my valid grid dimension is (4,0,0). Why?

---

<div class="post-metadata">

**Author:** ![njuffa](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@njuffa](https://forums.developer.nvidia.com/u/njuffa)\
**Post date:** [September 1, 2017, 9:19am UTC](https://forums.developer.nvidia.com/t/cant-launch-3d-grid/53072/2 "2017-09-01T09:19:17Z")

</div>

Buildable code or it didn’t happen :-) Now would be a good time to familiarize yourself with the concept of an MCVE (see: [url][https://stackoverflow.com/help/mcve[/url]](https://stackoverflow.com/help/mcve%5B/url%5D)).

Does the actual code (with proper error checking!) compile and run outside of Nsight? Are you compiling for the correct target architecture (-arch=sm\_52)? What is the exact error message returned by Nsight?

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [September 1, 2017, 1:41pm UTC](https://forums.developer.nvidia.com/t/cant-launch-3d-grid/53072/3 "2017-09-01T13:41:46Z")

</div>

According to what I believe your intent to be, this will not accomplish what you want.

```auto
dim3 radiance_gird = (4, 4, 4);

```

According to what I believe your intent to be, it should be either:

```auto
dim3 radiance_gird = dim3(4, 4, 4);

```

or:

```auto
dim3 radiance_gird(4, 4, 4);

```

You can look up what the C or C++ rules are for evaluation of this construct:

(4,4,4)

The net is that the comma operator and parenthesis reduce it to:

4

And you can certainly initialize a dim3 item with a scalar quantity of 4, in which case it will result in:

(4,1,1)

cross posting:

[https://stackoverflow.com/questions/45995990/cuda-cant-launch-3d-grid](https://stackoverflow.com/questions/45995990/cuda-cant-launch-3d-grid)

demonstrating that the grid in question is reported as (4,1,1) (which is valid) not (4,0,0) which OP stated in original post of this thread (which is not a valid grid dimension)

---

<div class="post-metadata">

**Author:** ![njuffa](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@njuffa](https://forums.developer.nvidia.com/u/njuffa)\
**Post date:** [September 1, 2017, 4:38pm UTC](https://forums.developer.nvidia.com/t/cant-launch-3d-grid/53072/4 "2017-09-01T16:38:13Z")

</div>

I would not use the word “invalid” to describe the initialization. It has well-defined semantics, which were explained in detail by txbob. So the initialization is valid, but not what the programmer intended.

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [September 1, 2017, 4:41pm UTC](https://forums.developer.nvidia.com/t/cant-launch-3d-grid/53072/5 "2017-09-01T16:41:58Z")

</div>

The intent is clear (in my opinion). For that implied intent, the method chosen is invalid. Wordsmithing applied.
