Skip to content

Commit

Permalink
Merge pull request #2327 from kif/benchmark_with_device_selection
Browse files Browse the repository at this point in the history
Offer the selection of individual OpenCL devices
  • Loading branch information
kif authored Nov 12, 2024
2 parents dc9438a + 6f40d3a commit 1033b37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ authors:
given-names: Frederic Emmanuel
affiliation: Soleil
- family-names: Massahud
given-names: Emily
given-names: Emily
affiliation: ANSTO
- family-names: Payno
given-names: Henri
Expand All @@ -50,7 +50,7 @@ authors:
affiliation: ESRF
- family-names: Paleo
given-names: Pierre
affiliation: ESRF
affiliation: ESRF
- family-names: Faure
given-names: Bertrand
affiliation: Xenocs
Expand All @@ -64,7 +64,7 @@ authors:
given-names: Christopher J.
affiliation: NSLS-II
- family-names: Hopkins
given-names: Jesse B.
given-names: Jesse B.
orcid: https://orcid.org/0000-0001-8554-8072
affiliation: APS
- family-names: Pascal
Expand Down
25 changes: 14 additions & 11 deletions src/pyFAI/app/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "27/09/2024"
__date__ = "08/11/2024"
__status__ = "development"

from argparse import ArgumentParser
Expand Down Expand Up @@ -91,14 +91,12 @@ def main(args=None):
parser.add_argument("--no-1dimention",
action="store_false", dest="onedim", default=True,
help="Do not benchmark algorithms for 1D-regrouping")

parser.add_argument("-m", "--memprof",
action="store_true", dest="memprof", default=False,
help="Perfrom memory profiling (Linux only)")
parser.add_argument("-r", "--repeat",
dest="repeat", default=1, type=int,
help="Repeat each measurement x times to take the best")

parser.add_argument("-ps", "--pixelsplit",
dest="pixelsplit", default=["bbox"], type=str, nargs="+",
help="Benchmark using specific pixel splitting protocols: no, bbox, pseudo, full, all",)
Expand All @@ -108,11 +106,12 @@ def main(args=None):
parser.add_argument("-i", "--implementation",
dest="implementation", default=["cython", "opencl"], type=str, nargs="+",
help="Benchmark using specific algorithm implementations: python, cython, opencl, all")

parser.add_argument("-f", "--function",
dest="function", default="ng", type=str,
help="Benchmark legacy (legacy), engine function (ng), or both (all)")

parser.add_argument("-o", "--devices",
dest="devices", default=None, type=str,
help="Comma separated list of paires of OpenCL platform:device ids like `0:1,1:0` to benchmark")
parser.add_argument("--all",
action="store_true", dest="all", default=False,
help="Benchmark using all available methods and devices")
Expand All @@ -122,12 +121,16 @@ def main(args=None):
pyFAI_logger.setLevel(logging.DEBUG)

devices = []
if options.opencl_cpu:
devices.append("cpu")
if options.opencl_gpu:
devices.append("gpu")
if options.opencl_acc:
devices.append("acc")
if options.devices:
for pair in options.devices.split(","):
devices.append(pair.split(":"))
else:
if options.opencl_cpu:
devices.append("cpu")
if options.opencl_gpu:
devices.append("gpu")
if options.opencl_acc:
devices.append("acc")

benchmark.run(number=options.number,
repeat=options.repeat,
Expand Down

0 comments on commit 1033b37

Please sign in to comment.