Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix link #110

Merged
merged 2 commits into from
Jan 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions scripts/formatting/datastructure_tns.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
taco_format_dirname = os.path.join(taco_format_dirname, "other-formatted-taco")
# elif args.tiles is not None:
# # FIXME: Change this to be 'tns' for frostt tensors
# outdir_name = os.path.join(args.tiles, args.bench, "mtx")
# outdir_name = os.path.join(args.tiles, args.bench, "mtx")
# taco_format_dirname = os.getenv('FROSTT_FORMATTED_TACO_PATH')
# if taco_format_dirname is None:
# print("Please set the FROSTT_FORMATTED_TACO_PATH environment variable")
Expand Down Expand Up @@ -117,14 +117,14 @@
for line in Lines:
shape[count] = int(line)
count += 1
# tensor =
# tensor =
# inputCache = InputCacheSuiteSparse()
# coo = inputCache.load(tensor, False)
tensorname = 'c'
# formatWriter.writeout_separate_sparse_only(coo, out_path, tensorname, format_str="ss10")
vec = scipy.sparse.random(shape[2], 1, density=args.density, data_rvs=np.ones)
vec = vec.toarray().flatten()
#need to uncomment if running without tiling**
# need to uncomment if running without tiling**
# formatWriter.writeout_separate_vec(vec, outdir_other_path, tensorname)

# vec = scipy.sparse.random(shape[2], 1, data_rvs=np.ones)
Expand All @@ -150,7 +150,7 @@
count += 1
# coo = inputCache.load(tensor, False)
print("SHAPE: ", shape)
if(min(shape) > 10):
if (min(shape) > 10):
dimension_k = random.randint(10, min(shape))
else:
dimension_k = random.randint(min(shape), 10)
Expand All @@ -159,7 +159,7 @@
# formatWriter.writeout_separate_sparse_only(coo, dirname, tensorname, format_str="ss10")
tensorname = 'C'
matrix = scipy.sparse.random(dimension_k, dimension_l, density=args.density, data_rvs=np.ones).toarray()
#NEED TO UNCOMMENT FOLLOWING LINE IF NOT RUNNING WITH TILING**
# NEED TO UNCOMMENT FOLLOWING LINE IF NOT RUNNING WITH TILING**
# formatWriter.writeout_separate_sparse_only(matrix, outdir_other_name, tensorname)

elif args.bench == "tensor3_mttkrp":
Expand Down Expand Up @@ -202,7 +202,7 @@
taco_format_orig_filename = os.getenv('FROSTT_FORMATTED_TACO_PATH') + "/" + args.name + "_" + levels + '.txt'
parse_taco_format(taco_format_orig_filename, outdir_orig_name, 'B', args.format, hw_filename=args.hw)

#COMMENTED OUT FOR TILING FLOW, WOULD NEED TO UNCOMMENT IF RUNNING WITHOUT TILING
# COMMENTED OUT FOR TILING FLOW, WOULD NEED TO UNCOMMENT IF RUNNING WITHOUT TILING
# # this code is used for: tensor3_elemadd, tensor3_innerprod
# taco_format_orig_filename = os.path.join(taco_format_dirname, args.name + "_" + levels + '.txt')
# taco_format_shift_filename = os.path.join(taco_format_dirname, args.name + '_shift_' + levels + '.txt')
Expand All @@ -216,6 +216,7 @@
# outdir_shift_name = os.path.join(outdir_name, args.name, args.bench, args.format)
# outdir_shift_path = Path(outdir_shift_name)
# outdir_shift_path.mkdir(parents=True, exist_ok=True)
# # taco_format_shift_filename = "/nobackup/jadivara/sam/FROST_FORMATTED_TACO/" + args.name + "_shift_" + levels + '.txt'
# taco_format_shift_filename =
# "/nobackup/jadivara/sam/FROST_FORMATTED_TACO/" + args.name + "_shift_" + levels + '.txt'
# taco_format_orig_filename = os.getenv('FROSTT_FORMATTED_TACO_PATH') + args.name + "_" + levels + '.txt'
# parse_taco_format(taco_format_shift_filename, outdir_shift_name, 'C', args.format, hw_filename=args.hw)