-
Notifications
You must be signed in to change notification settings - Fork 48
more compute intensive hello world example #1872
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
base: main
Are you sure you want to change the base?
Conversation
defddbc to
3e4a3d3
Compare
f23eb9f to
67badfa
Compare
README.md
Outdated
| for i in range(num_iterations): | ||
| a = np.random.rand(matrix_size, matrix_size) | ||
| b = np.random.rand(matrix_size, matrix_size) | ||
|
|
||
| product = a @ b | ||
| iteration_sum = np.sum(product) | ||
| total_sum += iteration_sum | ||
|
|
||
| print(f"Iteration {i+1}: sum={iteration_sum:.3f}") | ||
| time.sleep(1) |
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.
down for a slightly more involved hello world that numpy to showcase the compute/image, but I do think the content here in the for loop is not super necessary and the focus should be on the kt portion. thoughts on cutting it down more simply? e.g.
for i in range(num_iterations):
total_sum += np.rand()
print(f"Iteration {i+1}: sum={iteration_sum:.3f}")
time.sleep(1)
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.
i agree the code isn't so meaningful, the only benefit is that it allows us to stream utilization metrics back.. so i'm a little torn
carolineechen
left a comment
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.
left a comment on potentially simplifying the numpy function. but don't feel super strongly if you think leaving it as is showcases the use case better
67badfa to
615f6ae
Compare
| def simulate_workload(num_iterations: int = 5, vector_size: int = 10000): | ||
| import numpy as np | ||
|
|
||
| return sum(np.dot(np.random.rand(vector_size), np.random.rand(vector_size)) for _ in range(num_iterations)) |
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.
@carolineechen better?
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.
yup, can we also pass in new (kw)args to the remote_fn call below to also show that the function takes in args just as the original python function does?

No description provided.