Esempio n. 1
0
 void SelectBackend(PlatformType platform, BackendType backend)
 {
     Platforms[platform] = new ProjectConfigPlatform()
     {
         Backend = backend
     };
 }
Esempio n. 2
0
 public bool ConvertDB(BackendType toBackend)
 {
     if (toBackend == Backend)
     {
         return(false);
     }
     else if (toBackend == BackendType.MySQL)
     {
         IDataManager database = new MySQLDatabaseManager();
         if (!database.IsLoaded)
         {
             return(false);
         }
         foreach (ShopItem item in Items.Values)
         {
             database.AddItem(ItemType.Item, item);
         }
         foreach (ShopVehicle vehicle in Vehicles.Values)
         {
             database.AddItem(ItemType.Vehicle, vehicle);
         }
         database.Unload();
         database = null;
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
 /// <summary>
 /// Constructs a new generic backend.
 /// </summary>
 /// <param name="context">The context to use.</param>
 /// <param name="backendType">The backend type.</param>
 /// <param name="backendFlags">The backend flags.</param>
 /// <param name="argumentMapper">The argument mapper to use.</param>
 protected Backend(
     Context context,
     BackendType backendType,
     BackendFlags backendFlags,
     ArgumentMapper argumentMapper)
     : base(context, backendType, backendFlags, argumentMapper)
 {
     IntrinsicProvider = context.IntrinsicManager.CreateProvider <TDelegate>(this);
 }
        public ISchemaQuerier GetQuerier(BackendType backendType)
        {
            var querier = this.Queriers.SingleOrDefault(m => m.Backend == backendType);

            if (querier == null)
            {
                throw new NotImplementedException($"No querier for backend type {backendType}");
            }
            return(querier);
        }
        public IConnectionFactory GetConnectionFactory(BackendType backendType)
        {
            var connector = this.Connectors.SingleOrDefault(m => m.Backend == backendType);

            if (connector == null)
            {
                throw new NotImplementedException($"No connection factory for backend type {backendType}");
            }
            return(connector);
        }
        public ISchemaManager GetManager(BackendType backendType)
        {
            var manager = this.Managers.SingleOrDefault(m => m.Backend == backendType);

            if (manager == null)
            {
                throw new NotImplementedException($"No manager backend type  for {backendType}");
            }
            return(new CachedSchemaManager(this.SchemaCache, manager));
        }
Esempio n. 7
0
        public static TensorEngine GetEngine(BackendType backendType = BackendType.Default)
        {
            switch (backendType)
            {
            case BackendType.Default:
                return(EngineCache <DefaultEngine> .Value);

            default:
                throw new ArgumentOutOfRangeException(nameof(backendType), backendType, null);
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Constructs a new generic backend.
 /// </summary>
 /// <param name="context">The context to use.</param>
 /// <param name="capabilities">The supported capabilities.</param>
 /// <param name="backendType">The backend type.</param>
 /// <param name="argumentMapper">The argument mapper to use.</param>
 protected CodeGeneratorBackend(
     Context context,
     CapabilityContext capabilities,
     BackendType backendType,
     ArgumentMapper argumentMapper)
     : base(
         context,
         capabilities,
         backendType,
         argumentMapper)
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Constructs a new generic backend.
 /// </summary>
 /// <param name="context">The context to use.</param>
 /// <param name="backendType">The backend type.</param>
 /// <param name="backendFlags">The backend flags.</param>
 /// <param name="argumentMapper">The argument mapper to use.</param>
 protected CodeGeneratorBackend(
     Context context,
     BackendType backendType,
     BackendFlags backendFlags,
     ArgumentMapper argumentMapper)
     : base(
         context,
         backendType,
         backendFlags,
         argumentMapper)
 {
 }
Esempio n. 10
0
 /// <summary>
 /// Constructs a new generic backend.
 /// </summary>
 /// <param name="context">The context to use.</param>
 /// <param name="backendType">The backend type.</param>
 /// <param name="backendFlags">The backend flags.</param>
 /// <param name="abi">The current ABI.</param>
 /// <param name="argumentMapperProvider">The provider for argument mappers.</param>
 protected CodeGeneratorBackend(
     Context context,
     BackendType backendType,
     BackendFlags backendFlags,
     ABI abi,
     Func <ABI, ArgumentMapper> argumentMapperProvider)
     : base(
         context,
         backendType,
         backendFlags,
         abi,
         argumentMapperProvider)
 {
 }
Esempio n. 11
0
        void SelectProjectConfig(Assembly fromAssembly, PlatformType forPlatform)
        {
            SelectedPlatform = forPlatform;

            //try loading ProjectConfig from the specified assembly; fallback to this assembly (use the default project config)
            var projectConfigType = fromAssembly.GetType("ProjectConfig", false);

            if (projectConfigType == null)
            {
                projectConfigType = typeof(ProjectConfig);
            }

            //now, we better have a project config
            ProjectConfig = (ProjectConfig)Activator.CreateInstance(projectConfigType);

            //choose the backend for the current platform
            SelectedBackend = ProjectConfig.Platforms[forPlatform].Backend;

            //try to set the default content connector
            //user can override it in a minute, in case that's important
            Type runtimeConnectorType  = null;
            Type pipelineConnectorType = null;

            switch (SelectedBackend)
            {
            case BackendType.SDL:
                runtimeConnectorType  = AppDomain.CurrentDomain.Load("MTS.Engine.SDL").GetType("MTS.Engine.SDL.DefaultRuntimeConnector", false);
                pipelineConnectorType = AppDomain.CurrentDomain.Load("MTS.Engine.SDL").GetType("MTS.Engine.SDL.DefaultPipelineConnector", false);
                break;

            case BackendType.Switch:
                runtimeConnectorType  = AppDomain.CurrentDomain.Load("MTS.Engine.Switch").GetType("MTS.Engine.Switch.DefaultRuntimeConnector", false);
                pipelineConnectorType = AppDomain.CurrentDomain.Load("MTS.Engine.Switch").GetType("MTS.Engine.Switch.DefaultPipelineConnector", false);
                break;
            }

            //unless we're the oven, we need a runtime connector
            if (!ForOven && runtimeConnectorType != null)
            {
                RuntimeConnector = (RuntimeConnectorBase)Activator.CreateInstance(runtimeConnectorType);
            }

            //if we're the oven or proto, we need a pipeline connector (probably)
            if ((ForOven || forPlatform == PlatformType.Proto) && pipelineConnectorType != null)
            {
                //default pipeline connector needs these.. really this assembly should be referencing that one, but it would be circular
                Assembly.Load("MTS.Engine.Pipeline");
                PipelineConnector = (PipelineConnectorBase)Activator.CreateInstance(pipelineConnectorType);
            }
        }
Esempio n. 12
0
 /// <summary>
 /// Constructs a new implementation.
 /// </summary>
 /// <param name="backendType">The main backend type.</param>
 /// <param name="handlerType">The associated target handler type.</param>
 /// <param name="methodName">The target method name (or null).</param>
 /// <param name="mode">The code-generation mode.</param>
 protected IntrinsicImplementation(
     BackendType backendType,
     Type handlerType,
     string methodName,
     IntrinsicImplementationMode mode)
     : this(
         backendType,
         handlerType.GetMethod(
             methodName ?? "Invoke",
             BindingFlags.Public | BindingFlags.NonPublic |
             BindingFlags.Static | BindingFlags.Instance),
         mode)
 {
 }
Esempio n. 13
0
 /// <summary>
 /// Constructs a new implementation.
 /// </summary>
 /// <param name="backendType">The main backend type.</param>
 /// <param name="targetMethod">The associated target method.</param>
 /// <param name="mode">The code-generation mode.</param>
 protected IntrinsicImplementation(
     BackendType backendType,
     MethodInfo targetMethod,
     IntrinsicImplementationMode mode)
 {
     BackendType  = backendType;
     TargetMethod = targetMethod ?? throw new NotSupportedException(
                              string.Format(ErrorMessages.NotSupportedIntrinsic, GetType()));
     if (TargetMethod.IsGenericMethod)
     {
         TargetMethod = TargetMethod.GetGenericMethodDefinition();
     }
     Mode = mode;
 }
Esempio n. 14
0
        private ParameterEngine(IBackend backend)
        {
            if (backend == null)
            {
                throw new MSDataLayerException("The backend should not to be null.");
            }

            this.Backend     = backend;
            this.BackendType = backend.BackendType;

            if (this.BackendType != BackendType.SQL && this.BackendType != BackendType.Odbc && this.BackendType != BackendType.OleDb && this.BackendType != BackendType.Oracle)
            {
                throw new MSDataLayerException("This type of backend is not supported by parameter engine.");
            }
        }
Esempio n. 15
0
        public bool ConvertDB(BackendType toBackend)
        {
            bool result = false;

            if (toBackend == Backend)
            {
                return(result);
            }
            else if (toBackend == BackendType.XML)
            {
                IDataManager database = new XMLDatabaseManager();
                if (!database.IsLoaded)
                {
                    return(result);
                }
                try
                {
                    Dictionary <ushort, ShopObject> items    = GetAllItems(ItemType.Item);
                    Dictionary <ushort, ShopObject> vehicles = GetAllItems(ItemType.Vehicle);

                    foreach (ShopObject item in items.Values)
                    {
                        database.AddItem(ItemType.Item, item);
                    }
                    foreach (ShopObject vehicle in vehicles.Values)
                    {
                        database.AddItem(ItemType.Vehicle, vehicle);
                    }
                    result = true;
                }
                catch (MySqlException ex)
                {
                    HandleException(ex);
                }
                finally
                {
                    if (database.IsLoaded)
                    {
                        database.Unload();
                    }
                    database = null;
                }
            }
            return(result);
        }
Esempio n. 16
0
        public static ITensorEngine GetEngine(BackendType backendType = BackendType.SIMD)
        {
            if (!cache.ContainsKey(backendType))
            {
                switch (backendType)
                {
                case BackendType.MKL:
                case BackendType.SIMD:
                    cache[backendType] = new SimdEngine();
                    break;

                case BackendType.ArrayFire:
                    cache[backendType] = new ArrayFireEngine();
                    break;

                default:
                    throw new NotImplementedException($"Storage {backendType} not found.");
                }
            }

            return(cache[backendType]);
        }
Esempio n. 17
0
 /// <summary>
 /// Resolves the associated intrinsic container for the given backend type.
 /// </summary>
 /// <param name="backendType">The backend type.</param>
 /// <returns>The resolved intrinsic container.</returns>
 private BackendContainer this[BackendType backendType] =>
 containers[(int)backendType];
Esempio n. 18
0
 public static void SetBackend(BackendType backend)
 {
     Internal.VERIFY(AFBackend.af_set_backend((BackendType)backend));
 }
Esempio n. 19
0
 public DataAccess(BackendType backendType)
 {
     this.backEndType = backendType;
 }
Esempio n. 20
0
 public static extern af_err af_set_backend(BackendType bknd);
Esempio n. 21
0
 public static extern af_err af_get_backend_id(out BackendType backend, IntPtr array_in);
Esempio n. 22
0
 void SetBackend(BackendType backend)
 {
 }
Esempio n. 23
0
 public static extern af_err af_get_active_backend(out BackendType backend);