Esempio n. 1
0
 private void CreateExcavatorCommandTemplate(IEnumerable <string> uuids)
 {
     try
     {
         var templatePath = CmdConfig.CommandFileTemplatePath(PluginUUID);
         var template     = CmdConfig.CreateTemplate(uuids);
         if (!File.Exists(templatePath) && template != null)
         {
             File.WriteAllText(templatePath, template);
         }
     }
     catch (Exception e)
     {
         Logger.Error("ExcavatorPlugin", $"CreateExcavatorCommandTemplate {e}");
     }
 }
Esempio n. 2
0
        public override Dictionary <BaseDevice, IReadOnlyList <Algorithm> > GetSupportedAlgorithms(IEnumerable <BaseDevice> devices)
        {
            // SM 6.0+
            var cudaGpus   = devices.Where(dev => dev is CUDADevice cuda && cuda.SM_major >= 6).Cast <CUDADevice>();
            var supported  = new Dictionary <BaseDevice, IReadOnlyList <Algorithm> >();
            var minDrivers = new Version(411, 0); // TODO

            if (CUDADevice.INSTALLED_NVIDIA_DRIVERS < minDrivers)
            {
                return(supported);
            }

            foreach (var gpu in cudaGpus)
            {
                var algos = GetSupportedAlgorithmsForDevice(gpu);
                if (algos.Count > 0)
                {
                    supported.Add(gpu, algos);
                }
            }
            try
            {
                var templatePath = CmdConfig.CommandFileTemplatePath(PluginUUID);
                var template     = CmdConfig.CreateTemplate(supported.Select(p => p.Key.UUID));
                if (!File.Exists(templatePath) && template != null)
                {
                    File.WriteAllText(templatePath, template);
                }
            }
            catch (Exception e)
            {
                Logger.Error("ExcavatorPlugin", $"GetSupportedAlgorithms create cmd template {e}");
            }

            return(supported);
        }