예제 #1
0
        // Setup OpenClEnvironment
        public OpenClWithGCN(bool EnableStopwatch = false)
        {
            if (EnableStopwatch)
                sw = Stopwatch.StartNew();

            env = OpenClEnvironment.InitializeWithDefaults();
        }
예제 #2
0
        /// <summary>Initialize with an existing OpenClEnvironment.</summary>
        public OpenClWithGCN(OpenClEnvironment env, bool EnableStopwatch = false)
        {
            if (EnableStopwatch)
                sw = Stopwatch.StartNew();

            this.env = env;
        }
예제 #3
0
        // Setup OpenClEnvironment
        public OpenClWithGCN(bool EnableStopwatch = false)
        {
            if (EnableStopwatch)
            {
                sw = Stopwatch.StartNew();
            }

            env = OpenClEnvironment.InitializeWithDefaults();
        }
예제 #4
0
        /// <summary> Setup an default environment with to work with.  (optional)</summary>
        public static OpenClEnvironment InitializeWithDefaults()
        {
            OpenClEnvironment env = null;

            // lets make sure we only include AMD platforms here
            Platform[] platforms = Platform.GetPlatforms().Where(
                t => t.Name.Contains("Advanced Micro Devices") || t.Name.Contains("AMD")).ToArray();

            if (platforms.Count() > 0)
            {
                env = new OpenClEnvironment();
                env.platforms = platforms;
                env.devices = env.platforms[0].GetDevices(DeviceType.Gpu); //todo: get rid of[0]
                env.context = Context.Create(env.devices);
                env.cmdQueue = env.context.CreateCommandQueue(env.devices[0]);
            }
            return env;
        }
예제 #5
0
        /// <summary> Setup an default environment with to work with.  (optional)</summary>
        public static OpenClEnvironment InitializeWithDefaults()
        {
            OpenClEnvironment env = null;

            // lets make sure we only include AMD platforms here
            Platform[] platforms = Platform.GetPlatforms().Where(
                t => t.Name.Contains("Advanced Micro Devices") || t.Name.Contains("AMD")).ToArray();

            if (platforms.Count() > 0)
            {
                env = new OpenClEnvironment();
                env.platforms = platforms;
                env.devices = env.platforms[0].GetDevices(DeviceType.Gpu); //todo: get rid of[0]
                env.context = Context.Create(env.devices);
                env.cmdQueue = env.context.CreateCommandQueue(env.devices[0]);
            }
            return env;

        }