From 5da58a66442d52751abc733ea5df568c8173b7f9 Mon Sep 17 00:00:00 2001 From: Sam Lane Date: Thu, 23 Jan 2025 12:48:32 +0000 Subject: [PATCH] feature: add env variable kernel override --- lib/volk_rank_archs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/volk_rank_archs.c b/lib/volk_rank_archs.c index 750fe54b7..9f7dbb4b1 100644 --- a/lib/volk_rank_archs.c +++ b/lib/volk_rank_archs.c @@ -56,6 +56,13 @@ int volk_rank_archs(const char* kern_name, // name of the kernel to rank return volk_get_index(impl_names, n_impls, "generic"); } + // If we've defined the kernel name as an environment variable, always return + // the 'overridden' kernel. Used for manually overring config kernels at runtime. + char *override_env = getenv(kern_name); + if (override_env) { + return volk_get_index(impl_names, n_impls, override_env); + } + // now look for the function name in the prefs list for (i = 0; i < n_arch_prefs; i++) { if (!strncmp(kern_name,