Class ProviderExecutionMode
java.lang.Object
org.episteme.core.technical.algorithm.ProviderExecutionMode
Thread-local execution mode flag for provider fallback control.
In ProviderExecutionMode.Mode.NORMAL mode, providers may fall back to alternative
implementations (e.g., CPU fallback when CUDA fails). In
ProviderExecutionMode.Mode.BENCHMARK or ProviderExecutionMode.Mode.AUTOTUNING mode, fallbacks
are disabled and failures surface as exceptions, ensuring honest
performance measurements.
ProviderExecutionMode.set(Mode.BENCHMARK);
try {
provider.multiply(a, b); // will throw if CUDA fails
} finally {
ProviderExecutionMode.reset();
}
- Since:
- 2.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumExecution modes that control fallback behavior. -
Method Summary
Modifier and TypeMethodDescriptionstatic ProviderExecutionMode.Modeget()Returns the current execution mode for this thread.static booleanReturnstrueif the current mode allows fallback to alternative implementations.static voidreset()Resets the execution mode toProviderExecutionMode.Mode.NORMALand removes the thread-local.static voidSets the execution mode for this thread.
-
Method Details
-
get
Returns the current execution mode for this thread. -
set
Sets the execution mode for this thread. -
isFallbackAllowed
public static boolean isFallbackAllowed()Returnstrueif the current mode allows fallback to alternative implementations. OnlyProviderExecutionMode.Mode.NORMALpermits fallbacks. -
reset
public static void reset()Resets the execution mode toProviderExecutionMode.Mode.NORMALand removes the thread-local.
-