Fixed some bugs
This commit is contained in:
parent
7fa68e2302
commit
198ad4c245
@ -5,7 +5,7 @@ from enum import Enum
|
|||||||
class Stat(Enum):
|
class Stat(Enum):
|
||||||
CPU = 'cpu'
|
CPU = 'cpu'
|
||||||
|
|
||||||
THREADS = 'threads'
|
CORES = 'cores'
|
||||||
ITERATIONS = 'iterations'
|
ITERATIONS = 'iterations'
|
||||||
BASELINE_TIME_S = 'baseline time (sec)'
|
BASELINE_TIME_S = 'baseline time (sec)'
|
||||||
BASELINE_DELAY_S = 'baseline delay (sec)'
|
BASELINE_DELAY_S = 'baseline delay (sec)'
|
||||||
@ -16,8 +16,10 @@ class Stat(Enum):
|
|||||||
MATRIX_FILE = 'matrix file'
|
MATRIX_FILE = 'matrix file'
|
||||||
MATRIX_FORMAT = 'matrix format'
|
MATRIX_FORMAT = 'matrix format'
|
||||||
MATRIX_SHAPE = 'matrix shape'
|
MATRIX_SHAPE = 'matrix shape'
|
||||||
|
MATRIX_ROWS = 'matrix rows'
|
||||||
MATRIX_SIZE = 'matrix size'
|
MATRIX_SIZE = 'matrix size'
|
||||||
MATRIX_NNZ = 'matrix nnz'
|
MATRIX_NNZ = 'matrix nnz'
|
||||||
|
MATRIX_DENSITY_GROUP = 'matrix density group'
|
||||||
MATRIX_DENSITY = 'matrix density'
|
MATRIX_DENSITY = 'matrix density'
|
||||||
|
|
||||||
#POWER_BEFORE = 'power before'
|
#POWER_BEFORE = 'power before'
|
||||||
|
@ -83,7 +83,8 @@ def run(
|
|||||||
str(args.base_iterations),
|
str(args.base_iterations),
|
||||||
str(args.min_time_s),
|
str(args.min_time_s),
|
||||||
str(args.baseline_time_s),
|
str(args.baseline_time_s),
|
||||||
str(args.baseline_delay_s)]
|
str(args.baseline_delay_s),
|
||||||
|
'-d']
|
||||||
|
|
||||||
if args.matrix_type == MatrixType.SUITESPARSE:
|
if args.matrix_type == MatrixType.SUITESPARSE:
|
||||||
run_args_list += ['-m', matrix_file]
|
run_args_list += ['-m', matrix_file]
|
||||||
@ -95,7 +96,7 @@ def run(
|
|||||||
# run_args_list += [args.perf]
|
# run_args_list += [args.perf]
|
||||||
|
|
||||||
if args.cores is not None:
|
if args.cores is not None:
|
||||||
run_args_list += ['-c', args.cores]
|
run_args_list += ['-c', str(args.cores)]
|
||||||
|
|
||||||
if args.power is not None:
|
if args.power is not None:
|
||||||
run_args_list += [args.power]
|
run_args_list += [args.power]
|
||||||
@ -115,7 +116,8 @@ if args.matrix_type == MatrixType.SUITESPARSE:
|
|||||||
elif args.matrix_type == MatrixType.SYNTHETIC:
|
elif args.matrix_type == MatrixType.SYNTHETIC:
|
||||||
parameter_list = enumerate([(size, density)
|
parameter_list = enumerate([(size, density)
|
||||||
for size in args.synthetic_size
|
for size in args.synthetic_size
|
||||||
for density in args.synthetic_density])
|
for density in args.synthetic_density
|
||||||
|
if size ** 2 * density < 100000000])
|
||||||
|
|
||||||
#for i, matrix in enumerate(glob.glob(f'{args.matrix_dir.rstrip("/")}/*.mtx')):
|
#for i, matrix in enumerate(glob.glob(f'{args.matrix_dir.rstrip("/")}/*.mtx')):
|
||||||
for i, parameter in parameter_list:
|
for i, parameter in parameter_list:
|
||||||
|
@ -60,7 +60,6 @@ def program(
|
|||||||
if cores is not None:
|
if cores is not None:
|
||||||
apptainer += [ '--env', 'OMP_PROC_BIND=true',
|
apptainer += [ '--env', 'OMP_PROC_BIND=true',
|
||||||
'--env', 'OMP_PLACES={0:' + f'{cores}' + '}']
|
'--env', 'OMP_PLACES={0:' + f'{cores}' + '}']
|
||||||
apptainer = ['apptainer', 'run']
|
|
||||||
|
|
||||||
spmv = f'python3 spmv.py {matrix_type.name.lower()} {fmt.name.lower()} '
|
spmv = f'python3 spmv.py {matrix_type.name.lower()} {fmt.name.lower()} '
|
||||||
spmv += f'{iterations} '
|
spmv += f'{iterations} '
|
||||||
@ -70,8 +69,9 @@ def program(
|
|||||||
spmv += f'-ss {synthetic_size} -sd {synthetic_density}'
|
spmv += f'-ss {synthetic_size} -sd {synthetic_density}'
|
||||||
else:
|
else:
|
||||||
exit("Unrecognized matrix type!")
|
exit("Unrecognized matrix type!")
|
||||||
|
|
||||||
if cores is not None:
|
if cores is not None:
|
||||||
spmv += f'-c {cores}'
|
spmv += f' -c {cores}'
|
||||||
|
|
||||||
if cpu == Cpu.ALTRA:
|
if cpu == Cpu.ALTRA:
|
||||||
return apptainer + ['pytorch-altra.sif', '-c',
|
return apptainer + ['pytorch-altra.sif', '-c',
|
||||||
@ -114,6 +114,15 @@ def trapezoidal_rule(power: list[float], time_s: float) -> float:
|
|||||||
|
|
||||||
result = dict()
|
result = dict()
|
||||||
result[Stat.CPU.name] = args.cpu.value
|
result[Stat.CPU.name] = args.cpu.value
|
||||||
|
if args.cores is not None:
|
||||||
|
result[Stat.CORES.name] = args.cores
|
||||||
|
else:
|
||||||
|
if args.cpu == Cpu.ALTRA:
|
||||||
|
result[Stat.CORES.name] = 80
|
||||||
|
elif args.cpu == Cpu.EPYC_7313P:
|
||||||
|
result[Stat.CORES.name] = 16
|
||||||
|
elif args.cpu == Cpu.XEON_4216:
|
||||||
|
result[Stat.CORES.name] = 16
|
||||||
|
|
||||||
iterations = args.base_iterations
|
iterations = args.base_iterations
|
||||||
program_result = run_program(program(
|
program_result = run_program(program(
|
||||||
|
@ -80,11 +80,13 @@ end = time.time()
|
|||||||
result = dict()
|
result = dict()
|
||||||
|
|
||||||
result[Stat.MATRIX_TYPE.name] = args.matrix_type.value
|
result[Stat.MATRIX_TYPE.name] = args.matrix_type.value
|
||||||
print(f"Matrix: {result[Stat.MATRIX_TYPE.name]}", file=sys.stderr)
|
print(f"Matrix Type: {result[Stat.MATRIX_TYPE.name]}", file=sys.stderr)
|
||||||
|
|
||||||
if args.matrix_type == MatrixType.SUITESPARSE:
|
if args.matrix_type == MatrixType.SUITESPARSE:
|
||||||
result[Stat.MATRIX_FILE.name] = os.path.splitext(os.path.basename(args.matrix_file))[0]
|
result[Stat.MATRIX_FILE.name] = os.path.splitext(os.path.basename(args.matrix_file))[0]
|
||||||
print(f"Matrix: {result[Stat.MATRIX_FILE.name]}", file=sys.stderr)
|
print(f"Matrix: {result[Stat.MATRIX_FILE.name]}", file=sys.stderr)
|
||||||
|
elif args.matrix_type == MatrixType.SYNTHETIC:
|
||||||
|
result[Stat.MATRIX_DENSITY_GROUP.name] = args.synthetic_density
|
||||||
|
|
||||||
result[Stat.MATRIX_FORMAT.name] = args.format.value
|
result[Stat.MATRIX_FORMAT.name] = args.format.value
|
||||||
print(f"Matrix: {result[Stat.MATRIX_FORMAT.name]}", file=sys.stderr)
|
print(f"Matrix: {result[Stat.MATRIX_FORMAT.name]}", file=sys.stderr)
|
||||||
@ -92,6 +94,9 @@ print(f"Matrix: {result[Stat.MATRIX_FORMAT.name]}", file=sys.stderr)
|
|||||||
result[Stat.MATRIX_SHAPE.name] = matrix.shape
|
result[Stat.MATRIX_SHAPE.name] = matrix.shape
|
||||||
print(f"Shape: {result[Stat.MATRIX_SHAPE.name]}", file=sys.stderr)
|
print(f"Shape: {result[Stat.MATRIX_SHAPE.name]}", file=sys.stderr)
|
||||||
|
|
||||||
|
result[Stat.MATRIX_ROWS.name] = matrix.shape[0]
|
||||||
|
print(f"Rows: {result[Stat.MATRIX_ROWS.name]}", file=sys.stderr)
|
||||||
|
|
||||||
result[Stat.MATRIX_SIZE.name] = matrix.shape[0] * matrix.shape[1]
|
result[Stat.MATRIX_SIZE.name] = matrix.shape[0] * matrix.shape[1]
|
||||||
print(f"Size: {result[Stat.MATRIX_SIZE.name]}", file=sys.stderr)
|
print(f"Size: {result[Stat.MATRIX_SIZE.name]}", file=sys.stderr)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user