Skip to content

Commit

Permalink
fixed small allocation in serial runs
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Apr 1, 2022
1 parent 6b5d38b commit f246095
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/CellLists.jl
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,12 @@ function UpdateCellList!(
cl::CellList;
parallel::Bool=true
)
aux = AuxThreaded(cl)
return UpdateCellList!(x,box,cl,aux,parallel=parallel)
if parallel
aux = AuxThreaded(cl)
return UpdateCellList!(x,box,cl,aux,parallel=parallel)
else
return UpdateCellList!(x,box,cl,nothing,parallel=parallel)
end
end

"""
Expand Down Expand Up @@ -695,7 +699,7 @@ function UpdateCellList!(
x::AbstractVector{<:AbstractVector},
box::Box,
cl::CellList{N,T},
aux::AuxThreaded{N,T};
aux::Union{Nothing,AuxThreaded{N,T}};
parallel::Bool=true
) where {N,T}
```
Expand Down Expand Up @@ -757,7 +761,7 @@ function UpdateCellList!(
x::AbstractVector{<:AbstractVector},
box::Box,
cl::CellList{N,T},
aux::AuxThreaded{N,T};
aux::Union{Nothing,AuxThreaded{N,T}};
parallel::Bool=true
) where {N,T}

Expand Down Expand Up @@ -805,7 +809,7 @@ function UpdateCellList!(
x::AbstractMatrix,
box::Box,
cl::CellList{N,T},
aux::AuxThreaded{N,T};
aux::Union{Nothing,AuxThreaded{N,T}};
parallel::Bool=true
) where {N,T}
```
Expand All @@ -819,7 +823,7 @@ function UpdateCellList!(
x::AbstractMatrix,
box::Box,
cl::CellList{N,T},
aux::AuxThreaded{N,T};
aux::Union{Nothing,AuxThreaded{N,T}};
parallel::Bool=true
) where {N,T}
@assert size(x,1) == N "First dimension of input matrix must be $N"
Expand Down Expand Up @@ -1112,8 +1116,12 @@ function UpdateCellList!(
cl_pair::CellListPair;
parallel::Bool=true
)
aux = AuxThreaded(cl_pair)
return UpdateCellList!(x,y,box,cl_pair,aux,parallel=parallel)
if parallel
aux = AuxThreaded(cl_pair)
return UpdateCellList!(x,y,box,cl_pair,aux,parallel=parallel)
else
return UpdateCellList!(x,y,box,cl_pair,nothing,parallel=parallel)
end
end

"""
Expand Down Expand Up @@ -1155,7 +1163,7 @@ function UpdateCellList!(
y::AbstractVector{<:AbstractVector},
box::Box,
cl_pair::CellListPair,
aux::AuxThreaded;
aux::Union{Nothing,AuxThreaded};
parallel::Bool=true
)
```
Expand Down Expand Up @@ -1220,7 +1228,7 @@ function UpdateCellList!(
y::AbstractVector{<:AbstractVector},
box::Box,
cl_pair::CellListPair,
aux::AuxThreaded;
aux::Union{Nothing,AuxThreaded};
parallel::Bool=true
)
if !cl_pair.swap
Expand All @@ -1240,7 +1248,7 @@ function UpdateCellList!(
y::AbstractMatrix,
box::Box,
cl_pair::CellListPair,
aux::AuxThreaded;
aux::Union{Nothing,AuxThreaded};
parallel::Bool=true
) where {UnitCellType,N,T}
```
Expand All @@ -1255,7 +1263,7 @@ function UpdateCellList!(
y::AbstractMatrix,
box::Box{UnitCellType,N,T},
cl_pair::CellListPair{N,T},
aux::AuxThreaded{N,T};
aux::Union{Nothing,AuxThreaded{N,T}};
parallel::Bool=true
) where {UnitCellType,N,T}
@assert size(x,1) == N "First dimension of input matrix must be $N"
Expand Down

4 comments on commit f246095

@lmiq
Copy link
Member Author

@lmiq lmiq commented on f246095 Apr 1, 2022

Choose a reason for hiding this comment

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

@lmiq
Copy link
Member Author

@lmiq lmiq commented on f246095 Apr 1, 2022

Choose a reason for hiding this comment

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

@lmiq
Copy link
Member Author

@lmiq lmiq commented on f246095 Apr 1, 2022

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/57792

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.7.13 -m "<description of version>" f2460955ec6aa053a3574ad9642d91230477356d
git push origin v0.7.13

Please sign in to comment.