-
Notifications
You must be signed in to change notification settings - Fork 45
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
update codebase to 1.0 and 1.x (continue #27) #31
Merged
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
86fbdb5
add Project.toml
johnnychen94 42aa2f0
update test for cache and minor fix
johnnychen94 061ddc9
update test for rotation and minor fix
johnnychen94 e3b61db
update flipdm to reverse
johnnychen94 766744f
update test for crop and minor fix
johnnychen94 c471003
update test for resize
johnnychen94 1cbe9e4
update test for scale and minor fix
johnnychen94 75b433a
update test for zoom and minor fix
johnnychen94 3612f17
WIP: update test for distortion and minor fix
johnnychen94 970a691
update test for either and minor fix
johnnychen94 c666766
fix pipeline test
johnnychen94 e33c6ae
update summary reference for distortedview
johnnychen94 f096c05
WIP: fix tests for augment and operations
johnnychen94 8099666
drop julia 0.7 and update CI
johnnychen94 9d6a9b3
use FileIO v1.1.0
johnnychen94 d3e60f2
add 1.x tests to CI
johnnychen94 2e97f13
revert back unnecessary changes
johnnychen94 6c95157
test windows in travis
johnnychen94 4891a58
fix randomly failed test cases for inacuraccy reasons
johnnychen94 23ddbd1
unify how types are displayed
johnnychen94 dc3682e
update to julia 1.1
johnnychen94 4758e77
update to julia 1.2 -- part I
johnnychen94 fdbb15c
WIP: update to julia 1.2 -- part II
johnnychen94 2530508
add more test versions
johnnychen94 1587955
move safe_rand to compat.jl
johnnychen94 19aeb9e
don't allow failures for julia 1.3
johnnychen94 733e32b
fix commit "WIP: update 1.0"
johnnychen94 67e9784
use explicit and intuitive CartesianIndex(1, 1)
johnnychen94 a698382
add method specialization for tweight
johnnychen94 5f96ab5
allow FileIO 1.2
johnnychen94 61d8cee
fix type instability for Either
johnnychen94 2bf0975
update reference for FixedPointNumbers v0.7
johnnychen94 f483d2c
try: relax equality check for scale
johnnychen94 2a0c7c9
restore test cases in tst_scale.jl
johnnychen94 8443246
Revert "add method specialization for tweight"
johnnychen94 e915c94
Augmentor v0.6.0-pre
johnnychen94 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
if VERSION >= v"1.3" | ||
const safe_rand = rand | ||
else | ||
# rand is thread safe after julia 1.3 | ||
# TODO: delete this when we decide to drop 1.0 compatibility | ||
|
||
# -------------------------------------------------------------------- | ||
# rand() is not threadsafe (https://discourse.julialang.org/t/4683) | ||
|
||
# Because we only require random numbers to sample parameters | ||
# and not the actual expensive computation, this seems like a better | ||
# approach than using separate RNG per thread. | ||
const rand_mutex = Ref{Threads.Mutex}() | ||
|
||
# constant overhead of about 80 ns compared to unsafe rand | ||
function safe_rand(args...) | ||
lock(rand_mutex[]) | ||
result = rand(args...) | ||
unlock(rand_mutex[]) | ||
result | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# TODO: remove this testset when we dicide to drop 1.0 compatibility | ||
if VERSION < v"1.3" | ||
@testset "safe_rand" begin | ||
mutex = Augmentor.rand_mutex[] | ||
typeof(mutex) <: Threads.Mutex | ||
# check that its not a null pointer | ||
@test reinterpret(Int, mutex.handle) > 0 | ||
|
||
num = @inferred Augmentor.safe_rand() | ||
@test 0 <= num <= 1 | ||
@test typeof(num) <: Float64 | ||
num = @inferred Augmentor.safe_rand(2) | ||
@test all(0 .<= num .<= 1) | ||
@test typeof(num) <: Vector{Float64} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little worried here that I might misunderstand what "threadsafe" means here. Is that mean the following two scripts should output the same results?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. This has no influence on the ordering that threads invoke
save_rand
. It really just is about the function being threadsafe so that consecutive return values (regardless of calling thread) can be considered random