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

Fix datatypes for macos test fails #102

Merged
merged 2 commits into from
May 26, 2024
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
40 changes: 20 additions & 20 deletions tests/test_derivative.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,127 +14,127 @@
"nz": 600,
"dz": 1.0,
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.SCATTER
}

par1b = {
"nz": 600,
"dz": 1.0,
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.BROADCAST
}

par1j = {
"nz": 600,
"dz": 1.0,
"edge": False,
"dtype": np.complex256,
"dtype": np.complex128,
"partition": pylops_mpi.Partition.SCATTER
}

par1e = {
"nz": 600,
"dz": 1.0,
"edge": True,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.SCATTER
}

par2 = {
"nz": (100, 151),
"dz": 1.0,
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.SCATTER
}

par2b = {
"nz": (100, 151),
"dz": 1.0,
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.BROADCAST
}

par2j = {
"nz": (100, 151),
"dz": 1.0,
"edge": False,
"dtype": np.complex256,
"dtype": np.complex128,
"partition": pylops_mpi.Partition.SCATTER
}

par2e = {
"nz": (100, 151),
"dz": 1.0,
"edge": True,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.SCATTER
}

par3 = {
"nz": (101, 51, 100),
"dz": 0.4,
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.SCATTER
}

par3b = {
"nz": (101, 51, 100),
"dz": 0.4,
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.BROADCAST
}

par3j = {
"nz": (101, 51, 100),
"dz": 0.4,
"edge": True,
"dtype": np.complex256,
"dtype": np.complex128,
"partition": pylops_mpi.Partition.SCATTER
}

par3e = {
"nz": (101, 51, 100),
"dz": 0.4,
"edge": True,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.SCATTER
}

par4 = {
"nz": (79, 101, 50),
"dz": 0.4,
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.SCATTER
}

par4b = {
"nz": (79, 101, 50),
"dz": 0.4,
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.BROADCAST
}

par4j = {
"nz": (79, 101, 50),
"dz": 0.4,
"edge": True,
"dtype": np.complex256,
"dtype": np.complex128,
"partition": pylops_mpi.Partition.SCATTER
}

par4e = {
"nz": (79, 101, 50),
"dz": 0.4,
"edge": True,
"dtype": np.float128,
"dtype": np.float64,
"partition": pylops_mpi.Partition.SCATTER
}

Expand All @@ -144,7 +144,7 @@
"weights": (0.7, 0.7, 0.7),
"sampling": (1, 1, 1),
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
}

par5e = {
Expand All @@ -153,7 +153,7 @@
"weights": (0.7, 0.7, 0.7),
"sampling": (1, 1, 1),
"edge": True,
"dtype": np.float128,
"dtype": np.float64,
}

par6 = {
Expand All @@ -162,7 +162,7 @@
"weights": (1, 1, 1),
"sampling": (0.4, 0.4, 0.4),
"edge": False,
"dtype": np.float128,
"dtype": np.float64,
}

par6e = {
Expand All @@ -171,7 +171,7 @@
"weights": (1, 1, 1),
"sampling": (0.4, 0.4, 0.4),
"edge": True,
"dtype": np.float128,
"dtype": np.float64,
}


Expand Down
2 changes: 1 addition & 1 deletion tests/test_distributedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,4 @@ def test_distributed_norm(par):
np.linalg.norm(par['x'], ord=1, axis=par['axis']), rtol=1e-14)
assert_allclose(arr.norm(ord=np.inf, axis=par['axis']),
np.linalg.norm(par['x'], ord=np.inf, axis=par['axis']), rtol=1e-14)
assert_allclose(arr.norm(), np.linalg.norm(par['x'].flatten()), rtol=1e-14)
assert_allclose(arr.norm(), np.linalg.norm(par['x'].flatten()), rtol=1e-13)
8 changes: 4 additions & 4 deletions tests/test_linearop.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
rank = MPI.COMM_WORLD.Get_rank()
size = MPI.COMM_WORLD.Get_size()

par1 = {'ny': 101, 'nx': 101, 'dtype': np.float128}
par1j = {'ny': 101, 'nx': 101, 'dtype': np.complex256}
par2 = {'ny': 301, 'nx': 101, 'dtype': np.float128}
par2j = {'ny': 301, 'nx': 101, 'dtype': np.complex256}
par1 = {'ny': 101, 'nx': 101, 'dtype': np.float64}
par1j = {'ny': 101, 'nx': 101, 'dtype': np.complex128}
par2 = {'ny': 301, 'nx': 101, 'dtype': np.float64}
par2j = {'ny': 301, 'nx': 101, 'dtype': np.complex128}


@pytest.mark.mpi(min_size=2)
Expand Down
18 changes: 9 additions & 9 deletions tests/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,56 +31,56 @@
"nx": 11,
"imag": 0,
"x0": False,
"dtype": "float128",
"dtype": "float64",
} # square real, zero initial guess
par2 = {
"ny": 11,
"nx": 11,
"imag": 0,
"x0": True,
"dtype": "float128",
"dtype": "float64",
} # square real, non-zero initial guess
par3 = {
"ny": 31,
"nx": 11,
"imag": 0,
"x0": False,
"dtype": "float128",
"dtype": "float64",
} # overdetermined real, zero initial guess
par4 = {
"ny": 31,
"nx": 11,
"imag": 0,
"x0": True,
"dtype": "float128",
"dtype": "float64",
} # overdetermined real, non-zero initial guess
par1j = {
"ny": 11,
"nx": 11,
"imag": 1j,
"x0": False,
"dtype": "complex256",
"dtype": "complex128",
} # square complex, zero initial guess
par2j = {
"ny": 11,
"nx": 11,
"imag": 1j,
"x0": True,
"dtype": "complex256",
"dtype": "complex128",
} # square complex, non-zero initial guess
par3j = {
"ny": 31,
"nx": 11,
"imag": 1j,
"x0": False,
"dtype": "complex256",
"dtype": "complex128",
} # overdetermined complex, zero initial guess
par4j = {
"ny": 31,
"nx": 11,
"imag": 1j,
"x0": True,
"dtype": "complex256",
"dtype": "complex128",
} # overdetermined complex, non-zero initial guess


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


@pytest.mark.mpi(min_size=2)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_stackedlinearop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
rank = MPI.COMM_WORLD.Get_rank()
size = MPI.COMM_WORLD.Get_size()

par1 = {'ny': 101, 'nx': 101, 'dtype': np.float128}
par1j = {'ny': 101, 'nx': 101, 'dtype': np.complex256}
par2 = {'ny': 301, 'nx': 101, 'dtype': np.float128}
par2j = {'ny': 301, 'nx': 101, 'dtype': np.complex256}
par1 = {'ny': 101, 'nx': 101, 'dtype': np.float64}
par1j = {'ny': 101, 'nx': 101, 'dtype': np.complex128}
par2 = {'ny': 301, 'nx': 101, 'dtype': np.float64}
par2j = {'ny': 301, 'nx': 101, 'dtype': np.complex128}


@pytest.mark.mpi(min_size=2)
Expand Down
Loading