Esempio n. 1
0
import time as time
import sys

sys.path.insert(0, "./")
import HiParTIPy.Matrix as ptiMat

if len(sys.argv) < 2:
    sys.exit("Usage: python3 benchmarkPy/matrix/sort.py [.mtx]")

mtxname = sys.argv[1]
print("Load Matrix from: {}".format(mtxname))

coo_in = ptiMat.COOMatrix()
coo_in.loadMatrix(mtxname)
coo_in.statusMatrix()

# Reordering in Lexi-order
coo_in.reorder(type="lexi")

# Reordering in random order
coo_in.reorder(type="random")
Esempio n. 2
0
import time as time
import sys
sys.path.insert(0, "./")
import HiParTIPy.Matrix as ptiMat

if len(sys.argv) < 2:
  sys.exit("Usage: python3 benchmarkPy/matrix/spmm.py [.mtx] [ncols] [niters]")

mtxname = sys.argv[1]
print("Load Matrix from: {}".format(mtxname))
R = int(sys.argv[2])  # Specify number of columns for the dense matrix
if R==0: R=ncols
niters = int(sys.argv[3])  # Specify number of iterations

coo = ptiMat.COOMatrix()
coo.loadMatrix(mtxname)  # Specify what matrix to use
sb_bits = 7
hicoo = coo.convert(type="hicoo", blockbits=sb_bits, superblockbits=sb_bits)  # Specify blocking for hicoo matricies
csr = coo.convert(type="csr")

ncols = coo.ncols()
nrows = coo.nrows()
nnz = coo.nnz()

input_mat = ptiMat.DenseMatrix(ncols, R)
input_mat.randomMatrix()

######## COO-SpMM #########
# warm-up
coo.multiplyMatrix(input_mat,testing=True)
Esempio n. 3
0
import HiParTIPy.Matrix as mat
import HiParTIPy.Vector as vec
import HiParTIPy.Buffers as buff

coo = mat.COOMatrix()
coo.loadMatrix("data/matrices/tiny.mtx")
hicoo = coo.convertToHiCOO()
print(coo.ncols())

vec = vec.ValueVector(coo.ncols())
vec.makeRandom()

buf = buff.VecBuff(coo.ncols())

print("HERE")
coo.multiplyVector(vec)
print("HREE")
hicoo.multiplyVectorBuff(vec,buf)
print("HERE")
buf.free()
print("HERE")
Esempio n. 4
0
print("File Name: {}".format(name))

niters = int(sys.argv[2])
equ = int(niters / 100)
mode = int(sys.argv[3])

vector = vec.ValueVector(coo.address.ndims[mode])

for i in range(equ):
    coo.mulVector(vector, mode, testing=True)
start = time()
for i in range(niters):
    coo.mulVector(vector, mode, testing=True)
end = time()
print("MulVector: Time = {},\n Time per Cycles = {}".format(
    end - start, (end - start) / niters))

var = sys.argv[4]

matrix = mat.DenseMatrix(coo.address.ndims[mode], var)

for i in range(equ):
    coo.mulMatrix(matrix, mode, testing=True)
start = time()
for i in range(niters):
    coo.mulMatrix(matrix, mode, testing=True)
end = time()
print("MulMatrix: Time = {},\n Time per Cycles = {}".format(
    end - start, (end - start) / niters))
Esempio n. 5
0
import HiParTIPy.Matrix as ptiMat

if len(sys.argv) < 2:
    sys.exit(
        "Usage: python3 benchmarkPy/tensor/mttkrp.py [.tns] [mode] [rank] [niters]"
    )

name = sys.argv[1]
mode = sys.argv[2]
R = int(sys.argv[3])
niters = int(sys.argv[4])
print("Load Tensor from: {}".format(name))

coo = ptiTen.COOTensor()
coo.load(name)

nmodes = coo.nmodes()
ndims_mode = coo.dim_mode(mode)

input_mat = ptiMat.DenseMatrix(ndims_mode, R)
input_mat.randomMatrix()

coo.mulMatrix(mats, mode, type='serial', testing=True)
start = time()
for i in range(niters):
    coo.mulMatrix(mats, mode, type='serial', testing=True)
end = time()
print("TTM: Time = {},\n Time per Cycles = {}".format(end - start,
                                                      (end - start) / niters))

hicoo = coo.toHiCOO()
Esempio n. 6
0
import time as time
import sys
sys.path.insert(0, "./")
import HiParTIPy.Matrix as ptiMat
import HiParTIPy.Vector as ptiVec

if len(sys.argv) < 2:
    sys.exit("Usage: python3 benchmarkPy/matrix/spmv.py [.mtx] [niters]")

mtxname = sys.argv[1]
print("Load Matrix from: {}".format(mtxname))
niters = int(sys.argv[2])  # Specify number of iterations

coo = ptiMat.COOMatrix()

coo.loadMatrix(mtxname)  # Specify what matrix to use.
sb_bits = 7
hicoo = coo.convert(
    type="hicoo", blockbits=sb_bits,
    superblockbits=sb_bits)  # Specify blocking for hicoo matricies
csr = coo.convert(type="csr")

ncols = coo.ncols()
nrows = coo.nrows()
nnz = coo.nnz()

input_vector = ptiVec.ValueVector(ncols)
input_vector.makeRandom()

######## COO-SpMV #########
# warm-up