Example #1
0
        static void Main(string[] args)
        {
            try
            {
                CudafyModes.Target        = eGPUType.Cuda;
                CudafyModes.DeviceId      = 0;
                CudafyTranslator.Language = CudafyModes.Target == eGPUType.OpenCL ? eLanguage.OpenCL : eLanguage.Cuda;

                Console.WriteLine("===================================\n          CudafyExamples\n         Hybrid DSP Systems\nCopyright © Hybrid DSP Systems 2011\n===================================");
                Console.WriteLine("\n* VS 2019 & .NET 4.8\n* optimization by RapidDev\n");

                ConsoleHeader(1, "ArrayBasicIndexing");
                ArrayBasicIndexing.Execute();
                ConsoleHeader(2, "ArrayMultidimensions");
                ArrayMultidimensions.Execute();

                if (CudafyModes.Target != eGPUType.OpenCL)
                {
                    ConsoleHeader(3, "Class examples");
                    CudafyClassExamples.Execute();
                    ConsoleHeader(4, "SIMDFunctions");
                    SIMDFunctions.Execute();
                    ConsoleHeader(5, "GlobalArrays");
                    GlobalArrays.Execute();
                    ConsoleHeader(6, "ComplexNumbersD");
                    ComplexNumbersD.Execute();
                    ConsoleHeader(7, "ComplexNumbersF");
                    ComplexNumbersF.Execute();
                    ConsoleHeader(8, "DummyFunctions");
                    DummyFunctions.Execute();

                    ConsoleHeader(9, "TextInsertion");
                    TextInsertion.Execute();


                    ConsoleHeader(10, "Voting.Ballot");
                    Voting.Ballot.Execute();
                    ConsoleHeader(11, "Voting.SyncThreadCount");
                    Voting.SyncThreadCount.Execute();

                    ConsoleHeader(12, "FinanceTest");
                    FinanceTest.Execute();
                    ConsoleHeader(13, "Timing");
                    Timing.Execute();
                    ConsoleHeader(14, "PinnedAsyncIO");
                    PinnedAsyncIO.Execute();
                }
                Console.WriteLine("Done!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            try
            {
                CudafyModes.Target        = eGPUType.OpenCL;
                CudafyModes.DeviceId      = 0;
                CudafyTranslator.Language = CudafyModes.Target == eGPUType.OpenCL ? eLanguage.OpenCL : eLanguage.Cuda;

                Console.WriteLine("\r\nArrayBasicIndexing");
                ArrayBasicIndexing.Execute();
                Console.WriteLine("\r\nArrayMultidimensions");
                ArrayMultidimensions.Execute();

                if (CudafyModes.Target != eGPUType.OpenCL)
                {
                    Console.WriteLine("\r\nClass examples");
                    CudafyClassExamples.Execute();
                    Console.WriteLine("\r\nSIMDFunctions");
                    SIMDFunctions.Execute();
                    Console.WriteLine("\r\nGlobalArrays");
                    GlobalArrays.Execute();
                    Console.WriteLine("\r\nComplexNumbersD");
                    ComplexNumbersD.Execute();
                    Console.WriteLine("\r\nComplexNumbersF");
                    ComplexNumbersF.Execute();
                    Console.WriteLine("\r\nDummyFunctions");
                    DummyFunctions.Execute();

                    Console.WriteLine("\r\nTextInsertion");
                    TextInsertion.Execute();


                    Console.WriteLine("\r\nVoting.Ballot");
                    Voting.Ballot.Execute();
                    Console.WriteLine("\r\nVoting.SyncThreadCount");
                    Voting.SyncThreadCount.Execute();

                    Console.WriteLine("\r\nFinanceTest");
                    FinanceTest.Execute();
                    Console.WriteLine("\r\nTiming");
                    Timing.Execute();
                    Console.WriteLine("\r\nPinnedAsyncIO");
                    PinnedAsyncIO.Execute();
                }
                Console.WriteLine("Done!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            Console.ReadKey();
        }