# Dynamically adjust size of cuda.local.array without environment variables

**URL:** <https://numba.discourse.group/t/dynamically-adjust-size-of-cuda-local-array-without-environment-variables/967>\
**Category:** Support: How do I do ...?\
**Created:** [October 18, 2021, 9:14am UTC](https://numba.discourse.group/t/dynamically-adjust-size-of-cuda-local-array-without-environment-variables/967 "2021-10-18T09:14:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![gmarkall](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/gmarkall/32/42_2.png) [@gmarkall](https://numba.discourse.group/u/gmarkall)\
**Post date:** [October 18, 2021, 9:41am UTC](https://numba.discourse.group/t/dynamically-adjust-size-of-cuda-local-array-without-environment-variables/967/2 "2021-10-18T09:41:25Z")

</div>

Are you looking for something that varies the size of a local array in a kernel? e.g.:

```python
from numba import cuda, types

def gen_kernel(local_size):
    @cuda.jit
    def f():
        x = cuda.local.array(local_size, types.int32)
        print("Length of local array is", len(x))

    return f

# Generate kernels with different sized local arrays and launch them with a
# single thread
gen_kernel(2)[1, 1]()
gen_kernel(3)[1, 1]()

# Synchronize to make sure we don't exit before the output can be printed
cuda.synchronize()

```

which outputs:

```nohighlight
Length of local array is 2
Length of local array is 3

```

---

_[View the full topic](https://numba.discourse.group/t/dynamically-adjust-size-of-cuda-local-array-without-environment-variables/967)._
