|
46 | 46 |
|
47 | 47 | [<MinColumn; MaxColumn>] |
48 | 48 | [<Config(typeof<Config>)>] |
49 | | -[<SimpleJob(RunStrategy.Monitoring, targetCount=3)>] |
| 49 | +[<SimpleJob(RunStrategy.Monitoring, targetCount=1)>] |
50 | 50 | type EWiseAddBenchmarks4Float32() = |
51 | 51 | let mutable leftCOO = Unchecked.defaultof<Matrix<float32>> |
52 | 52 | let mutable rightCOO = Unchecked.defaultof<Matrix<float32>> |
@@ -92,23 +92,37 @@ type EWiseAddBenchmarks4Float32() = |
92 | 92 |
|
93 | 93 | [<IterationSetup(Target="EWiseAdditionCOO")>] |
94 | 94 | member this.BuildCOO() = |
| 95 | + let leftRows = Array.zeroCreate<int> firstMatrix.Rows.Length |
| 96 | + let leftCols = Array.zeroCreate<int> firstMatrix.Columns.Length |
| 97 | + let leftVals = Array.zeroCreate<float32> firstMatrix.Values.Length |
| 98 | + Array.blit firstMatrix.Rows 0 leftRows 0 firstMatrix.Rows.Length |
| 99 | + Array.blit firstMatrix.Columns 0 leftCols 0 firstMatrix.Columns.Length |
| 100 | + Array.blit firstMatrix.Values 0 leftVals 0 firstMatrix.Values.Length |
| 101 | + |
95 | 102 | leftCOO <- |
96 | 103 | Matrix.Build<float32>( |
97 | 104 | firstMatrix.RowCount, |
98 | 105 | firstMatrix.ColumnCount, |
99 | | - firstMatrix.Rows, |
100 | | - firstMatrix.Columns, |
101 | | - firstMatrix.Values, |
| 106 | + leftRows, |
| 107 | + leftCols, |
| 108 | + leftVals, |
102 | 109 | COO |
103 | 110 | ) |
104 | 111 |
|
| 112 | + let rightRows = Array.zeroCreate<int> secondMatrix.Rows.Length |
| 113 | + let rightCols = Array.zeroCreate<int> secondMatrix.Columns.Length |
| 114 | + let rightVals = Array.zeroCreate<float32> secondMatrix.Values.Length |
| 115 | + Array.blit secondMatrix.Rows 0 rightRows 0 secondMatrix.Rows.Length |
| 116 | + Array.blit secondMatrix.Columns 0 rightCols 0 secondMatrix.Columns.Length |
| 117 | + Array.blit secondMatrix.Values 0 rightVals 0 secondMatrix.Values.Length |
| 118 | + |
105 | 119 | rightCOO <- |
106 | 120 | Matrix.Build<float32>( |
107 | 121 | secondMatrix.RowCount, |
108 | 122 | secondMatrix.ColumnCount, |
109 | | - secondMatrix.Rows, |
110 | | - secondMatrix.Columns, |
111 | | - secondMatrix.Values, |
| 123 | + rightRows, |
| 124 | + rightCols, |
| 125 | + rightVals, |
112 | 126 | COO |
113 | 127 | ) |
114 | 128 |
|
@@ -238,9 +252,3 @@ type EWiseAddBenchmarks4Float32() = |
238 | 252 | let deviceType = Cl.GetDeviceInfo(device, DeviceInfo.Type, &e).CastTo<DeviceType>() |
239 | 253 | OpenCLEvaluationContext(platformName, deviceType) |> ClContext |
240 | 254 | ) |
241 | | - |
242 | | -// не уверен, что на каждой итерации трансфер данных снова происходит |
243 | | -// тк ссылка на массивы присваивается одна и та же |
244 | | -// надо бы каждый раз в iterationSetup делать глубокую копию исходных массивов |
245 | | - |
246 | | -// нужен ToString для OpenCLEvaliationContext -- печатал бы DeviceInfo.Name |
|
0 commit comments