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
import time | |
# try cupy as well | |
import numpy as np | |
try: | |
import cunumeric as cunp | |
except RuntimeError as e: | |
pass | |
import cupy as cp |
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
$ ./install.py --cuda | |
Verbose build is off | |
Using python lib and version: /nvme/0/thead/miniconda/envs/legate-test/lib/libpython3.10.so, 3.10.9 | |
Performing a clean build to accommodate build isolation. | |
Processing /home/nfs/thead/git/legate.core-jjwilke | |
Installing build dependencies ... done | |
Getting requirements to build wheel ... done | |
Preparing metadata (pyproject.toml) ... done | |
Requirement already satisfied: numpy>=1.22 in /nvme/0/thead/miniconda/envs/legate-test/lib/python3.10/site-packages (from legate.core==22.7.0.dev0+249.ga08d963) (1.24.2) | |
Building wheels for collected packages: legate.core |
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
class Mixin: | |
def _foo_and_set_attr(self, a): | |
r = self._original_foo(a) | |
# Now massage `self`, maybe convert some attributes | |
# or some other work | |
self.a = int(a) | |
return r | |
def __init_subclass__(cls, **kwargs): | |
cls._original_foo = cls.foo |
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
import inspect | |
import importlib | |
import sklearn | |
def find_classes(module, base=None): | |
if base is None: | |
base = module.__name__ | |
classes = [] |
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
# Defining the API of an engine | |
class BaseEngine: | |
def __init__(self, estimator): | |
self.estimator = estimator | |
def accepts(self, X, y=None, sample_weight=None): | |
"""Decide if this engine wants to handle this request. | |
Based on the information available the engine can decide | |
if it wants to handle this request or not. To (not) handle the |
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
import time | |
import numpy as np | |
import cupy as cp | |
import sklearn | |
from sklearn.cluster import KMeans | |
from sklearn.datasets import make_blobs | |
from sklearn.model_selection import train_test_split |
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
a = np.array_api.arange(10) | |
b = cupy.arange(10) | |
# use all the arrays, without ever having to care what kind they are | |
for x in (a, b): | |
xp = x.__array_namespace__() | |
print(xp.abs(x)) |
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
# The weird thing is that normally you can't get anything out of a black hole | |
# | |
# Try it with things like: | |
# | |
# from blackhole import X, Y, Z | |
# import blackhole | |
def __getattr__(*args, **kwargs): | |
pass |
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
import functools | |
import inspect | |
import random | |
def variation(*, default, public=False): | |
def decorator(f): | |
if not f.__name__.endswith("_variation"): | |
raise RuntimeError(f"Variation '{f.__name__}' name does not end with '_variation'.") |
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
[E 200729 16:28:09 launcher:101] Error accessing Hub API (using https://hub-binder.mybinder.ovh/hub/api/users/binder-examples-requirements-vqaeghik): HTTP 503: Service Unavailable | |
[E 200729 16:28:10 web:2250] 503 GET /health (34.66.138.193) 9.42ms | |
[E 200729 16:28:11 web:2250] 503 GET /health (34.66.138.193) 6.97ms | |
[I 200729 16:28:12 web:2250] 200 GET /about (51.68.77.249) 1.66ms | |
[I 200729 16:28:17 web:2250] 200 GET /about (51.68.77.249) 1.69ms | |
[I 200729 16:28:18 web:2250] 200 GET /metrics (10.2.2.70) 10.05ms | |
[I 200729 16:28:22 web:2250] 200 GET /about (51.68.77.249) 1.89ms | |
[E 200729 16:28:25 launcher:101] Error accessing Hub API (using https://hub-binder.mybinder.ovh/hub/api/users/binder-examples-requirements-vqaeghik): HTTP 503: Service Unavailable | |
[E 200729 16:28:25 launcher:171] Error creating user binder-examples-requirements-vqaeghik: HTTP 503: Service Unavailable | |
b'Service Unavailable' |