From 8b713f7b633f31fec05edee262bb3e221125d534 Mon Sep 17 00:00:00 2001 From: kevinkong98 <143381995+kevinkong98@users.noreply.github.com> Date: Fri, 26 Dec 2025 23:33:03 -0700 Subject: [PATCH 1/3] Use spawn multiprocessing context for CUDA calculations --- src/oet/server_client/server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/oet/server_client/server.py b/src/oet/server_client/server.py index 8d3c2d6..13e7b8d 100755 --- a/src/oet/server_client/server.py +++ b/src/oet/server_client/server.py @@ -31,6 +31,7 @@ from collections import OrderedDict from collections.abc import Mapping, Sequence from concurrent.futures import BrokenExecutor, ProcessPoolExecutor +import multiprocessing as mp from contextlib import redirect_stdout from pathlib import Path from types import FrameType @@ -623,8 +624,12 @@ def main() -> None: # Create workers workers = args.nthreads + # Use spawn start method so CUDA can be initialized safely in worker processes + mp_ctx = mp.get_context("spawn") # Initialize the ProcessPool - executor = ProcessPoolExecutor(max_workers=workers, initializer=worker_initializer) + executor = ProcessPoolExecutor( + max_workers=workers, initializer=worker_initializer, mp_context=mp_ctx + ) # Make a CalculatorClass getting the hooks on calculators argument parsing # Info on calculator type is store in the object for client requests From 58368d702b03d4273257c5b046e5c435247e9d34 Mon Sep 17 00:00:00 2001 From: kevinkong98 <143381995+kevinkong98@users.noreply.github.com> Date: Sat, 27 Dec 2025 11:16:18 -0700 Subject: [PATCH 2/3] Remove offline cache warning --- src/oet/calculator/uma.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/oet/calculator/uma.py b/src/oet/calculator/uma.py index 9637c61..1a437d9 100755 --- a/src/oet/calculator/uma.py +++ b/src/oet/calculator/uma.py @@ -303,19 +303,15 @@ def calc( or not isinstance(cache_dir, str) ): raise RuntimeError("Problems handling input parameters.") - # Check if we have the respective models stored locally in cache - # If so, switch to offline mode - if self.check_for_model_files(basemodel=basemodel, cache_dir=cache_dir): - print("Model parameters found in cache. Switching to offline mode.") - self.switch_to_offline_mode() # If set by the user, switch also to offline mode. # This is a fallback, if online communication must be prevented. if offline_mode: self.switch_to_offline_mode() - if self.check_for_model_files(basemodel=basemodel, cache_dir=cache_dir): - print( - "WARNING: No model files were detected. This might lead to subsequent errors." - ) + # Check if we have the respective models stored locally in cache + # If so, switch to offline mode + elif self.check_for_model_files(basemodel=basemodel, cache_dir=cache_dir): + print("Model parameters found in cache. Switching to offline mode.") + self.switch_to_offline_mode() # setup calculator if not already set # this is important as usage on a server would otherwise cause # initialization with every call so that nothing is gained From 3131ee00d68bb81591b23de82923623d0c189e38 Mon Sep 17 00:00:00 2001 From: Christoph Plett Date: Tue, 20 Jan 2026 08:25:42 +0100 Subject: [PATCH 3/3] Improve model file detection Signed-off-by: Christoph Plett --- src/oet/calculator/uma.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/oet/calculator/uma.py b/src/oet/calculator/uma.py index 1a437d9..c326156 100755 --- a/src/oet/calculator/uma.py +++ b/src/oet/calculator/uma.py @@ -303,15 +303,23 @@ def calc( or not isinstance(cache_dir, str) ): raise RuntimeError("Problems handling input parameters.") - # If set by the user, switch also to offline mode. - # This is a fallback, if online communication must be prevented. - if offline_mode: + # Check if the model files are available + model_files_available = self.check_for_model_files(basemodel=basemodel, cache_dir=cache_dir) + # If they are available, switch to offline mode. + if model_files_available: self.switch_to_offline_mode() - # Check if we have the respective models stored locally in cache - # If so, switch to offline mode - elif self.check_for_model_files(basemodel=basemodel, cache_dir=cache_dir): - print("Model parameters found in cache. Switching to offline mode.") + print("Model files detected. Switching to offline mode.") + # If they are not available, but the user requested the offline mode to prevent online communication, + # print a warning as this will likely cause subsequent errors. + elif offline_mode: self.switch_to_offline_mode() + # Check if the model files are locally available. If not, subsequent errors will occur + # as they cannot be downloaded. + print( + "WARNING: Offline mode selected, but no model files were detected. " + "This will likely cause subsequent errors." + ) + # setup calculator if not already set # this is important as usage on a server would otherwise cause # initialization with every call so that nothing is gained