-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d320e4
commit 520cd55
Showing
2 changed files
with
29 additions
and
0 deletions.
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,28 @@ | ||
using Test | ||
using SpinShuttling | ||
using DelimitedFiles | ||
# using UnicodePlots | ||
# using ProgressMeter | ||
|
||
@testset "test multithreading" begin | ||
T=4; L=10; σ = sqrt(2) / 20; N=501; κₜ=1;κₓ=1; | ||
|
||
B=OrnsteinUhlenbeckField(0,[κₜ,κₓ],σ) | ||
model=OneSpinModel(T,L,N,B) | ||
|
||
# save the original Σ to text file | ||
if Threads.nthreads() > 1 | ||
writedlm("test/cache.csv", model.R.Σ) | ||
else | ||
# read the original Σ from text file | ||
Σ = readdlm("test/cache.csv") | ||
# test the original Σ is the same as the one in the model | ||
@test isapprox(Σ, model.R.Σ, rtol=1e-10) | ||
# delete the cache file | ||
rm("test/cache.csv", force=true) | ||
end | ||
|
||
M = 100000; | ||
F=sampling(model, fidelity, M) | ||
println(F) | ||
end |