-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import argparse | ||
import math | ||
from timeit import default_timer as timer | ||
import numpy as np | ||
from memory_profiler import profile | ||
|
||
from HierMat import * | ||
|
||
|
||
def main(limit, dimension): | ||
lim = limit | ||
if dimension == 1: | ||
points = [((i + 0.5) / lim,) for i in xrange(lim)] | ||
supports = {points[i]: (points[i][0] - 0.5/lim, points[i][0] + 0.5/lim) for i in xrange(lim)} | ||
elif dimension == 2: | ||
points = [(math.sin(float(i)/lim), math.cos(float(j)/lim)) for i in xrange(lim) for j in xrange(lim)] | ||
supports = {points[k]: (points[k-1], points[k+1]) for k in xrange(lim * lim - 1)} | ||
supports[points[lim*lim-1]] = (points[lim*lim-2], points[0]) | ||
else: | ||
points = [(float(i) / lim, float(j) / lim, float(k) / lim) for i in xrange(lim) for j in | ||
xrange(lim) for k in xrange(lim)] | ||
supports = {points[k]: (points[k - 1], points[k + 1]) for k in xrange(lim * lim * lim - 1)} | ||
supports[points[lim * lim * lim - 1]] = (points[lim * lim * lim - 2], points[0]) | ||
grid = Grid(points, supports) | ||
cluster = Cluster(grid) | ||
rc = RegularCuboid(cluster) | ||
start = timer() | ||
ct_rc = build_cluster_tree(rc, 1) | ||
end = timer() | ||
print "ClusterTree build-up with RegularCuboid took {0} seconds.".format(end - start) | ||
start = timer() | ||
bct_rc_rc = build_block_cluster_tree(ct_rc, ct_rc) | ||
end = timer() | ||
print "BlockClusterTree build-up with RegularCuboid took {0} seconds." .format(end - start) | ||
file_str = '/compute/nem/bct_{0}'.format(limit) | ||
export(bct_rc_rc, form='bin', out_file=file_str) | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser("HMatrix Profiler") | ||
parser.add_argument("dimension", type=int, choices=[1, 2, 3]) | ||
parser.add_argument("limit", type=int) | ||
try: | ||
args = parser.parse_args() | ||
print '\n' + '*' * 74 + '\n' | ||
print 'Starting run with n={0}'.format(args.limit) + '\n' | ||
main(args.limit, args.dimension) | ||
print '\n' + 'Finished run with n={0}'.format(args.limit) | ||
print '\n' + '*' * 74 + '\n' | ||
except SystemExit: | ||
main(20, 2) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
OUTFILE=/compute/nem/cluster_tree_timer.out | ||
if [ -f ${OUTFILE} ]; | ||
then | ||
rm -f ${OUTFILE} | ||
fi | ||
for e in `seq 2 20`; | ||
do | ||
python cluster_tree_timer.py 1 $(( 2**${e} )) >> ${OUTFILE} | ||
done |