Skip to content

Commit

Permalink
fix multithreading
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdfish committed Feb 2, 2022
1 parent 1157a1c commit db26dfb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ParameterSpacePartitions"
uuid = "64931d76-8770-46b0-8423-0a5d3a7d2d72"
authors = ["itsdfish"]
version = "0.3.8"
version = "0.3.9"

[deps]
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ A second function categorizes the predicted data into a qualitative pattern. At

```julia
function p_fun(location, hypercube::HyperCube, args...; kwargs...)
p_bounds = hypercube.p_bounds
nb = length(p_bounds)
nd = length(location)
vals = fill(-100, nd)
for j in 1:nd
for i in 1:(nb-1)
if (location[j] p_bounds[i]) && (location[j] p_bounds[i+1])
vals[j] = i
continue
end
p_bounds = hypercube.p_bounds
nb = length(p_bounds)
nd = length(location)
vals = fill(-100, nd)
for j in 1:nd
for i in 1:(nb-1)
if (location[j] p_bounds[i]) && (location[j] p_bounds[i+1])
vals[j] = i
continue
end
end
return vals
end
return vals
end
```

## Model Configuration
Expand Down
7 changes: 6 additions & 1 deletion src/sampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ Uses threading to generate patterns associated with a vector of proposals
- `options`: a set of options for configuring the algorithm
"""
function t_eval_patterns(proposals, model, p_fun, options, patterns)
function t_eval_patterns(proposals, model, p_fun, options, chains)
(;bounds) = options
return tmap((c,p) -> eval_pattern(p_fun, model, bounds, c, p), chains, proposals)
end

function t_eval_patterns(proposals, model, p_fun)
return tmap(p -> p_fun(model(p)), proposals)
end

Expand Down

0 comments on commit db26dfb

Please sign in to comment.