Skip to content

Commit f628bd3

Browse files
Merge pull request #102 from PyLops/fix_numpy.float128
Fix datatypes for macos test fails
2 parents a82d8b1 + 5187c2a commit f628bd3

5 files changed

+38
-38
lines changed

tests/test_derivative.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -14,127 +14,127 @@
1414
"nz": 600,
1515
"dz": 1.0,
1616
"edge": False,
17-
"dtype": np.float128,
17+
"dtype": np.float64,
1818
"partition": pylops_mpi.Partition.SCATTER
1919
}
2020

2121
par1b = {
2222
"nz": 600,
2323
"dz": 1.0,
2424
"edge": False,
25-
"dtype": np.float128,
25+
"dtype": np.float64,
2626
"partition": pylops_mpi.Partition.BROADCAST
2727
}
2828

2929
par1j = {
3030
"nz": 600,
3131
"dz": 1.0,
3232
"edge": False,
33-
"dtype": np.complex256,
33+
"dtype": np.complex128,
3434
"partition": pylops_mpi.Partition.SCATTER
3535
}
3636

3737
par1e = {
3838
"nz": 600,
3939
"dz": 1.0,
4040
"edge": True,
41-
"dtype": np.float128,
41+
"dtype": np.float64,
4242
"partition": pylops_mpi.Partition.SCATTER
4343
}
4444

4545
par2 = {
4646
"nz": (100, 151),
4747
"dz": 1.0,
4848
"edge": False,
49-
"dtype": np.float128,
49+
"dtype": np.float64,
5050
"partition": pylops_mpi.Partition.SCATTER
5151
}
5252

5353
par2b = {
5454
"nz": (100, 151),
5555
"dz": 1.0,
5656
"edge": False,
57-
"dtype": np.float128,
57+
"dtype": np.float64,
5858
"partition": pylops_mpi.Partition.BROADCAST
5959
}
6060

6161
par2j = {
6262
"nz": (100, 151),
6363
"dz": 1.0,
6464
"edge": False,
65-
"dtype": np.complex256,
65+
"dtype": np.complex128,
6666
"partition": pylops_mpi.Partition.SCATTER
6767
}
6868

6969
par2e = {
7070
"nz": (100, 151),
7171
"dz": 1.0,
7272
"edge": True,
73-
"dtype": np.float128,
73+
"dtype": np.float64,
7474
"partition": pylops_mpi.Partition.SCATTER
7575
}
7676

7777
par3 = {
7878
"nz": (101, 51, 100),
7979
"dz": 0.4,
8080
"edge": False,
81-
"dtype": np.float128,
81+
"dtype": np.float64,
8282
"partition": pylops_mpi.Partition.SCATTER
8383
}
8484

8585
par3b = {
8686
"nz": (101, 51, 100),
8787
"dz": 0.4,
8888
"edge": False,
89-
"dtype": np.float128,
89+
"dtype": np.float64,
9090
"partition": pylops_mpi.Partition.BROADCAST
9191
}
9292

9393
par3j = {
9494
"nz": (101, 51, 100),
9595
"dz": 0.4,
9696
"edge": True,
97-
"dtype": np.complex256,
97+
"dtype": np.complex128,
9898
"partition": pylops_mpi.Partition.SCATTER
9999
}
100100

101101
par3e = {
102102
"nz": (101, 51, 100),
103103
"dz": 0.4,
104104
"edge": True,
105-
"dtype": np.float128,
105+
"dtype": np.float64,
106106
"partition": pylops_mpi.Partition.SCATTER
107107
}
108108

109109
par4 = {
110110
"nz": (79, 101, 50),
111111
"dz": 0.4,
112112
"edge": False,
113-
"dtype": np.float128,
113+
"dtype": np.float64,
114114
"partition": pylops_mpi.Partition.SCATTER
115115
}
116116

117117
par4b = {
118118
"nz": (79, 101, 50),
119119
"dz": 0.4,
120120
"edge": False,
121-
"dtype": np.float128,
121+
"dtype": np.float64,
122122
"partition": pylops_mpi.Partition.BROADCAST
123123
}
124124

125125
par4j = {
126126
"nz": (79, 101, 50),
127127
"dz": 0.4,
128128
"edge": True,
129-
"dtype": np.complex256,
129+
"dtype": np.complex128,
130130
"partition": pylops_mpi.Partition.SCATTER
131131
}
132132

133133
par4e = {
134134
"nz": (79, 101, 50),
135135
"dz": 0.4,
136136
"edge": True,
137-
"dtype": np.float128,
137+
"dtype": np.float64,
138138
"partition": pylops_mpi.Partition.SCATTER
139139
}
140140

@@ -144,7 +144,7 @@
144144
"weights": (0.7, 0.7, 0.7),
145145
"sampling": (1, 1, 1),
146146
"edge": False,
147-
"dtype": np.float128,
147+
"dtype": np.float64,
148148
}
149149

150150
par5e = {
@@ -153,7 +153,7 @@
153153
"weights": (0.7, 0.7, 0.7),
154154
"sampling": (1, 1, 1),
155155
"edge": True,
156-
"dtype": np.float128,
156+
"dtype": np.float64,
157157
}
158158

159159
par6 = {
@@ -162,7 +162,7 @@
162162
"weights": (1, 1, 1),
163163
"sampling": (0.4, 0.4, 0.4),
164164
"edge": False,
165-
"dtype": np.float128,
165+
"dtype": np.float64,
166166
}
167167

