/// <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="genDataVectorType">The DataVectorTypes used to compile the FL Database</param> public KernelDatabase(DataVectorTypes genDataVectorType) : base( OpenCLDebugConfig.Settings, "DB" ) { GenDataType = KernelParameter.GetDataString(genDataVectorType); loadedPrograms = new List <CLProgram>(); loadedKernels = new Dictionary <string, CLKernel>(); }
public FlMultiThreadScriptRunner( Action onFinishQueueCallback, DataVectorTypes dataVectorTypes = DataVectorTypes.Uchar1, string kernelFolder = "resources/kernel") : base( CLAPI .GetInstance(), dataVectorTypes, kernelFolder ) { OnFinishQueue = onFinishQueueCallback; }
/// <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(DataVectorTypes type) { foreach (Tuple <string, float, DataVectorTypes> dataTypePair in DataTypePairs) { if (dataTypePair.Item3 == type) { return(dataTypePair.Item1); } } return("UNKNOWN"); }
public FLScriptRunner(CLAPI instance, DataVectorTypes dataVectorTypes = DataVectorTypes.Uchar1, string kernelFolder = "resources/kernel") { Db = new KernelDatabase(instance, kernelFolder, dataVectorTypes); InstructionSet = FLInstructionSet.CreateWithBuiltInTypes(Db); BufferCreator = BufferCreator.CreateWithBuiltInTypes(); ProgramChecks = FLProgramCheckBuilder.CreateDefaultCheckBuilder(InstructionSet, BufferCreator); Parser = new FLParser(InstructionSet, BufferCreator); ProgramChecks.Attach(Parser, true); Instance = instance; ProcessQueue = new Queue <FlScriptExecutionContext>(); }
/// <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="genDataVectorType">The DataVectorTypes used to compile the FL Database</param> public KernelDatabase(CLAPI instance, string folderName, DataVectorTypes genDataVectorType) : base( OpenCLDebugConfig.Settings, "DB" ) { GenDataType = KernelParameter.GetDataString(genDataVectorType); loadedPrograms = new List <CLProgram>(); loadedKernels = new Dictionary <string, CLKernel>(); if (Directory.Exists(folderName)) { LoadFolder(instance, folderName); } }
public static string[] FindFunctions(string source, DataVectorTypes returnType, string[] prefixes) { return(FindFunctions(source, prefixes, KernelParameter.GetDataString(returnType))); }
private bool CheckParameter(KernelParameter param, string name, bool isArray, int id, DataVectorTypes type, MemoryScope scope) { return(param.IsArray == isArray && param.DataType == type && param.Id == id && param.MemScope == scope && param.Name == name); }