Esempio n. 1
0
        public static void Run(int size, double density)
        {
            try
            {
                Console.WriteLine("Running CUDA tests (Double) ... [N = {0}]", size);
                Console.WriteLine();

                var A = Generate.Random(size, size, density);
                var B = Generate.RandomSymmetric(size, density, true);

                // Initialize CUDA device.
                Cuda.Initialize();

                RunCudaTest(A, B);

                Console.WriteLine();
            }
            catch (CudaException e)
            {
                Console.WriteLine(e.Result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Esempio n. 2
0
        public Engine(Dictionary <RenderingPaneHwndDescription> renderingPaneHwndDescriptions)
        {
            Console.WriteLine("\nMojo initializing...\n");

            D3D11.Initialize(out mDxgiFactory, out mD3D11Device);
            Cuda.Initialize(mD3D11Device);
            Thrust.Initialize();

            Segmenter = new Segmenter
            {
                Interop = new Interop.Segmenter(mD3D11Device, mD3D11Device.ImmediateContext, Constants.Parameters)
            };

            Viewers = new Dictionary <Viewer>
            {
                {
                    "Segmenter2D", new Viewer
                    {
                        RenderingPane = new RenderingPane(mDxgiFactory,
                                                          mD3D11Device,
                                                          mD3D11Device.ImmediateContext,
                                                          renderingPaneHwndDescriptions.Get("Segmenter2D").Handle,
                                                          renderingPaneHwndDescriptions.Get("Segmenter2D").Width,
                                                          renderingPaneHwndDescriptions.Get("Segmenter2D").Height,
                                                          new Segmenter2D.RenderingStrategy(mD3D11Device,
                                                                                            mD3D11Device.ImmediateContext,
                                                                                            Segmenter)),
                        UserInputHandler = new Segmenter2D.UserInputHandler(Segmenter)
                    }
                }
            };
        }