mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-07-09 20:09:44 +02:00
Stop Vulkan init from overwriting config value for NCNN GPU ID
This commit is contained in:
@@ -45,14 +45,17 @@ namespace Flowframes.IO
|
||||
}
|
||||
}
|
||||
|
||||
public static void Set(Key key, string value)
|
||||
public static void Set(Key key, string value, bool allowIfExists = true)
|
||||
{
|
||||
Set(key.ToString(), value);
|
||||
Set(key.ToString(), value, allowIfExists);
|
||||
}
|
||||
|
||||
public static void Set(string str, string value)
|
||||
public static void Set(string str, string value, bool allowIfExists = true)
|
||||
{
|
||||
// Reload();
|
||||
if (!allowIfExists && CachedValues.ContainsKey(str))
|
||||
return;
|
||||
|
||||
CachedValues[str] = value;
|
||||
WriteConfig();
|
||||
}
|
||||
|
||||
@@ -76,13 +76,13 @@ namespace Flowframes.Os
|
||||
if (VkDevices.Count == 0)
|
||||
{
|
||||
Logger.Log($"No Vulkan-capable GPUs found. NCNN implementations will run on the CPU instead and may be unstable.");
|
||||
Config.Set(Config.Key.ncnnGpus, "-1"); // -1 = CPU
|
||||
Config.Set(Config.Key.ncnnGpus, "-1", allowIfExists: false); // -1 = CPU
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the device that has the most compute queues as default GPU
|
||||
var maxQueuesDevice = VkDevices.OrderByDescending(d => d.ComputeQueueCount).First();
|
||||
Config.Set(Config.Key.ncnnGpus, $"{maxQueuesDevice.Id}");
|
||||
Config.Set(Config.Key.ncnnGpus, $"{maxQueuesDevice.Id}", allowIfExists: false);
|
||||
}
|
||||
|
||||
public static int GetMaxNcnnThreads(int deviceId)
|
||||
|
||||
Reference in New Issue
Block a user