Skip to content

Instantly share code, notes, and snippets.

View kvchen's full-sized avatar

Kevin Chen kvchen

View GitHub Profile
import json
def main():
with open('test.json', 'rb') as infile:
test = json.load(infile)['result']
print(test)
if __name__ == "__main__":
main()
@kvchen
kvchen / keybase.md
Created December 12, 2016 10:50
keybase.md

Keybase proof

I hereby claim:

  • I am kvchen on github.
  • I am kevinchen (https://keybase.io/kevinchen) on keybase.
  • I have a public key ASDOJ1rzklOEGkN0LP1t-vGd2Q3dQfON2di2vhNrDybITQo

To claim this, I am signing this object:

@ray.remote
def lu_decomp_invert(lu_decomp):
"""Takes the inverse of each of the components in the P, L, U
decomposition. Needed as a helper function for the block-level LU decomp.
"""
return tuple(np.linalg.inv(x) for x in lu_decomp)
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
import ray
import matplotlib.pyplot as plt
import numpy as np
import ray.array.distributed as rd
# from scipy.linalg import lu
def main():
ray.init(start_ray_local=True, num_workers=10)
@ray.remote
def lu_decomp_invert(lu_decomp):
"""Takes the inverse of each of the components in the P, L, U
decomposition. Needed as a helper function for the block-level LU decomp.
"""
return tuple(np.linalg.inv(x) for x in lu_decomp)
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
@ray.remote
def lu_decomp_invert(lu_decomp):
"""Takes the inverse of each of the components in the P, L, U
decomposition. Needed as a helper function for the block-level LU decomp.
"""
return tuple(np.linalg.inv(x) for x in lu_decomp)
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
@ray.remote
def lu_decomp_invert(lu_decomp):
"""Takes the inverse of each of the components in the P, L, U
decomposition. Needed as a helper function for the block-level LU decomp.
"""
return tuple(np.linalg.inv(x) for x in lu_decomp)
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
"""Returns the LU decomposition of a square matrix.
Parameters
----------
a : array_like
Returns
-------
def assemble(self):
"""Assemble an array on this node from a distributed array of object IDs."""
first_block = ray.get(self.objectids[(0,) * self.ndim])
dtype = first_block.dtype
result = np.zeros(self.shape, dtype=dtype)
indices = np.ndindex(*self.num_blocks)
# Fetch all the blocks asynchronously
blocks = ray.get([self.objectids[idx] for idx in indices])
#!/usr/bin/env python
import click
import json
import mkl
import numpy as np
import ray
from ray.array.distributed import core as rdc
from timeit import default_timer as timer