# ParallelStencil.jl cannot initialize with parameterized backend

**URL:** https://discourse.julialang.org/t/parallelstencil-jl-cannot-initialize-with-parameterized-backend/102536
**Category:** General Usage
**Tags:** parallel
**Created:** [August 6, 2023, 5:01pm UTC](https://discourse.julialang.org/t/parallelstencil-jl-cannot-initialize-with-parameterized-backend/102536 "2023-08-06T17:01:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jinfreedom](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jinfreedom](https://discourse.julialang.org/u/jinfreedom)
#### Post date: [August 6, 2023, 5:01pm UTC](https://discourse.julialang.org/t/parallelstencil-jl-cannot-initialize-with-parameterized-backend/102536/1 "2023-08-06T17:01:25Z")

</div>

Hi, I’m trying to use `parallelstencil.jl` with Threads or CUDA and ran into the following error:

```julia
julia> using ParallelStencil

julia> using CUDA

julia> pscheme=CUDA
CUDA

julia> @init_parallel_stencil(pscheme, Float64, 2)
ERROR: ArgumentError: package has to be functional and one of the following: Threads, CUDA, AMDGPU (obtained: pscheme).

```

It looks like the initialization macro only takes literally `Threads` or `CUDA` as inputs. Moreover, this error is even more intriguing:

```julia
julia> if false
       @init_parallel_stencil(pscheme, Float64, 2)
       end
ERROR: ArgumentError: package has to be functional and one of the following: Threads, CUDA, AMDGPU (obtained: pscheme).

```

It looks like the macro has to run even the condition is not met? It looks like I don’t seem to know how macro works. If I do it straightforwardly, there is no complaint:

```julia
julia> @init_parallel_stencil(CUDA, Float64, 2)

julia> 

```

So how should I initialize conditionally and / or parametrically? I’m using Julia 1.9.2