168168
par6e = {
@@ -171,7 +171,7 @@
171171
"weights": (1, 1, 1),
172172
"sampling": (0.4, 0.4, 0.4),
173173
"edge": True,
174-
"dtype": np.float128,
174+
"dtype": np.float64,
175175
}
176176

177177

tests/test_distributedarray.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,4 @@ def test_distributed_norm(par):
191191
np.linalg.norm(par['x'], ord=1, axis=par['axis']), rtol=1e-14)
192192
assert_allclose(arr.norm(ord=np.inf, axis=par['axis']),
193193
np.linalg.norm(par['x'], ord=np.inf, axis=par['axis']), rtol=1e-14)
194-
assert_allclose(arr.norm(), np.linalg.norm(par['x'].flatten()), rtol=1e-14)
194+
assert_allclose(arr.norm(), np.linalg.norm(par['x'].flatten()), rtol=1e-13)

tests/test_linearop.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
rank = MPI.COMM_WORLD.Get_rank()
1919
size = MPI.COMM_WORLD.Get_size()
2020

21-
par1 = {'ny': 101, 'nx': 101, 'dtype': np.float128}
22-
par1j = {'ny': 101, 'nx': 101, 'dtype': np.complex256}
23-
par2 = {'ny': 301, 'nx': 101, 'dtype': np.float128}
24-
par2j = {'ny': 301, 'nx': 101, 'dtype': np.complex256}
21+
par1 = {'ny': 101, 'nx': 101, 'dtype': np.float64}
22+
par1j = {'ny': 101, 'nx': 101, 'dtype': np.complex128}
23+
par2 = {'ny': 301, 'nx': 101, 'dtype': np.float64}
24+
par2j = {'ny': 301, 'nx': 101, 'dtype': np.complex128}
2525

2626

2727
@pytest.mark.mpi(min_size=2)

tests/test_solver.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -31,56 +31,56 @@
3131
"nx": 11,
3232
"imag": 0,
3333
"x0": False,
34-
"dtype": "float128",
34+
"dtype": "float64",
3535
} # square real, zero initial guess
3636
par2 = {
3737
"ny": 11,
3838
"nx": 11,
3939
"imag": 0,
4040
"x0": True,
41-
"dtype": "float128",
41+
"dtype": "float64",
4242
} # square real, non-zero initial guess
4343
par3 = {
4444
"ny": 31,
4545
"nx": 11,
4646
"imag": 0,
4747
"x0": False,
48-
"dtype": "float128",
48+
"dtype": "float64",
4949
} # overdetermined real, zero initial guess
5050
par4 = {
5151
"ny": 31,
5252
"nx": 11,
5353
"imag": 0,
5454
"x0": True,
55-
"dtype": "float128",
55+
"dtype": "float64",
5656
} # overdetermined real, non-zero initial guess
5757
par1j = {
5858
"ny": 11,
5959
"nx": 11,
6060
"imag": 1j,
6161
"x0": False,
62-
"dtype": "complex256",
62+
"dtype": "complex128",
6363
} # square complex, zero initial guess
6464
par2j = {
6565
"ny": 11,
6666
"nx": 11,
6767
"imag": 1j,
6868
"x0": True,
69-
"dtype": "complex256",
69+
"dtype": "complex128",
7070
} # square complex, non-zero initial guess
7171
par3j = {
7272
"ny": 31,
7373
"nx": 11,
7474
"imag": 1j,
7575
"x0": False,
76-
"dtype": "complex256",
76+
"dtype": "complex128",
7777
} # overdetermined complex, zero initial guess
7878
par4j = {
7979
"ny": 31,
8080
"nx": 11,
8181
"imag": 1j,
8282
"x0": True,
83-
"dtype": "complex256",
83+
"dtype": "complex128",
8484
} # overdetermined complex, non-zero initial guess
8585

8686

@@ -268,7 +268,7 @@ def test_cgls_broadcastmodel(par):
268268
x0 = None
269269
y1 = Vstack @ x_global
270270
xinv1 = pylops.cgls(Vstack, y1, x0=x0, niter=par["nx"], tol=1e-5, show=True)[0]
271-
assert_allclose(xinv_array, xinv1, rtol=1e-14)
271+
assert_allclose(xinv_array, xinv1, rtol=1e-13)
272272

273273

274274
@pytest.mark.mpi(min_size=2)

tests/test_stackedlinearop.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
rank = MPI.COMM_WORLD.Get_rank()
1212
size = MPI.COMM_WORLD.Get_size()
1313

14-
par1 = {'ny': 101, 'nx': 101, 'dtype': np.float128}
15-
par1j = {'ny': 101, 'nx': 101, 'dtype': np.complex256}
16-
par2 = {'ny': 301, 'nx': 101, 'dtype': np.float128}
17-
par2j = {'ny': 301, 'nx': 101, 'dtype': np.complex256}
14+
par1 = {'ny': 101, 'nx': 101, 'dtype': np.float64}
15+
par1j = {'ny': 101, 'nx': 101, 'dtype': np.complex128}
16+
par2 = {'ny': 301, 'nx': 101, 'dtype': np.float64}
17+
par2j = {'ny': 301, 'nx': 101, 'dtype': np.complex128}
1818

1919

2020
@pytest.mark.mpi(min_size=2)

0 commit comments

Comments
 (0)