Skip to content

Error with MCMCThreads() #1810

@mcreel

Description

@mcreel

The following code runs fine with Turing v0.20.4, but errors with v0.21.1. The only package installed in the project is Turing

using Turing, LinearAlgebra


lb = [0.0, 0.0, 0.0, 0.0]
ub = [3.0, 3.0, 1.0, 3.0] 
m = [1.0, 1.0, 0.2, 1.8] 

k = size(m,1)
V = 1.0* Matrix(I, k, k)

macro Prior()
    return :( arraydist([Uniform(lb[i], ub[i]) for i = 1:size(lb,1)]) )
end

@model function MSM(m)
    θ ~ @Prior
    m ~ MvNormal(θ, V)
end

length = 1000
nchains = 4
# This does not work
chain = sample(MSM(m), NUTS(), MCMCThreads(), length, nchains; init_params=m)

## single thread, this works
chain = sample(MSM(m), NUTS(), length; init_params=m)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions