Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove various lock implementations #40

Merged
merged 4 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ module ConcurrentUtilsBenchmarks

using BenchmarkTools: Benchmark, BenchmarkGroup

include("bench_acquire_release_spin_locks.jl")
include("bench_acquire_release_coop_locks.jl")
include("bench_acquire_release_read_write_locks.jl")
include("bench_acquire_release_read_locks.jl")

const MODULES = [
BenchAcquireReleaseSpinLocks,
BenchAcquireReleaseCoOpLocks,
BenchAcquireReleaseReadWriteLocks,
BenchAcquireReleaseReadLocks,
# ...
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ using BenchmarkTools
using ConcurrentUtils
using SyncBarriers

using ..BenchAcquireReleaseReadWriteLocks: raynal_read_write_lock, single_reentrantlock
using ..BenchAcquireReleaseReadWriteLocks: single_reentrantlock

function setup_repeat_acquire_release(
lock;
lck;
ntries = 2^2,
nrlocks = 2^8,
ntasks = Threads.nthreads(),
Expand All @@ -17,14 +17,14 @@ function setup_repeat_acquire_release(
barrier = CentralizedBarrier(ntasks)
workers = map(1:ntasks) do i
Threads.@spawn begin
acquire(lock)
release(lock)
lock(lck)
unlock(lck)
cycle!(init[i])
cycle!(init[i])
for _ in 1:ntries
for _ in 1:nrlocks
acquire(lock)
release(lock)
lock(lck)
unlock(lck)
end
cycle!(barrier[i], nspins_barrier)
end
Expand All @@ -50,7 +50,7 @@ function setup(;
nrlocks = smoke ? 3 : 2^8,
ntasks_list = default_ntasks_list(),
nspins_barrier = 1_000_000,
locks = [read_write_lock, raynal_read_write_lock, single_reentrantlock],
locks = [read_write_lock, single_reentrantlock],
)
suite = BenchmarkGroup()
for ntasks in ntasks_list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ using BenchmarkTools
using ConcurrentUtils
using SyncBarriers

include("raynal_read_write_lock.jl")

raynal_read_write_lock() = read_write_lock(RaynalReadWriteLock())

function single_reentrantlock()
lock = ReentrantLock()
return (lock, lock)
Expand All @@ -25,16 +21,16 @@ function setup_repeat_acquire_release(
barrier = CentralizedBarrier(ntasks)
workers = map(1:ntasks) do i
Threads.@spawn begin
acquire(rlock)
release(rlock)
lock(rlock)
unlock(rlock)
cycle!(init[i])
cycle!(init[i])
for _ in 1:ntries
acquire(wlock)
release(wlock)
lock(wlock)
unlock(wlock)
for _ in 1:nrlocks
acquire(rlock)
release(rlock)
lock(rlock)
unlock(rlock)
end
cycle!(barrier[i], nspins_barrier)
end
Expand All @@ -60,7 +56,7 @@ function setup(;
nrlocks = smoke ? 3 : 2^8,
ntasks_list = default_ntasks_list(),
nspins_barrier = 1_000_000,
locks = [read_write_lock, raynal_read_write_lock, single_reentrantlock],
locks = [read_write_lock, single_reentrantlock],
)
suite = BenchmarkGroup()
for ntasks in ntasks_list
Expand Down

This file was deleted.

35 changes: 0 additions & 35 deletions benchmark/ConcurrentUtilsBenchmarks/src/raynal_read_write_lock.jl

This file was deleted.

20 changes: 0 additions & 20 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,15 @@ using DocumentationOverview
using ConcurrentUtils
DocumentationOverview.table_md(
:[
ReentrantCLHLock,
NonreentrantCLHLock,
ReentrantBackoffSpinLock,
NonreentrantBackoffSpinLock,
TaskObliviousLock,
read_write_lock,
acquire,
release,
try_race_acquire,
race_acquire,
acquire_then,
],
namespace = ConcurrentUtils,
signature = :name,
)
```

```@docs
ReentrantCLHLock
NonreentrantCLHLock
ReentrantBackoffSpinLock
NonreentrantBackoffSpinLock
TaskObliviousLock
read_write_lock
acquire
release
try_race_acquire
race_acquire
acquire_then
```

## Guards
Expand Down
23 changes: 0 additions & 23 deletions src/ConcurrentUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ export
@tasklet,
# Constructors
Guard,
NonreentrantBackoffSpinLock,
NonreentrantCLHLock,
NotAcquirableError,
NotSetError,
OccupiedError,
Promise,
ReadWriteGuard,
ReentrantBackoffSpinLock,
ReentrantCLHLock,
TaskObliviousLock,
ThreadLocalStorage,
TooManyTries

Expand Down Expand Up @@ -45,14 +40,6 @@ struct TooManyTries <: InternalPrelude.Exception
ntries::Int
end

InternalPrelude.@exported_function acquire
InternalPrelude.@exported_function release
InternalPrelude.@exported_function race_acquire
InternalPrelude.@exported_function try_race_acquire
# function try_race_acquire_then end
InternalPrelude.@exported_function acquire_then
InternalPrelude.@exported_function lock_supports_nspins

#=
InternalPrelude.@exported_function isacquirable
InternalPrelude.@exported_function isacquirable_read
Expand Down Expand Up @@ -122,16 +109,12 @@ using ..ConcurrentUtils:
NotSetError,
OccupiedError,
TooManyTries,
acquire,
acquire_read,
acquire_read_then,
race_acquire,
race_fetch_or!,
release,
release_read,
spinfor,
spinloop,
try_race_acquire,
try_race_acquire_read,
try_race_fetch,
try_race_fetch_or!,
Expand All @@ -153,19 +136,13 @@ include("thread_local_storage.jl")
# Locks
include("lock_interface.jl")
include("backoff_lock.jl")
include("clh_lock.jl")
include("read_write_lock.jl")
include("guards.jl")

end # module Internal

const Promise = Internal.Promise
const ThreadLocalStorage = Internal.ThreadLocalStorage
const ReentrantBackoffSpinLock = Internal.ReentrantBackoffSpinLock
const NonreentrantBackoffSpinLock = Internal.NonreentrantBackoffSpinLock
const ReentrantCLHLock = Internal.ReentrantCLHLock
const NonreentrantCLHLock = Internal.NonreentrantCLHLock
const TaskObliviousLock = NonreentrantCLHLock

const Guard = Internal.Guard
const ReadWriteGuard = Internal.ReadWriteGuard
Expand Down
Loading