-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add operations/arguments to local CuPy array benchmark #524
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
015a0ea
Add cross product, sum, mean operations
charlesbluca 84703ec
Resorting packages
charlesbluca c68fed9
Add option to output JSON
charlesbluca 26ed1ce
Add slice operation
charlesbluca 58c2cc9
Remove nonexistent cross operation
charlesbluca ff03dec
Clean up JSON output
charlesbluca b1b45e5
Move json import to top of file
charlesbluca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,24 @@ async def _run(client, args): | |
func_args = (x,) | ||
|
||
func = lambda x: np.fft.fft(x, axis=0) | ||
elif args.operation == "sum": | ||
x = rs.random((args.size, args.size), chunks=args.chunk_size).persist() | ||
await wait(x) | ||
func_args = (x,) | ||
|
||
func = lambda x: x.sum() | ||
elif args.operation == "mean": | ||
x = rs.random((args.size, args.size), chunks=args.chunk_size).persist() | ||
await wait(x) | ||
func_args = (x,) | ||
|
||
func = lambda x: x.mean() | ||
elif args.operation == "slice": | ||
x = rs.random((args.size, args.size), chunks=args.chunk_size).persist() | ||
await wait(x) | ||
func_args = (x,) | ||
|
||
func = lambda x: x[::3].copy() | ||
|
||
shape = x.shape | ||
chunksize = x.chunksize | ||
|
@@ -179,6 +197,40 @@ async def run(args): | |
) | ||
print(fmt % (d1, d2, bw[0], bw[1], bw[2], total_nbytes[(d1, d2)])) | ||
|
||
if args.benchmark_json: | ||
import json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! Also going to change this to |
||
|
||
d = { | ||
"operation": args.operation, | ||
"size": args.size, | ||
"second_size": args.second_size, | ||
"chunk_size": args.chunk_size, | ||
"compute_size": size, | ||
"compute_chunk_size": chunksize, | ||
"ignore_size": format_bytes(args.ignore_size), | ||
"protocol": args.protocol, | ||
"devs": args.devs, | ||
"threads_per_worker": args.threads_per_worker, | ||
"times": [ | ||
{"wall_clock": took, "npartitions": npartitions} | ||
for (took, npartitions) in took_list | ||
], | ||
"bandwidths": { | ||
f"({d1},{d2})" | ||
if args.multi_node or args.sched_addr | ||
else "(%02d,%02d)" | ||
% (d1, d2): { | ||
"25%": bw[0], | ||
"50%": bw[1], | ||
"75%": bw[2], | ||
"total_nbytes": total_nbytes[(d1, d2)], | ||
} | ||
for (d1, d2), bw in sorted(bandwidths.items()) | ||
}, | ||
} | ||
with open(args.benchmark_json, "w") as fp: | ||
json.dump(d, fp, indent=2) | ||
|
||
# An SSHCluster will not automatically shut down, we have to | ||
# ensure it does. | ||
if args.multi_node: | ||
|
@@ -206,29 +258,40 @@ def parse_args(): | |
"choices": ["cpu", "gpu"], | ||
"default": "gpu", | ||
"type": str, | ||
"help": "Do merge with GPU or CPU dataframes", | ||
"help": "Do merge with GPU or CPU dataframes.", | ||
}, | ||
{ | ||
"name": ["-o", "--operation",], | ||
"default": "transpose_sum", | ||
"type": str, | ||
"help": "The operation to run, valid options are: " | ||
"'transpose_sum' (default), 'dot', 'fft', 'svd'.", | ||
"'transpose_sum' (default), 'dot', 'fft', 'svd', 'sum', 'mean', 'slice'.", | ||
}, | ||
{ | ||
"name": ["-c", "--chunk-size",], | ||
"default": "2500", | ||
"type": int, | ||
"help": "Chunk size (default 2500)", | ||
"help": "Chunk size (default 2500).", | ||
}, | ||
{ | ||
"name": "--ignore-size", | ||
"default": "1 MiB", | ||
"metavar": "nbytes", | ||
"type": parse_bytes, | ||
"help": "Ignore messages smaller than this (default '1 MB')", | ||
"help": "Ignore messages smaller than this (default '1 MB').", | ||
}, | ||
{ | ||
"name": "--runs", | ||
"default": 3, | ||
"type": int, | ||
"help": "Number of runs (default 3).", | ||
}, | ||
{ | ||
"name": "--benchmark-json", | ||
"default": None, | ||
"type": str, | ||
"help": "Dump a JSON report of benchmarks (optional).", | ||
}, | ||
{"name": "--runs", "default": 3, "type": int, "help": "Number of runs",}, | ||
] | ||
|
||
return parse_benchmark_args( | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.