Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
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
Model registry
Operate
Environments
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
llvm
hpvm-release
Commits
848262b4
Commit
848262b4
authored
5 years ago
by
Elizabeth
Browse files
Options
Downloads
Patches
Plain Diff
Added check to see if code is run on Jetson board
parent
68632c71
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/projects/gpu_profiler/include/profiler.h
+5
-0
5 additions, 0 deletions
llvm/projects/gpu_profiler/include/profiler.h
llvm/projects/gpu_profiler/src/profiler.cpp
+25
-12
25 additions, 12 deletions
llvm/projects/gpu_profiler/src/profiler.cpp
with
30 additions
and
12 deletions
llvm/projects/gpu_profiler/include/profiler.h
+
5
−
0
View file @
848262b4
...
@@ -65,6 +65,11 @@ private:
...
@@ -65,6 +65,11 @@ private:
const
std
::
string
ddr_power_rail
=
"/sys/devices/3160000.i2c/i2c-0/0-0041/iio_device/in_power2_input"
;
const
std
::
string
ddr_power_rail
=
"/sys/devices/3160000.i2c/i2c-0/0-0041/iio_device/in_power2_input"
;
const
std
::
string
soc_power_rail
=
"/sys/devices/3160000.i2c/i2c-0/0-0040/iio_device/in_power1_input"
;
const
std
::
string
soc_power_rail
=
"/sys/devices/3160000.i2c/i2c-0/0-0040/iio_device/in_power1_input"
;
const
std
::
string
sys_power_rail
=
"/sys/devices/3160000.i2c/i2c-0/0-0041/iio_device/in_power0_input"
;
const
std
::
string
sys_power_rail
=
"/sys/devices/3160000.i2c/i2c-0/0-0041/iio_device/in_power0_input"
;
// Critical assumption: If this file doesn't exist, then the board isn't a Jetson
const
std
::
string
jetson_chip_id
=
"/sys/module/tegra_fuse/parameters/tegra_chip_id"
;
// True if running on Jetson, else false
bool
on_jetson_
;
// An individual power reading
// An individual power reading
struct
PowerReading
{
struct
PowerReading
{
...
...
This diff is collapsed.
Click to expand it.
llvm/projects/gpu_profiler/src/profiler.cpp
+
25
−
12
View file @
848262b4
#include
"profiler.h"
#include
"profiler.h"
Profiler
::
Profiler
()
:
should_run_profiler_
(
false
),
should_stop_profiler_
(
false
)
{
Profiler
::
Profiler
()
:
should_run_profiler_
(
false
),
should_stop_profiler_
(
false
)
{
// Open all streams. Not done in start_profiler() function bc the streams
// Open all streams. Not done in start_profiler() function bc the streams
...
@@ -9,8 +9,14 @@ Profiler::Profiler() : should_run_profiler_(false), should_stop_profiler_(false)
...
@@ -9,8 +9,14 @@ Profiler::Profiler() : should_run_profiler_(false), should_stop_profiler_(false)
soc_stream_
.
open
(
soc_power_rail
,
std
::
ifstream
::
in
);
soc_stream_
.
open
(
soc_power_rail
,
std
::
ifstream
::
in
);
sys_stream_
.
open
(
sys_power_rail
,
std
::
ifstream
::
in
);
sys_stream_
.
open
(
sys_power_rail
,
std
::
ifstream
::
in
);
if
(
!
cpu_stream_
.
is_open
()
||
!
gpu_stream_
.
is_open
()
||
!
ddr_stream_
.
is_open
()
// Check if the jetson file id file exists to indirectly check architecture
||
!
soc_stream_
.
is_open
()
||
!
sys_stream_
.
is_open
())
{
std
::
ifstream
jetson_file
(
jetson_chip_id
);
on_jetson_
=
jetson_file
.
good
();
if
(
on_jetson_
&&
(
!
cpu_stream_
.
is_open
()
||
!
gpu_stream_
.
is_open
()
||
!
ddr_stream_
.
is_open
()
||
!
soc_stream_
.
is_open
()
||
!
sys_stream_
.
is_open
()))
{
std
::
cout
<<
"Failed to open one of the power rails for reading
\n
"
;
std
::
cout
<<
"Failed to open one of the power rails for reading
\n
"
;
exit
(
1
);
exit
(
1
);
}
}
...
@@ -68,16 +74,23 @@ void Profiler::pause_profiler() {
...
@@ -68,16 +74,23 @@ void Profiler::pause_profiler() {
// Returns this as a pair of <delta time in milliseconds, energy>
// Returns this as a pair of <delta time in milliseconds, energy>
std
::
pair
<
double
,
double
>
Profiler
::
get_time_energy
()
const
{
std
::
pair
<
double
,
double
>
Profiler
::
get_time_energy
()
const
{
double
total_energy
=
0.0
;
double
total_energy
=
0.0
;
double
delta_time
=
0.0
;
std
::
chrono
::
time_point
<
std
::
chrono
::
high_resolution_clock
>
prev_time
=
start_time_
;
for
(
auto
reading
:
power_readings_
)
{
if
(
on_jetson_
)
{
std
::
chrono
::
duration
<
double
>
duration
=
reading
.
time_
-
prev_time
;
std
::
chrono
::
time_point
<
std
::
chrono
::
high_resolution_clock
>
prev_time
=
start_time_
;
total_energy
+=
reading
.
gpu_
*
duration
.
count
();
for
(
auto
reading
:
power_readings_
)
{
total_energy
+=
reading
.
ddr_
*
duration
.
count
();
std
::
chrono
::
duration
<
double
>
duration
=
reading
.
time_
-
prev_time
;
prev_time
=
reading
.
time_
;
total_energy
+=
reading
.
gpu_
*
duration
.
count
();
total_energy
+=
reading
.
ddr_
*
duration
.
count
();
prev_time
=
reading
.
time_
;
}
delta_time
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
prev_time
-
start_time_
).
count
();
}
else
{
auto
last_reading_time
=
power_readings_
[
power_readings_
.
size
()
-
1
].
time_
;
delta_time
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
last_reading_time
-
start_time_
).
count
();
}
}
double
delta_time
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
prev_time
-
start_time_
).
count
();
return
std
::
make_pair
(
delta_time
,
total_energy
);
return
std
::
make_pair
(
delta_time
,
total_energy
);
}
}
...
...
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