Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            CUDA.Enabled = hasCUDA;
            AVX.Enabled = hasAVX;
            AVX2.Enabled = hasAVX2;
            AVX512.Enabled = hasAVX512;

            if (hasCUDA)
            {
                DisplayGPUName();
            }

            ManagementObjectSearcher mos = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor");
            foreach (ManagementObject mo in mos.Get())
            {
                string cpuName = (string)mo["Name"];
                label4.Text = cpuName.Split('@')[0];
            }

            if (hasCUDA) runnerCUDA = HybRunner.Cuda("MandelbrotRenderer_CUDA.dll").SetDistrib(32, 32, 16, 16, 1, 0);
            if (hasAVX) runnerAVX = HybRunner.AVX("MandelbrotRenderer_AVX.dll").SetDistrib(Environment.ProcessorCount, 32);
            if (hasAVX2) runnerAVX2 = HybRunner.AVX("MandelbrotRenderer_AVX2.dll").SetDistrib(Environment.ProcessorCount, 32);
            if (hasAVX512) runnerAVX512 = HybRunner.AVX512("MandelbrotRenderer_AVX512.dll").SetDistrib(Environment.ProcessorCount, 32);

            if (hasCUDA) MandelbrotCUDA = runnerCUDA.Wrap(new Mandelbrot());
            if (hasAVX) MandelbrotAVX = runnerAVX.Wrap(new Mandelbrot());
            if (hasAVX2) MandelbrotAVX2 = runnerAVX2.Wrap(new Mandelbrot());
            if (hasAVX512) MandelbrotAVX512 = runnerAVX512.Wrap(new Mandelbrot());

            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            image = new Bitmap(W, H, PixelFormat.Format32bppRgb);
            Rendering.Image = image;
            render();
            Rendering.MouseDown += (s, e) => { ImageOnMouseDown(e); };
            Rendering.MouseMove += (s, e)=>  { ImageOnMouseMove(e); };

        }