Skip to content

Commit

Permalink
Restrict single-threading to single sequence (#122)
Browse files Browse the repository at this point in the history
* Restrict single-threading to single sequence

* Typo
  • Loading branch information
gdalle authored Nov 15, 2024
1 parent 67343ac commit e9f5de4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libs/HMMTest/src/allocations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function test_allocations(
hmm_guess::Union{Nothing,AbstractHMM}=nothing,
)
# making seq_ends a tuple disables multithreading
seq_ends = ntuple(k -> seq_ends[k], Val(min(2, length(seq_ends))))
seq_ends = ntuple(k -> seq_ends[k], Val(min(1, length(seq_ends))))
control_seq = control_seq[1:last(seq_ends)]

@testset "Allocations" begin
Expand Down
2 changes: 1 addition & 1 deletion src/inference/forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function forward!(
control_seq::AbstractVector;
seq_ends::AbstractVectorOrNTuple{Int},
)
if seq_ends isa NTuple
if seq_ends isa NTuple{1}
for k in eachindex(seq_ends)
_forward!(storage, hmm, obs_seq, control_seq, seq_ends, k)
end
Expand Down
2 changes: 1 addition & 1 deletion src/inference/forward_backward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function forward_backward!(
seq_ends::AbstractVectorOrNTuple{Int},
transition_marginals::Bool=true,
)
if seq_ends isa NTuple
if seq_ends isa NTuple{1}
for k in eachindex(seq_ends)
_forward_backward!(
storage, hmm, obs_seq, control_seq, seq_ends, k; transition_marginals
Expand Down
2 changes: 1 addition & 1 deletion src/inference/viterbi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function viterbi!(
control_seq::AbstractVector;
seq_ends::AbstractVectorOrNTuple{Int},
) where {R}
if seq_ends isa NTuple
if seq_ends isa NTuple{1}
for k in eachindex(seq_ends)
_viterbi!(storage, hmm, obs_seq, control_seq, seq_ends, k)
end
Expand Down

2 comments on commit e9f5de4

@gdalle
Copy link
Owner Author

@gdalle gdalle commented on e9f5de4 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/119532

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.1 -m "<description of version>" e9f5de4b5f100b47d9b03c9a45b2ce0ad4f2984c
git push origin v0.6.1

Please sign in to comment.