vtk-m/benchmarking
Kenneth Moreland 2945813755 Removed ExecutionWholeArray class
`ExecutionWholeArray` is an archaic class in VTK-m that is a thin wrapper
around an array portal. In the early days of VTK-m, this class was used to
transfer whole arrays to the execution environment. However, now the
supported method is to use `WholeArray*` tags in the `ControlSignature` of
a worklet.

Nevertheless, the `WholeArray*` tags caused the array portal transferred to
the worklet to be wrapped inside of an `ExecutionWholeArray` class. This
is unnecessary and can cause confusion about the types of data being used.

Most code is unaffected by this change. Some code that had to work around
the issue of the portal wrapped in another class used the `GetPortal`
method which is no longer needed (for obvious reasons). One extra feature
that `ExecutionWholeArray` had was that it provided an subscript operator
(somewhat incorrectly). Thus, any use of '[..]' to index the array portal
have to be changed to use the `Get` method.
2022-10-27 15:07:41 -06:00
..
BenchmarkArrayTransfer.cxx Make BenchmarkArrayTransfer actually benchmark transfers 2020-08-04 09:16:46 -06:00
BenchmarkAtomicArray.cxx Prefer ArrayHandle::Fill over Algorithm::Fill 2022-01-04 08:50:57 -07:00
BenchmarkCopySpeeds.cxx Implement tbb runtime device configuration and update vtkm to use it 2021-09-20 10:24:23 -06:00
BenchmarkDeviceAdapter.cxx Add changes for supporting Kokkos/HIP 2021-10-01 15:27:00 -04:00
Benchmarker.h Remove brigand from Benchmarker.h 2022-03-08 07:25:08 -07:00
BenchmarkFieldAlgorithms.cxx Removed ExecutionWholeArray class 2022-10-27 15:07:41 -06:00
BenchmarkFilters.cxx Deprecate old filter base classes and supporting classes 2022-09-27 06:52:44 -06:00
BenchmarkInSitu.cxx Add benchmark arguments without leaking memory 2022-10-26 15:16:15 -06:00
BenchmarkODEIntegrators.cxx Remove device compiler dependencies. 2022-08-01 08:00:46 -04:00
BenchmarkRayTracing.cxx Deprecate DynamicCellSet and remove from code 2022-01-04 15:38:18 -07:00
BenchmarkTopologyAlgorithms.cxx Remove testing headers from benchmarking 2021-06-10 09:41:26 -06:00
CMakeLists.txt Add module mechanism 2022-10-26 12:51:05 -06:00
README_insitu.md Switch how InSitu benchmark iterates 2022-09-12 09:24:47 -06:00
README.md benchmarks: pass unparsed args to Google benchmark 2020-04-21 10:52:31 -04:00
vtkm.module Add module mechanism 2022-10-26 12:51:05 -06:00

BENCHMARKING VTK-m

TL;DR

When configuring VTM-m with CMake pass the flag -DVTKm_ENABLE_BENCHMARKS=1 . In the build directory you will see the following binaries:

$ ls bin/Benchmark*
bin/BenchmarkArrayTransfer*  bin/BenchmarkCopySpeeds* bin/BenchmarkFieldAlgorithms*
bin/BenchmarkRayTracing* bin/BenchmarkAtomicArray*    bin/BenchmarkDeviceAdapter*
bin/BenchmarkFilters* bin/BenchmarkTopologyAlgorithms*

Taking as an example BenchmarkArrayTransfer, we can run it as:

$ bin/BenchmarkArrayTransfer -d Any

Parts of this Documents

  1. TL;DR
  2. Devices
  3. Filters
  4. Compare with baseline
  5. Installing compare.py

Choosing devices

Taking as an example BenchmarkArrayTransfer, we can determine in which device we can run it by simply:

$ bin/BenchmarkArrayTransfer
...
Valid devices: "Any" "Serial"
...

Upon the Valid devices you can chose in which device to run the benchmark by:

$ bin/BenchmarkArrayTransfer -d Serial

Run a subset of your benchmarks

VTK-m benchmarks uses Google Benchmarks which allows you to choose a subset of benchmaks by using the flag --benchmark_filter=REGEX

For instance, if you want to run all the benchmarks that writes something you would run:

$ bin/BenchmarkArrayTransfer -d Serial --benchmark_filter='Write'

Note you can list all of the available benchmarks with the option: --benchmark_list_tests.

Compare with baseline

VTM-m ships with a helper script based in Google Benchmarks compare.py named compare-benchmarks.py which lets you compare benchmarks using different devices, filters, and binaries. After building VTM-m it must appear on the bin directory within your build directory.

When running compare-benchmarks.py:

  • You can specify the baseline benchmark binary path and its arguments in --benchmark1=
  • The contender benchmark binary path and its arguments in --benchmark2=
  • Extra options to be passed to compare.py must come after --

Compare between filters

When comparing filters, we only can use one benchmark binary with a single device as shown in the following example:

$ ./compare-benchmarks.py --benchmark1='./BenchmarkArrayTransfer -d Any
--benchmark_filter=1024' --filter1='Read' --filter2=Write -- filters

# It will output something like this:

Benchmark                                                                          Time             CPU      Time Old      Time New       CPU Old       CPU New
---------------------------------------------------------------------------------------------------------------------------------------------------------------
BenchContToExec[Read vs. Write]<F32>/Bytes:1024/manual_time                     +0.2694         +0.2655         18521         23511         18766         23749
BenchExecToCont[Read vs. Write]<F32>/Bytes:1024/manual_time                     +0.0212         +0.0209         25910         26460         26152         26698

Compare between devices

When comparing two benchmarks using two devices use the option benchmark after -- and call ./compare-benchmarks.py as follows:

$ ./compare-benchmarks.py --benchmark1='./BenchmarkArrayTransfer -d Serial
--benchmark_filter=1024' --benchmark2='./BenchmarkArrayTransfer -d Cuda
--benchmark_filter=1024' -- benchmarks


# It will output something like this:

Benchmark                                                              Time             CPU      Time Old      Time New       CPU Old       CPU New
---------------------------------------------------------------------------------------------------------------------------------------------------
BenchContToExecRead<F32>/Bytes:1024/manual_time                     +0.0127         +0.0120         18388         18622         18632         18856
BenchContToExecWrite<F32>/Bytes:1024/manual_time                    +0.0010         +0.0006         23471         23496         23712         23726
BenchContToExecReadWrite<F32>/Bytes:1024/manual_time                -0.0034         -0.0041         26363         26274         26611         26502
BenchRoundTripRead<F32>/Bytes:1024/manual_time                      +0.0055         +0.0056         20635         20748         21172         21291
BenchRoundTripReadWrite<F32>/Bytes:1024/manual_time                 +0.0084         +0.0082         29288         29535         29662         29905
BenchExecToContRead<F32>/Bytes:1024/manual_time                     +0.0025         +0.0021         25883         25947         26122         26178
BenchExecToContWrite<F32>/Bytes:1024/manual_time                    -0.0027         -0.0038         26375         26305         26622         26522
BenchExecToContReadWrite<F32>/Bytes:1024/manual_time                +0.0041         +0.0039         25639         25745         25871         25972

Installing compare-benchmarks.py

compare-benchmarks.py relies on compare.py from Google Benchmarks which also relies in SciPy, you can find instructions here regarding its installation.