Skip to content

Commit 9359a9b

Browse files
committed
disable multithreading on windows
1 parent 7755a75 commit 9359a9b

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

test/runtests.jl

+8-25
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ using WignerSymbols
33
using LinearAlgebra
44
using Random
55
using Base.Threads
6-
N = Base.Threads.nthreads()
6+
if Base.Sys.iswindows() # not sure why the multithreaded version fails on Windows
7+
N = 1
8+
else
9+
N = Base.Threads.nthreads()
10+
end
711
Random.seed!(1234)
812

913
smalljlist = 0:1//2:10
@@ -51,9 +55,9 @@ end
5155
end
5256

5357
# test recurrence relations: Phys Rev E 57, 7274 (1998)
54-
if Base.Sys.iswindows() # not sure why the multithreaded version fails on Windows
55-
@testset "wigner3j: recurrence relations" begin
56-
for k = 1:8
58+
@threads for i = 1:N
59+
@testset "wigner3j: recurrence relations, thread $i" begin
60+
for k = 1:div(8,N)
5761
j2 = convert(BigFloat, rand(largejlist))
5862
j3 = convert(BigFloat, rand(largejlist))
5963
m2 = -convert(BigFloat, rand(-j2:0))
@@ -70,27 +74,6 @@ if Base.Sys.iswindows() # not sure why the multithreaded version fails on Window
7074
end
7175
end
7276
end
73-
else
74-
@threads for i = 1:N
75-
@testset "wigner3j: recurrence relations, thread $i" begin
76-
for k = 1:div(8,N)
77-
j2 = convert(BigFloat, rand(largejlist))
78-
j3 = convert(BigFloat, rand(largejlist))
79-
m2 = -convert(BigFloat, rand(-j2:0))
80-
m3 = convert(BigFloat, rand(-j3:0))
81-
82-
for j in max(abs(j2-j3),abs(m2+m3))+1:(j2+j3)-1
83-
X = j*sqrt(((j+1)^2-(j2-j3)^2)*((j2+j3+1)^2-(j+1)^2)*((j+1)^2-(m2+m3)^2))
84-
Y = (2*j+1)*((m2+m3)*(j2*(j2+1)-j3*(j3+1)) - (m2-m3)*j*(j+1))
85-
Z = (j+1)*sqrt((j^2-(j2-j3)^2)*((j2+j3+1)^2-j^2)*(j^2-(m2+m3)^2))
86-
tol = 10*max(abs(X),abs(Y),abs(Z))*eps(BigFloat)
87-
@test (X*wigner3j(BigFloat,j+1,j2,j3,-m2-m3,m2,m3) +
88-
Z*wigner3j(BigFloat,j-1,j2,j3,-m2-m3,m2,m3))
89-
(-Y*wigner3j(BigFloat,j,j2,j3,-m2-m3,m2,m3)) atol=tol
90-
end
91-
end
92-
end
93-
end
9477
end
9578

9679
@threads for i = 1:N

0 commit comments

Comments
 (0)