示例#1
0
        /// <summary>
        /// Public constructor
        /// </summary>
        /// <param name="instance">CLAPI Instance for the current thread</param>
        /// <param name="folderName">Folder name where the kernels are located</param>
        /// <param name="genDataType">The DataTypes used to compile the FL Database</param>
        public KernelDatabase(CLAPI instance, string folderName, TypeEnums.DataTypes genDataType)
        {
            GenDataType = KernelParameter.GetDataString(genDataType);
            if (!CLAPI.DirectoryExists(folderName))
            {
                throw new Exception(folderName);
            }

            this.folderName = folderName;
            LoadedKernels   = new Dictionary <string, CLKernel>();
            Initialize(instance);
        }
示例#2
0
        /// <summary>
        /// returns the Correct DataType string for the equivalent in the CL Library
        /// </summary>
        /// <param name="type"></param>
        /// <returns>The keyword for OpenCL as string</returns>
        public static string GetDataString(TypeEnums.DataTypes type)
        {
            foreach (Tuple <string, float, TypeEnums.DataTypes> dataTypePair in DataTypePairs)
            {
                if (dataTypePair.Item3 == type)
                {
                    return(dataTypePair.Item1);
                }
            }

            return("UNKNOWN");
        }
示例#3
0
        /// <summary>
        /// Public constructor
        /// </summary>
        /// <param name="folderName">Folder name where the kernels are located</param>
        /// <param name="genDataType">The DataTypes used to compile the FL Database</param>
        public KernelDatabase(string folderName, TypeEnums.DataTypes genDataType)
        {
            GenDataType = KernelParameter.GetDataString(genDataType);
            if (!Directory.Exists(folderName))
            {
                Logger.Crash(new InvalidFolderPathException(folderName), true);

                Logger.Log("Creating Folder: " + folderName, DebugChannel.Warning | DebugChannel.OpenCL, 10);

                Directory.CreateDirectory(folderName);
            }

            _folderName   = folderName;
            LoadedKernels = new Dictionary <string, CLKernel>();
            Initialize();
        }