-
Notifications
You must be signed in to change notification settings - Fork 54
Added HEFT scheduler #35
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
Open
saurav-c
wants to merge
1
commit into
hydro-project:master
Choose a base branch
from
saurav-c:heft
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| import sys | ||
| import time | ||
| import uuid | ||
|
|
||
| import cloudpickle as cp | ||
| import numpy as np | ||
|
|
||
| from cloudburst.shared.reference import CloudburstReference | ||
|
|
||
| def run(cloudburst_client, num_requests, sckt): | ||
| ''' DEFINE AND REGISTER FUNCTIONS ''' | ||
| def preprocess(cloudburst): | ||
| x = 1 | ||
|
|
||
| def mat_square1(cloudburst, mat): | ||
| import numpy as np | ||
| return np.matmul(mat, mat) | ||
|
|
||
| def mat_square2(cloudburst, mat): | ||
| import numpy as np | ||
| return np.matmul(mat, mat) | ||
|
|
||
| def mat_square3(cloudburst, mat): | ||
| import numpy as np | ||
| return np.matmul(mat, mat) | ||
|
|
||
| def mat_square4(cloudburst, mat): | ||
| import numpy as np | ||
| return np.matmul(mat, mat) | ||
|
|
||
| def mat_square5(cloudburst, mat): | ||
| import numpy as np | ||
| return np.matmul(mat, mat) | ||
|
|
||
| def mat_square6(cloudburst, mat): | ||
| import numpy as np | ||
| return np.matmul(mat, mat) | ||
|
|
||
| def average(cloudburst, inp1, inp2, inp3, inp4, inp5, inp6): | ||
| import numpy as np | ||
| inp = [inp1, inp2, inp3, inp4, inp5, inp6] | ||
| return np.mean(inp, axis=0) | ||
|
|
||
| cloud_prep = cloudburst_client.register(preprocess, 'preprocess') | ||
| cloud_mat_sq1 = cloudburst_client.register(mat_square1, 'mat_square1') | ||
| cloud_mat_sq2 = cloudburst_client.register(mat_square2, 'mat_square2') | ||
| cloud_mat_sq3 = cloudburst_client.register(mat_square3, 'mat_square3') | ||
| cloud_mat_sq4 = cloudburst_client.register(mat_square4, 'mat_square4') | ||
| cloud_mat_sq5 = cloudburst_client.register(mat_square5, 'mat_square5') | ||
| cloud_mat_sq6 = cloudburst_client.register(mat_square6, 'mat_square6') | ||
| cloud_avg = cloudburst_client.register(average, 'average') | ||
|
|
||
| if cloud_prep and cloud_mat_sq1 and cloud_mat_sq2 and cloud_mat_sq3 \ | ||
| and cloud_mat_sq4 and cloud_mat_sq5 and cloud_mat_sq6 and cloud_avg: | ||
| print('Successfully registered preprocess, mat_square, and average functions.') | ||
| else: | ||
| sys.exit(1) | ||
|
|
||
| ''' CREATE DAG ''' | ||
| dag_name = 'matrix_mult' | ||
|
|
||
| functions = ['preprocess', 'mat_square1', 'mat_square2', 'mat_square3', 'mat_square4', | ||
| 'mat_square5', 'mat_square6', 'average'] | ||
| connections = [('preprocess', 'mat_square1'), ('preprocess', 'mat_square2'), | ||
| ('preprocess', 'mat_square3'), ('preprocess', 'mat_square4'), | ||
| ('preprocess', 'mat_square5'), ('preprocess', 'mat_square6'), | ||
| ('mat_square1', 'average'), ('mat_square2', 'average'), | ||
| ('mat_square3', 'average'), ('mat_square4', 'average'), | ||
| ('mat_square5', 'average'), ('mat_square6', 'average')] | ||
| success, error = cloudburst_client.register_dag(dag_name, functions, | ||
| connections) | ||
|
|
||
| if not success: | ||
| print('Failed to register DAG: %s' % (str(error))) | ||
| sys.exit(1) | ||
|
|
||
| ''' RUN DAG ''' | ||
| total_time = [] | ||
| scheduler_time = [] | ||
| kvs_time = [] | ||
|
|
||
| # Create all the input data | ||
| oids = {} | ||
| for i in range(num_requests): | ||
| oids[i] = {} | ||
| # Generate large matrices | ||
| for j in range(1, 4): | ||
| arr = np.random.randn(1000, 1000) | ||
| oid = str(uuid.uuid4()) | ||
| oids[i][j] = oid | ||
| cloudburst_client.put_object(oid, arr) | ||
| # Generate small matrices | ||
| for j in range(4, 7): | ||
| arr = np.random.randn(100, 100) | ||
| oid = str(uuid.uuid4()) | ||
| oids[i][j] = oid | ||
| cloudburst_client.put_object(oid, arr) | ||
|
|
||
| for i in range(num_requests): | ||
| oid = oids[i] | ||
|
|
||
| arg_map = {'mat_square1': [CloudburstReference(oid[1], True)], | ||
| 'mat_square2': [CloudburstReference(oid[2], True)], | ||
| 'mat_square3': [CloudburstReference(oid[3], True)], | ||
| 'mat_square4': [CloudburstReference(oid[4], True)], | ||
| 'mat_square5': [CloudburstReference(oid[5], True)], | ||
| 'mat_square6': [CloudburstReference(oid[6], True)]} | ||
|
|
||
| start = time.time() | ||
| rid = cloudburst_client.call_dag(dag_name, arg_map, True) | ||
| end = time.time() | ||
|
|
||
| stime = end - start | ||
|
|
||
| start = time.time() | ||
| rid.get() | ||
| end = time.time() | ||
|
|
||
| ktime = end - start | ||
|
|
||
| total_time += [stime + ktime] | ||
| scheduler_time += [stime] | ||
| kvs_time += [ktime] | ||
|
|
||
| if sckt: | ||
| sckt.send(cp.dumps(total_time)) | ||
|
|
||
| return total_time, scheduler_time, kvs_time, 0 |
This file contains hidden or 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
Oops, something went wrong.
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.
Why is all this code commented out?