Skip to content
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
5 changes: 5 additions & 0 deletions gempy_engine/API/model/model_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from ...core.data.solutions import Solutions
from ...core.utils import gempy_profiler_decorator
from ...core.exceptions import GemPyEngineInputError
from ...core.data.options.temp_interpolation_values import TempInterpolationValues
from ...modules.geophysics.fw_gravity import compute_gravity
from ...modules.geophysics.fw_magnetic import compute_tmi
from ...modules.weights_cache.weights_cache_interface import WeightCache
Expand All @@ -26,6 +27,10 @@
@gempy_profiler_decorator
def compute_model(interpolation_input: InterpolationInput, options: InterpolationOptions,
data_descriptor: InputDataDescriptor, *, geophysics_input: Optional[GeophysicsInput] = None) -> Solutions:
# Octree progress and cache timestamps belong to this computation. Keeping
# them on a shared options object lets concurrent requests change each
# other's active octree level.
options = options.model_copy(update={"temp_interpolation_values": TempInterpolationValues()})
try:
WeightCache.initialize_cache_dir()
options.temp_interpolation_values.start_computation_ts = int(time.time())
Expand Down
Empty file.
130 changes: 0 additions & 130 deletions gempy_engine/API/server/_process_output.py

This file was deleted.

65 changes: 0 additions & 65 deletions gempy_engine/API/server/_server_functions.py

This file was deleted.

110 changes: 0 additions & 110 deletions gempy_engine/API/server/main_server_pro.py

This file was deleted.

12 changes: 12 additions & 0 deletions gempy_engine/core/backend_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ def describe_conf(cls):
print(f"\n Using gpu: {cls.use_gpu}. \n")
print(f"\n Using pykeops: {cls.pykeops_enabled}. \n")

@classmethod
def arange(cls, stop, *, dtype=None):
if cls.engine_backend == AvailableBackends.PYTORCH:
if isinstance(dtype, str):
dtype = getattr(torch, dtype)
return torch.arange(stop, dtype=dtype, device=cls.device)
return cls.t.arange(stop, dtype=dtype)

@classmethod
def _wrap_pytorch_functions(cls):
import torch
Expand All @@ -205,8 +213,12 @@ def _sum(tensor, axis=None, dtype=None, keepdims=False):
def _repeat(tensor, n_repeats, axis=None):
if not isinstance(tensor, torch.Tensor):
tensor = torch.as_tensor(tensor, device=cls.device)
elif tensor.device != cls.device:
tensor = tensor.to(cls.device)
if not isinstance(n_repeats, torch.Tensor):
n_repeats = torch.as_tensor(n_repeats, device=cls.device)
elif n_repeats.device != cls.device:
n_repeats = n_repeats.to(cls.device)
return _true_torch_repeat_interleave(tensor, n_repeats, dim=axis)

def _array(array_like, dtype=None):
Expand Down
2 changes: 1 addition & 1 deletion gempy_engine/modules/data_preprocess/_input_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def surface_points_preprocess(sp_input: SurfacePoints, tensors_structure: Tensor
ref_points_repeated = b.t.repeat(ref_points, number_repetitions, 0) # ref_points shape: (1, 3)
ref_nugget_repeated = b.t.repeat(ref_nugget, number_repetitions, 0)
surface_ids = b.t.repeat(
b.t.arange(tensors_structure.n_surfaces, dtype=rest_nugget.dtype),
b.arange(tensors_structure.n_surfaces, dtype=rest_nugget.dtype),
number_repetitions,
0,
)
Expand Down
Loading