# Confusing dispatch problem

**URL:** <https://discourse.julialang.org/t/confusing-dispatch-problem/93760>\
**Category:** General Usage\
**Created:** [January 30, 2023, 10:15am UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760 "2023-01-30T10:15:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Euhan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/euhan/32/36548_2.png) [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Post date:** [January 30, 2023, 10:15am UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/1 "2023-01-30T10:15:17Z")

</div>

I get an unexpected `MethodError` when running a piece of code. The relevant bit of the error output is:

```julia
ERROR: LoadError: MethodError: no method matching make_my_model(::Int64, ::Int64, ::Int64; no_inchannels=3)
Closest candidates are:
  make_my_model(::Any...; no_inchannels, kwargs...) at ~/3Dto2D/v2/models/model_channel_toggle.jl:40

```

What I find strange about this is that the method identified as the “closest candidate” has a signature that should be able to accommodate any invocation I can think of. This is the line in question:

```julia
function make_my_model(args...; no_inchannels = 2, kwargs...)

```

I had imagined that any positional parameters would end up in `args`, that either the keyword argument no\_inchannels would be set when calling (which it was in this case) or it would default to 2 and any other keyword parameters would end up is kwargs.

Why wouldn’t it be compatible with the call `make_my_model(1, 4, 7; no_inchannels = 3)`?

No world age issues are mentioned in the error messages either. I run julia 1.8.5 on linux.

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [January 30, 2023, 10:33am UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/2 "2023-01-30T10:33:39Z")

</div>

It should work, and I cannot reproduce on 1.8.5:

```julia
julia> function make_my_model(args...; no_inchannels = 2, kwargs...)
         @show args, kwargs
       end
make_my_model (generic function with 1 method)

julia> make_my_model(1,2,3; no_inchannels=3)
(args, kwargs) = ((1, 2, 3), Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())
((1, 2, 3), Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())

```

What does `methods(make_my_model)` say?

---

<div class="post-metadata">

**Author:** ![Euhan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/euhan/32/36548_2.png) [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Post date:** [January 30, 2023, 11:46am UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/3 "2023-01-30T11:46:53Z")

</div>

```julia
# 1 method for generic function "make_my_model":
[1] make_my_model(args...; no_inchannels, kwargs...) in Main at /home/johjo50/3Dto2D/v2/models/model_channel_toggle.jl:40

```

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [January 30, 2023, 3:24pm UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/4 "2023-01-30T15:24:34Z")

</div>

Hmm, no idea honestly. Does the error persist in a fresh session?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [January 30, 2023, 3:50pm UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/5 "2023-01-30T15:50:41Z")

</div>

Could you reproduce this for us with a fully self-contained minimum working example? Here is one way to produce to cryptic `MethodError`:

```julia
julia> function make_my_model(args...; no_inchannels = 2, kwargs...)
         @show args kwargs
         throw(MethodError(make_my_model, args))
       end
make_my_model (generic function with 1 method)

julia> make_my_model(1,2,3; no_inchannels=3)
args = (1, 2, 3)
kwargs = Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}()
ERROR: MethodError: no method matching make_my_model(::Int64, ::Int64, ::Int64)
Closest candidates are:
  make_my_model(::Any...; no_inchannels, kwargs...) at REPL[28]:1
Stacktrace:
 [1] make_my_model(::Int64, ::Vararg{Int64}; no_inchannels::Int64, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Main ./REPL[28]:3
 [2] top-level scope
   @ REPL[29]:1

```

---

<div class="post-metadata">

**Author:** ![Euhan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/euhan/32/36548_2.png) [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Post date:** [January 30, 2023, 4:45pm UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/6 "2023-01-30T16:45:58Z")

</div>

I only run it from command line as `<SOME ENVIRONMENT VARIABLE DEFINITIONS> julia <some options> code.jl <lots of arguments> > save.the.stdout 2> save.the.stderr`. I’m checking that it still behaves the same.

I reran it twice with some variations and it looks exactly the same. I still haven’t found any good way of running a debugger\* on the code so I progress slowly. I’ll start with putting in some more diagnostic output, I guess.

\* You can load `Debugger.jl` in REPL, set `ARGS`, set one or more breakpoints in files that will be running and finally do `@enter include("code.jl")`. You can do that, but it doesn’t work because all of your code will run in some “inner evaluation”, not subject to breakpoints and stepping. What you could debug this way, however, is the REPL itself. Unfortunately, I have nothing that I know needs fixing there and if I did I wouldn’t be qualified to do it.

---

<div class="post-metadata">

**Author:** ![Euhan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/euhan/32/36548_2.png) [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Post date:** [February 1, 2023, 12:46pm UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/7 "2023-02-01T12:46:00Z")

</div>

**Update** (but no epiphanies, so don’t get your hopes up):

I added some diagnostic output immediately before the call to `make_my_model` and some at the top of the function body. When I run the code again, this snippet (also including the output from `methods` that @skleinbo asked for) is generated in the output:

```julia
# 1 method for generic function "make_my_model":
[1] make_my_model(args...; no_inchannels, kwargs...) in Main at /home/johjo50/3Dto2D/v2/models/model_channel_toggle.jl:40
Before the call make_my_model(arguments...; no_inchannels = channels)
arguments = [5, 7, 8, 9]
channels = 3
Inside make_my_model(args...; no_inchannels = 2, kwargs...)
args = (5, 7, 8, 9)
no_inchannels = 3
kwargs = Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}()

```

As far as I can see every important aspect is the same (I note that I use some different numbers, but I can’t see why that should matter). All the diagnostic messages look like I expected them, more or less. No other changes made to the code.

Yet, now it manages to find a method: the method that has been there all the time! Is there some explanation to what is happening? Is there a lesson to be learned?

Now that I can progress beyond this I get a load (see below) of output in my `stderr` because of what I assume is a totally unrelated problem. Is this a fair assumption?

```julia
┌ Error: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 85 message(s)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: ptr.isSupported()
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: engine_post_checks(handle, *ebuf.get(), engine.getPerfKnobs(), req_size)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: finalize_internal()
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:35.819594 (0d+0h+2m+0s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Warning: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 29 message(s)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Time: 2023-02-01T11:36:39.049080 (0d+0h+2m+4s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:138
┌ Warning: CuDNN (v8302) function cudnnBatchNormalizationForwardTraining() called:
│ Info: Traceback contains 1 message(s)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: !canRunSemiPersist
│ Time: 2023-02-01T11:36:45.400175 (0d+0h+2m+10s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:138
┌ Error: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 85 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.612761 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Error: CuDNN (v8302) function cudnnConvolutionForward() called:
│ Info: Traceback contains 3 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.613024 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Warning: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 65 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Time: 2023-02-01T11:36:52.643631 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:138
┌ Error: CuDNN (v8302) function cudnnConvolutionForward() called:
│ Info: Traceback contains 3 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.643796 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Warning: CuDNN (v8302) function cudnnBatchNormalizationForwardTraining() called:
│ Info: Traceback contains 1 message(s)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: !canRunSemiPersist
│ Time: 2023-02-01T11:36:52.643947 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:138
┌ Error: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 94 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.689861 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Error: CuDNN (v8302) function cudnnConvolutionForward() called:
│ Info: Traceback contains 3 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.690034 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Warning: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 74 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Time: 2023-02-01T11:36:52.703894 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:138
┌ Error: CuDNN (v8302) function cudnnConvolutionForward() called:
│ Info: Traceback contains 3 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.704060 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Warning: CuDNN (v8302) function cudnnBatchNormalizationForwardTraining() called:
│ Info: Traceback contains 1 message(s)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: !canRunSemiPersist
│ Time: 2023-02-01T11:36:52.704167 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:138
┌ Error: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 94 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.731834 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Error: CuDNN (v8302) function cudnnConvolutionForward() called:
│ Info: Traceback contains 3 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.732003 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Warning: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 74 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Time: 2023-02-01T11:36:52.748695 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:138
┌ Error: CuDNN (v8302) function cudnnConvolutionForward() called:
│ Info: Traceback contains 3 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.748856 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Warning: CuDNN (v8302) function cudnnBatchNormalizationForwardTraining() called:
│ Info: Traceback contains 1 message(s)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: !canRunSemiPersist
│ Time: 2023-02-01T11:36:52.748991 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:138
┌ Error: CuDNN (v8302) function cudnnGetConvolutionForwardAlgorithmMaxCount() called:
│ Info: Traceback contains 94 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: false == cudnn::cnn::isForwardSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Warning: CUDNN_STATUS_NOT_SUPPORTED; Reason: T_ENGINEMAP::isLegacyAlgoSupported(handle, xDesc, wDesc, cDesc, yDesc, algo)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.758726 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
┌ Error: CuDNN (v8302) function cudnnConvolutionForward() called:
│ Info: Traceback contains 3 message(s)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: dimA[i] <= 0
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: cudnn::ops::setTensorNdDescriptor(desc, dtype, nbDims, dimA, strideA, true)
│ Error: CUDNN_STATUS_BAD_PARAM; Reason: initStatus = getXDescriptor(conv, &xDescCompat)
│ Time: 2023-02-01T11:36:52.758896 (0d+0h+2m+17s since start)
│ Process=50017; Thread=50017; GPU=NULL; Handle=NULL; StreamId=NULL.
└ @ CUDA.CUDNN ~/.julia/packages/CUDA/Ey3w2/lib/cudnn/CUDNN.jl:140
⋮ 

```

It goes on for another 30 000 lines, but even the output above have been heavily edited to keep up the dramatic tension of the narrative.

I suppose I should enquire about this in some GPU-forum, but should anyone know what this is about, please tell me.

---

<div class="post-metadata">

**Author:** ![Euhan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/euhan/32/36548_2.png) [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Post date:** [February 3, 2023, 4:43pm UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/8 "2023-02-03T16:43:45Z")

</div>

The error messages in my last post seem to be connected to running `julia` with `-g 2`.

I am now back to the error cited before. I have also tried to remove the keyword argument from the argument list. The results are very similar. See below:

```julia
# 1 method for generic function "make_my_model":
[1] make_my_model(args...; kwargs...) in Main at /home/johjo50/3Dto2D/v2/models/model_channel_toggle.jl:41
Before the call make_my_model(arguments...; no_inchannels = channels)
arguments = [1, 4, 7]
channels = 3
ERROR: LoadError: MethodError: no method matching make_my_model(::Int64, ::Int64, ::Int64; no_inchannels=3)
Closest candidates are:
  make_my_model(::Any...; kwargs...) at ~/3Dto2D/v2/models/model_channel_toggle.jl:41

```

Had this worked I would just extract `no_inchannels` from `kwargs`. As I understand it these two solutions would be equivalent.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [February 4, 2023, 7:10am UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/9 "2023-02-04T07:10:13Z")

</div>

I am perplexed by the continuing lack of a minimum working example here.

What is the shortest code.jl and command line invocation that produces this error?

Just make a copy of your code.jl and start deleting lines. As you delete lines, check to see if the problem still exists. Once you have achieved the bare minimum number of lines that produce the problem, give us the contents of code.jl and how to invoke the script.

---

<div class="post-metadata">

**Author:** ![Euhan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/euhan/32/36548_2.png) [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Post date:** [February 6, 2023, 6:01pm UTC](https://discourse.julialang.org/t/confusing-dispatch-problem/93760/10 "2023-02-06T18:01:37Z")

</div>

Don’t be offended. I am incredibly stressed in my work at the moment and can’t even do the minimal example. I hope I am permitted to ask questions anyway. When I have the time I don’t mind spending it on this sort of thing. I even answer other people’s questions, without any thought of “what’s in it for me”. Now, however is the time to finish some articles in a hurry, or the rest won’t matter much.
