Skip to content

Commit c976972

Browse files
committed
[TEST] Add tests for CG solver with PYTORCH and PYKEOPS backends
Extended CG solver tests to include configurations using both the PYTORCH and PYKEOPS backends. Configured tests with varying `use_gpu` and `dtype` options, introduced a new Greenstone model test, and added 3D plotting support in the test suite.
1 parent 84f42b1 commit c976972

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/test_modules/test_cg/test_cg_solver.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_solve_with_cg():
2020
engine_config=gp.data.GemPyEngineConfig(
2121
backend=gp.data.AvailableBackends.PYTORCH,
2222
use_gpu=True,
23-
dtype='float32'
23+
dtype='float64'
2424
)
2525
)
2626

@@ -60,3 +60,23 @@ def test_save_weights():
6060
if PLOT:
6161
gpv = require_gempy_viewer()
6262
gpv.plot_3d(model, image=True)
63+
64+
65+
def test_keops_x_torch():
66+
model = gp.generate_example_model(ExampleModel.GREENSTONE, compute_model=False)
67+
print(model.structural_frame)
68+
69+
WeightCache.clear_cache()
70+
BackendTensor.PYKEOPS = True
71+
sol = gp.compute_model(
72+
gempy_model=model,
73+
engine_config=gp.data.GemPyEngineConfig(
74+
backend=gp.data.AvailableBackends.PYTORCH,
75+
use_gpu=False,
76+
dtype='float32'
77+
)
78+
)
79+
80+
if PLOT:
81+
gpv = require_gempy_viewer()
82+
gpv.plot_3d(model, image=True)

0 commit comments

Comments
 (0)