コード例 #1
0
ファイル: BLAS1_1D.cs プロジェクト: uzbekdev1/CUDAfy.NET-1
        public void TestMAXInVectorWhole()
        {
            CreateRandomData(_hostInput1);
            _gpu.CopyToDevice(_hostInput1, _devPtr1);
            int   index = _blas.IAMAX(_devPtr1);
            float max   = _hostInput1.Max();

            Assert.AreEqual(max, _hostInput1[index <= 0 ? 0 : index - 1]); // 1-indexed
        }
コード例 #2
0
ファイル: BLAS1_2D.cs プロジェクト: uzbekdev1/CUDAfy.NET-1
        public void TestMAXInVectorWhole()
        {
            CreateRandomData(_hostInput);
            DebugBuffer(_hostInput);
            _gpu.CopyToDevice(_hostInput, _devPtr);
            float[] castDevPtr = _gpu.Cast(_devPtr, ciTOTAL);
            int     index      = _blas.IAMAX(castDevPtr);
            var     list       = _hostInput.Cast <float>().ToList();
            float   max        = list.Max();

            Debug.WriteLine(index);
            Debug.WriteLine(max);
            Assert.AreEqual(max, list[index - 1]); // 1-indexed
        }