Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
How Approximation Affects Parallelization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nathanael Sandy
How Approximation Affects Parallelization
Commits
5c15b604
Commit
5c15b604
authored
6 years ago
by
Daniel Maier
Browse files
Options
Downloads
Patches
Plain Diff
bicg application
parent
dbf7c62f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
codes/bicg/bicg.c
+145
-0
145 additions, 0 deletions
codes/bicg/bicg.c
codes/bicg/bicg.h
+80
-0
80 additions, 0 deletions
codes/bicg/bicg.h
with
225 additions
and
0 deletions
codes/bicg/bicg.c
0 → 100644
+
145
−
0
View file @
5c15b604
/**
* This version is stamped on May 10, 2016
*
* Contact:
* Louis-Noel Pouchet <pouchet.ohio-state.edu>
* Tomofumi Yuki <tomofumi.yuki.fr>
*
* Web address: http://polybench.sourceforge.net
*/
/* bicg.c: this file is part of PolyBench/C */
#include
<stdio.h>
#include
<unistd.h>
#include
<string.h>
#include
<math.h>
/* Include polybench common header. */
#include
<polybench.h>
/* Include benchmark-specific header. */
#include
"bicg.h"
/* Array initialization. */
static
void
init_array
(
int
m
,
int
n
,
DATA_TYPE
POLYBENCH_2D
(
A
,
N
,
M
,
n
,
m
),
DATA_TYPE
POLYBENCH_1D
(
r
,
N
,
n
),
DATA_TYPE
POLYBENCH_1D
(
p
,
M
,
m
))
{
int
i
,
j
;
for
(
i
=
0
;
i
<
m
;
i
++
)
p
[
i
]
=
(
DATA_TYPE
)(
i
%
m
)
/
m
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
r
[
i
]
=
(
DATA_TYPE
)(
i
%
n
)
/
n
;
for
(
j
=
0
;
j
<
m
;
j
++
)
A
[
i
][
j
]
=
(
DATA_TYPE
)
(
i
*
(
j
+
1
)
%
n
)
/
n
;
}
}
/* DCE code. Must scan the entire live-out data.
Can be used also to check the correctness of the output. */
static
void
print_array
(
int
m
,
int
n
,
DATA_TYPE
POLYBENCH_1D
(
s
,
M
,
m
),
DATA_TYPE
POLYBENCH_1D
(
q
,
N
,
n
))
{
int
i
;
POLYBENCH_DUMP_START
;
POLYBENCH_DUMP_BEGIN
(
"s"
);
for
(
i
=
0
;
i
<
m
;
i
++
)
{
if
(
i
%
20
==
0
)
fprintf
(
POLYBENCH_DUMP_TARGET
,
"
\n
"
);
fprintf
(
POLYBENCH_DUMP_TARGET
,
DATA_PRINTF_MODIFIER
,
s
[
i
]);
}
POLYBENCH_DUMP_END
(
"s"
);
POLYBENCH_DUMP_BEGIN
(
"q"
);
for
(
i
=
0
;
i
<
n
;
i
++
)
{
if
(
i
%
20
==
0
)
fprintf
(
POLYBENCH_DUMP_TARGET
,
"
\n
"
);
fprintf
(
POLYBENCH_DUMP_TARGET
,
DATA_PRINTF_MODIFIER
,
q
[
i
]);
}
POLYBENCH_DUMP_END
(
"q"
);
POLYBENCH_DUMP_FINISH
;
}
/* Main computational kernel. The whole function will be timed,
including the call and return. */
static
void
kernel_bicg
(
int
m
,
int
n
,
DATA_TYPE
POLYBENCH_2D
(
A
,
N
,
M
,
n
,
m
),
DATA_TYPE
POLYBENCH_1D
(
s
,
M
,
m
),
DATA_TYPE
POLYBENCH_1D
(
q
,
N
,
n
),
DATA_TYPE
POLYBENCH_1D
(
p
,
M
,
m
),
DATA_TYPE
POLYBENCH_1D
(
r
,
N
,
n
))
{
int
i
,
j
;
#pragma scop
for
(
i
=
0
;
i
<
_PB_M
;
i
++
)
s
[
i
]
=
0
;
for
(
i
=
0
;
i
<
_PB_N
;
i
++
)
{
q
[
i
]
=
SCALAR_VAL
(
0
.
0
);
for
(
j
=
0
;
j
<
_PB_M
;
j
++
)
{
s
[
j
]
=
s
[
j
]
+
r
[
i
]
*
A
[
i
][
j
];
q
[
i
]
=
q
[
i
]
+
A
[
i
][
j
]
*
p
[
j
];
}
}
#pragma endscop
}
int
main
(
int
argc
,
char
**
argv
)
{
/* Retrieve problem size. */
int
n
=
N
;
int
m
=
M
;
/* Variable declaration/allocation. */
POLYBENCH_2D_ARRAY_DECL
(
A
,
DATA_TYPE
,
N
,
M
,
n
,
m
);
POLYBENCH_1D_ARRAY_DECL
(
s
,
DATA_TYPE
,
M
,
m
);
POLYBENCH_1D_ARRAY_DECL
(
q
,
DATA_TYPE
,
N
,
n
);
POLYBENCH_1D_ARRAY_DECL
(
p
,
DATA_TYPE
,
M
,
m
);
POLYBENCH_1D_ARRAY_DECL
(
r
,
DATA_TYPE
,
N
,
n
);
/* Initialize array(s). */
init_array
(
m
,
n
,
POLYBENCH_ARRAY
(
A
),
POLYBENCH_ARRAY
(
r
),
POLYBENCH_ARRAY
(
p
));
/* Start timer. */
polybench_start_instruments
;
/* Run kernel. */
kernel_bicg
(
m
,
n
,
POLYBENCH_ARRAY
(
A
),
POLYBENCH_ARRAY
(
s
),
POLYBENCH_ARRAY
(
q
),
POLYBENCH_ARRAY
(
p
),
POLYBENCH_ARRAY
(
r
));
/* Stop and print timer. */
polybench_stop_instruments
;
polybench_print_instruments
;
/* Prevent dead-code elimination. All live-out data must be printed
by the function call in argument. */
polybench_prevent_dce
(
print_array
(
m
,
n
,
POLYBENCH_ARRAY
(
s
),
POLYBENCH_ARRAY
(
q
)));
/* Be clean. */
POLYBENCH_FREE_ARRAY
(
A
);
POLYBENCH_FREE_ARRAY
(
s
);
POLYBENCH_FREE_ARRAY
(
q
);
POLYBENCH_FREE_ARRAY
(
p
);
POLYBENCH_FREE_ARRAY
(
r
);
return
0
;
}
This diff is collapsed.
Click to expand it.
codes/bicg/bicg.h
0 → 100644
+
80
−
0
View file @
5c15b604
/**
* This version is stamped on May 10, 2016
*
* Contact:
* Louis-Noel Pouchet <pouchet.ohio-state.edu>
* Tomofumi Yuki <tomofumi.yuki.fr>
*
* Web address: http://polybench.sourceforge.net
*/
#ifndef _BICG_H
# define _BICG_H
/* Default to LARGE_DATASET. */
# if !defined(MINI_DATASET) && !defined(SMALL_DATASET) && !defined(MEDIUM_DATASET) && !defined(LARGE_DATASET) && !defined(EXTRALARGE_DATASET)
# define LARGE_DATASET
# endif
# if !defined(M) && !defined(N)
/* Define sample dataset sizes. */
# ifdef MINI_DATASET
# define M 38
# define N 42
# endif
# ifdef SMALL_DATASET
# define M 116
# define N 124
# endif
# ifdef MEDIUM_DATASET
# define M 390
# define N 410
# endif
# ifdef LARGE_DATASET
# define M 1900
# define N 2100
# endif
# ifdef EXTRALARGE_DATASET
# define M 1800
# define N 2200
# endif
#endif
/* !(M N) */
# define _PB_M POLYBENCH_LOOP_BOUND(M,m)
# define _PB_N POLYBENCH_LOOP_BOUND(N,n)
/* Default data type */
# if !defined(DATA_TYPE_IS_INT) && !defined(DATA_TYPE_IS_FLOAT) && !defined(DATA_TYPE_IS_DOUBLE)
# define DATA_TYPE_IS_DOUBLE
# endif
#ifdef DATA_TYPE_IS_INT
# define DATA_TYPE int
# define DATA_PRINTF_MODIFIER "%d "
#endif
#ifdef DATA_TYPE_IS_FLOAT
# define DATA_TYPE float
# define DATA_PRINTF_MODIFIER "%0.2f "
# define SCALAR_VAL(x) x##f
# define SQRT_FUN(x) sqrtf(x)
# define EXP_FUN(x) expf(x)
# define POW_FUN(x,y) powf(x,y)
# endif
#ifdef DATA_TYPE_IS_DOUBLE
# define DATA_TYPE double
# define DATA_PRINTF_MODIFIER "%0.2lf "
# define SCALAR_VAL(x) x
# define SQRT_FUN(x) sqrt(x)
# define EXP_FUN(x) exp(x)
# define POW_FUN(x,y) pow(x,y)
# endif
#endif
/* !_BICG_H */
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