Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gcc-python-plugin
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
watcag-public
gcc-python-plugin
Commits
3c55b5aa
Commit
3c55b5aa
authored
3 years ago
by
Nachiket Kapre
Browse files
Options
Downloads
Patches
Plain Diff
updating bench folder
parent
e3f70c5d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bench/binomial_option.c
+3
-4
3 additions, 4 deletions
bench/binomial_option.c
bench/iir8.c
+10
-11
10 additions, 11 deletions
bench/iir8.c
gccutils/__init__.py
+16
-8
16 additions, 8 deletions
gccutils/__init__.py
with
29 additions
and
23 deletions
bench/binomial_option.c
+
3
−
4
View file @
3c55b5aa
// This is a one-step binomial option model, i.e. NUM_STEPS = 1
// Reference: https://software.intel.com/en-us/articles/binomial-options-pricing-model-code-for-intel-xeon-phi-coprocessor
#include
<math.h>
binomial_option
(
double
StockPrice
,
// Stock price of today
double
binomial_option
(
double
StockPrice
,
// Stock price of today
double
OptionStrike
,
double
TimePeriod
,
// time period
double
vol
,
// volatility
double
risk
,
// risk free
double
*
CallResult
double
risk
// risk free
)
{
/* Note: for intermediate variables, please define them starting with a capital letter 'T' followed by a digit number */
...
...
@@ -17,5 +16,5 @@ binomial_option(double StockPrice, // Stock price of today
double
T3
=
(
exp
(
T2
)
-
1
/
exp
(
T1
))
/
(
exp
(
T1
)
-
1
/
exp
(
T1
));
// variable pu
double
T4
=
1
-
T3
;
// variable pd
double
T5
=
StockPrice
*
exp
(
T1
)
-
OptionStrike
;
// variable d1
*
CallResult
=
(
T3
*
T5
-
T4
*
T5
)
/
exp
(
T2
);
return
(
T3
*
T5
-
T4
*
T5
)
/
exp
(
T2
);
}
This diff is collapsed.
Click to expand it.
bench/iir8.c
+
10
−
11
View file @
3c55b5aa
iir8
(
double
a0
,
double
iir8
(
double
a0
,
double
a1
,
double
a2
,
double
a3
,
...
...
@@ -20,17 +23,12 @@ iir8(double a0,
double
x4
,
double
x5
,
double
x6
,
double
x7
,
double
y0
,
double
y1
,
double
y2
,
double
y3
,
double
y4
,
double
y5
,
double
y6
,
double
y7
double
x7
)
{
double
y0
,
y1
,
y2
,
y3
,
y4
,
y5
,
y6
;
y0
=
a0
*
x0
;
y1
=
a1
*
x1
+
y0
-
b0
*
y0
;
y2
=
a2
*
x2
+
y1
-
b1
*
y1
;
...
...
@@ -38,5 +36,6 @@ iir8(double a0,
y4
=
a4
*
x4
+
y3
-
b3
*
y3
;
y5
=
a5
*
x5
+
y4
-
b4
*
y4
;
y6
=
a6
*
x6
+
y5
-
b5
*
y5
;
y7
=
a7
*
x7
+
y6
-
b6
*
y6
;
return
(
a7
*
x7
+
y6
-
b6
*
y6
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
gccutils/__init__.py
+
16
−
8
View file @
3c55b5aa
...
...
@@ -16,6 +16,7 @@
# <http://www.gnu.org/licenses/>.
import
gcc
import
os
def
sorted_dict_repr
(
d
):
return
'
{
'
+
'
,
'
.
join
([
'
%r: %r
'
%
(
k
,
d
[
k
])
...
...
@@ -526,20 +527,27 @@ class CfgPrettyPrinter(DotPrettyPrinter):
# Walk the DFG taking care to remove LHS appearing in RHS of GCC's
# Tree structure
accumstr
=
""
;
for
itr
in
range
(
0
,
i
):
if
itr
in
exit_variables
:
accumstr
+=
"
+ 1 x
"
+
str
(
itr
)
+
"
"
;
else
:
accumstr
+=
"
+ 0 x
"
+
str
(
itr
)
+
"
"
;
for
key
,
values
in
blockdfg
.
iteritems
():
if
(
key
in
values
):
values
.
remove
(
key
);
newkey
=
key
.
replace
(
"
*
"
,
""
)
if
(
newkey
in
values
):
values
.
remove
(
newkey
);
for
val
in
values
:
accumstr
+=
"
+1
"
+
variable_names
[
key
]
+
"
-1
"
+
variable_names
[
val
]
+
"
"
# minimize objective function
if
accumstr
:
print
"
min:
"
+
accumstr
+
"
;
"
;
accumstr
=
""
;
# all slots > 0
for
itr
in
range
(
0
,
i
):
print
"
+1 x
"
+
str
(
itr
)
+
"
>= 0;
"
;
print
"
+1 x
"
+
str
(
itr
)
+
"
>= 0;
"
;
if
itr
in
exit_variables
:
accumstr
+=
"
+ 1 x
"
+
str
(
itr
)
+
"
"
;
if
accumstr
:
#The latency constraint for MINREG
print
accumstr
+
"
=
"
+
str
(
int
(
float
(
os
.
environ
[
'
obj_fun_val_q1
'
])))
+
"
;
"
# extract dependencies
for
key
,
values
in
blockdfg
.
iteritems
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment