Ejemplo n.º 1
0
    def setUp(self):
        # We do not initialize Skylark so it will take the seed
        # from system time (new seed each time).
        # To be clean, and have every test self contained, we reinitalize
        # Skylark with a new time based seed
        sketch.initialize()

        #params
        self.num_repeats = 5
        self.accuracy    = 0.5
        _R = _N / self.accuracy**2

        self.sketches = [sketch.JLT, sketch.FJLT, sketch.CWT]
Ejemplo n.º 2
0
    def setUp(self):
        # We do not initialize Skylark so it will take the seed
        # from system time (new seed each time).
        # To be clean, and have every test self contained, we reinitalize
        # Skylark with a new time based seed
        sketch.initialize()

        #params
        self.num_repeats = 5
        self.accuracy = 0.5
        _R = _N / self.accuracy**2

        #self.sketches = [sketch.JLT, sketch.FJLT, sketch.CWT]
        self.sketches = [sketch.JLT, sketch.CWT]
Ejemplo n.º 3
0
    def setUp(self):
        sketch.initialize()

        self.n    = 100000
        self.sn   = 1000
Ejemplo n.º 4
0
import mpi4py.rc
mpi4py.rc.finalize   = False

from mpi4py import MPI
from skylark import sketch

import kdt
import math

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

# Lower layers are automatically initilalized when you import Skylark,
# It will use system time to generate the seed. However, we can
# reinitialize for so to fix the seed.
sketch.initialize(123834);

# creating an example matrix
# It seems that pySpParMat can only be created from dense vectors
rows = kdt.Vec(60, sparse=False)
cols = kdt.Vec(60, sparse=False)
vals = kdt.Vec(60, sparse=False)
for i in range(0, 60):
  rows[i] = math.floor(i / 6)
for i in range(0, 60):
  cols[i] = i % 6
for i in range(0, 60):
  vals[i] = i

ACB = kdt.Mat(rows, cols, vals, 6, 10)
print ACB
Ejemplo n.º 5
0
elem.LeastSquares(elem.NORMAL, A1, b1, x)
telp = time.time() - t0

# Compute residual
r = elem.DistMatrix_d()
elem.Copy(b, r)
elem.Gemv(elem.NORMAL, -1.0, A1, x, 1.0, r)
res = elem.Norm(r)
if (MPI.COMM_WORLD.Get_rank() == 0):
    print "Exact solution residual %(res).3f\t\t\ttook %(elp).2e sec" % \
        { "res" : res, "elp": telp }

# Lower-layers are automatically initilalized when you import Skylark,
# It will use system time to generate the seed. However, we can
# reinitialize for so to fix the seed.
sketch.initialize(123834)

#
# Solve the problem using sketching
#
for sname in sketches:
    stype = sketches[sname]

    t0 = time.time()

    # Create transform.
    S = stype(m, t, defouttype="DistMatrix_STAR_STAR")

    # Sketch both A and b using the same sketch
    SA = S * A
    Sb = S * b