Files
ray/python/ray/ray_cluster_perf.py
T
Eric Liang 53641f1f74 Move more unit tests to bazel (#6250)
* move more unit tests to bazel

* move to avoid conflict

* fix lint

* fix deps

* seprate

* fix failing tests

* show tests

* ignore mismatch

* try combining bazel runs

* build lint

* remove tests from install

* fix test utils

* better config

* split up

* exclusive

* fix verbosity

* fix tests class

* cleanup

* remove flaky

* fix metrics test

* Update .travis.yml

* no retry flaky

* split up actor

* split basic test

* split up trial runner test

* split stress

* fix basic test

* fix tests

* switch to pytest runner for main

* make microbench not fail

* move load code to py3

* test is no longer package

* bazel to end
2019-11-24 11:43:34 -08:00

48 lines
1.2 KiB
Python

"""This is the script for `ray clusterbenchmark`."""
import time
import numpy as np
import ray
from ray.cluster_utils import Cluster
def main():
cluster = Cluster(
initialize_head=True,
connect=True,
head_node_args={
"object_store_memory": 20 * 1024 * 1024 * 1024,
"num_cpus": 16
})
cluster.add_node(
object_store_memory=20 * 1024 * 1024 * 1024, num_gpus=1, num_cpus=16)
object_id_list = []
for i in range(0, 10):
object_id = ray.put(np.random.rand(1024 * 128, 1024))
object_id_list.append(object_id)
@ray.remote(num_gpus=1)
def f(object_id_list):
diffs = []
for object_id in object_id_list:
before = time.time()
ray.get(object_id)
after = time.time()
diffs.append(after - before)
time.sleep(1)
return np.mean(diffs), np.std(diffs)
time_diff, time_diff_std = ray.get(f.remote(object_id_list))
print("latency to get an 1G object over network", round(time_diff, 2),
"+-", round(time_diff_std, 2))
ray.shutdown()
cluster.shutdown()
if __name__ == "__main__":
main()