Skip to content

Commit c4d66ac

Browse files
committed
Add profiling script, test case, and improve GPU debugging
Introduce a profiling script for PyCharm with GPU debugging enhancements and sampling adjustments. Add a benchmarking test case for geological model computation. Improve GPU backend defaults and enhance trimesh-based post-processing in dual contouring module.
1 parent 98293b5 commit c4d66ac

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

gempy_engine/core/backend_tensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def change_backend_gempy(cls, engine_backend: AvailableBackends, use_gpu: bool =
5353

5454
@classmethod
5555
def _change_backend(cls, engine_backend: AvailableBackends, use_pykeops: bool = False,
56-
use_gpu: bool = True, dtype: Optional[str] = None, grads:bool = False):
56+
use_gpu: bool = False, dtype: Optional[str] = None, grads:bool = False):
5757
cls.dtype = DEFAULT_TENSOR_DTYPE if dtype is None else dtype
5858
cls.dtype_obj = cls.dtype
5959
match engine_backend:

gempy_engine/modules/dual_contouring/_dual_contouring_v2.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@
1717
MULTIPROCESSING_AVAILABLE = True
1818
except ImportError:
1919
import multiprocessing as mp
20-
2120
MULTIPROCESSING_AVAILABLE = False
2221

22+
# Import trimesh once at module level
23+
TRIMESH_AVAILABLE = False
24+
try:
25+
trimesh = optional_dependencies.require_trimesh()
26+
TRIMESH_AVAILABLE = True
27+
except ImportError:
28+
trimesh = None
29+
2330

2431
@gempy_profiler_decorator
2532
def compute_dual_contouring_v2(dc_data_list: list[DualContouringData], ) -> List[DualContouringMesh]:
@@ -41,6 +48,9 @@ def compute_dual_contouring_v2(dc_data_list: list[DualContouringData], ) -> List
4148

4249
def _parallel_process(dc_data_list: list[DualContouringData]):
4350
# Check if we should use parallel processing
51+
52+
return None # * Not clear wins
53+
4454
n_surfaces_to_export = len(dc_data_list)
4555
use_parallel = _should_use_parallel_processing(n_surfaces_to_export, BackendTensor.engine_backend)
4656
parallel_results = None
@@ -153,11 +163,14 @@ def _process_one_surface(dc_data: DualContouringData, left_right_codes) -> DualC
153163

154164

155165
def _last_pass(vertices, indices):
156-
# Check if trimesh is available
166+
"""Apply trimesh post-processing if available."""
167+
if not TRIMESH_AVAILABLE:
168+
return vertices, indices
169+
157170
try:
158-
trimesh = optional_dependencies.require_trimesh()
159171
mesh = trimesh.Trimesh(vertices=vertices, faces=indices)
160172
mesh.fill_holes()
161173
return mesh.vertices, mesh.faces
162-
except ImportError:
174+
except Exception as e:
175+
print(f"Warning: Trimesh post-processing failed: {e}")
163176
return vertices, indices

0 commit comments

Comments
 (0)