// Setup OpenClEnvironment public OpenClWithGCN(bool EnableStopwatch = false) { if (EnableStopwatch) sw = Stopwatch.StartNew(); env = OpenClEnvironment.InitializeWithDefaults(); }
/// <summary>Initialize with an existing OpenClEnvironment.</summary> public OpenClWithGCN(OpenClEnvironment env, bool EnableStopwatch = false) { if (EnableStopwatch) sw = Stopwatch.StartNew(); this.env = env; }
// Setup OpenClEnvironment public OpenClWithGCN(bool EnableStopwatch = false) { if (EnableStopwatch) { sw = Stopwatch.StartNew(); } env = OpenClEnvironment.InitializeWithDefaults(); }
/// <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; }