Skip to content

Commit be9f4f5

Browse files
authored
Merge pull request #1212 from vishalbh/ngspice
Onboarded ngspice workloads
2 parents c873ff3 + 422f16a commit be9f4f5

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Copyright 2022-2025 The Ramble Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4+
# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5+
# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6+
# option. This file may not be copied, modified, or distributed
7+
# except according to those terms.
8+
9+
import os
10+
11+
from ramble.appkit import *
12+
from ramble.expander import Expander
13+
14+
15+
class Ngspice(ExecutableApplication):
16+
"""Define NgSpice application"""
17+
18+
name = "ngspice"
19+
20+
maintainers("vishalbh")
21+
22+
tags("circuit-simulation", "mini-app")
23+
24+
with when("package_manager_family=spack"):
25+
define_compiler("gcc12", pkg_spec="[email protected]")
26+
27+
software_spec(
28+
"ngspice",
29+
pkg_spec="ngspice@44 build=bin",
30+
compiler="gcc12",
31+
)
32+
33+
required_package("ngspice")
34+
35+
input_file(
36+
"Ngspice_BenchMark_Inputs",
37+
url="http://www.phoronix-test-suite.com/benchmark-files/iscas85Circuits-1.tar.xz",
38+
sha256="5d160b3496e95fa4861558b95388bf346c914216e1c3b29690d2573f88df6892",
39+
description="Input files for the ngspice workload",
40+
target_dir="{experiment_run_dir}",
41+
)
42+
43+
out_file = os.path.join(
44+
Expander.expansion_str("experiment_run_dir"),
45+
Expander.expansion_str("workload_name") + ".out",
46+
)
47+
48+
executable(
49+
"execute",
50+
"ngspice -b {input_file} -o " + out_file,
51+
use_mpi=True,
52+
)
53+
54+
all_workloads = [
55+
"c1355",
56+
"c1908",
57+
"c2670",
58+
"c3540",
59+
"c432",
60+
"c499",
61+
"c6288",
62+
"c7552",
63+
"c880",
64+
]
65+
for normal_workload in all_workloads:
66+
workload(
67+
normal_workload,
68+
executables=["execute"],
69+
inputs=["Ngspice_BenchMark_Inputs"],
70+
)
71+
workload_variable(
72+
"input_file",
73+
default="iscas85Circuits-1/85/"
74+
+ normal_workload
75+
+ "/"
76+
+ normal_workload
77+
+ ".net",
78+
description="Path to input file for "
79+
+ normal_workload
80+
+ " workload",
81+
workloads=[normal_workload],
82+
)
83+
84+
for ann_workload in all_workloads:
85+
workload(
86+
ann_workload + "_ann",
87+
executables=["execute"],
88+
inputs=["Ngspice_BenchMark_Inputs"],
89+
)
90+
workload_variable(
91+
"input_file",
92+
default="iscas85Circuits-1/85/"
93+
+ ann_workload
94+
+ "/"
95+
+ ann_workload
96+
+ "_ann.net",
97+
description="Path to input file for "
98+
+ ann_workload
99+
+ " workload",
100+
workloads=[ann_workload + "_ann"],
101+
)
102+
103+
floating_point_regex = r"\d+\.\d+"
104+
total_analysis_regex = (
105+
r"Total\s*analysis\s*time\s*\(seconds\)\s*=\s*(?P<time>"
106+
+ floating_point_regex
107+
+ r")"
108+
)
109+
success_criteria(
110+
"valid", mode="string", match=total_analysis_regex, file=out_file
111+
)
112+
113+
figure_of_merit(
114+
"Total Simulation Time",
115+
log_file=out_file,
116+
fom_regex=total_analysis_regex,
117+
group_name="time",
118+
units="s",
119+
)

0 commit comments

Comments
 (0)