Skip to content

Instantly share code, notes, and snippets.

@mwtian
mwtian / object_ref_shuffle.py
Last active August 29, 2021 06:35
Shuffling object ref with actor
import datetime
import random
import time
import ray
from ray import ray_constants
from ray import cloudpickle
from collections import defaultdict
ray.init(address="auto")
@mwtian
mwtian / profile.svg
Last active August 23, 2021 19:47
Ray getting objects with embedded refs CPU profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwtian
mwtian / refcount.py
Created August 15, 2021 19:02
Slow getting / deallocating nested object refs
import datetime
import time
import ray
from ray import ray_constants
from ray import cloudpickle
OBJ_REFS = 500 # number of put_object tasks to run, and number of top-level object refs input to ray.get()
EMBEDDED_OBJ_REFS = 2400 # number of embedded object refs per input object
REF_HIDING = False # whether to hide embedded object refs via cloudpickle.dumps(ray.put(input_object)))