Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MojitOS
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
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
sepia-pub
MojitOS
Commits
a7ae9dc8
Commit
a7ae9dc8
authored
2 years ago
by
floreal.risso
Browse files
Options
Downloads
Patches
Plain Diff
clean up
parent
bd68a69a
No related branches found
No related tags found
2 merge requests
!9
fix sensor example (doc)
,
!5
Add dev name to labels
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nvidia_gpu.c
+1
-54
1 addition, 54 deletions
src/nvidia_gpu.c
with
1 addition
and
54 deletions
src/nvidia_gpu.c
+
1
−
54
View file @
a7ae9dc8
...
@@ -18,13 +18,12 @@
...
@@ -18,13 +18,12 @@
*******************************************************/
*******************************************************/
// -- test :
// gcc -std=gnu99 -Wall -Wextra -Wpedantic -fsanitize=address -D__NVIDIA__MAIN__TEST nvidia_gpu.c -I/lib -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lnvidia-ml
#include
<stdio.h>
#include
<stdio.h>
#include
<stdint.h>
#include
<stdint.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
// Pedantic throws a warning in the nvml library
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#pragma GCC diagnostic ignored "-Wpedantic"
#include
<nvml.h>
#include
<nvml.h>
...
@@ -428,16 +427,6 @@ void clean_temperature_sensor(void *data)
...
@@ -428,16 +427,6 @@ void clean_temperature_sensor(void *data)
{
{
free
(
data
);
free
(
data
);
}
}
// // Get the temperature
// result = nvmlDeviceGetTemperature(device, NVML_TEMPERATURE_GPU, &temperature);
// if (NVML_SUCCESS != result) {
// printf("Failed to get temperature for device %d: %s\n", i, nvmlErrorString(result));
// continue;
// }
// printf("\t - temperature: %u\n", temperature);
// ----------------------------------------
// -------------------------AVAIBLE_SENSORS
// -------------------------AVAIBLE_SENSORS
static
const
ISensor
avaible_sensors
[
COUNT_SENSOR
]
=
{
static
const
ISensor
avaible_sensors
[
COUNT_SENSOR
]
=
{
...
@@ -602,45 +591,3 @@ void clean_nvidia_gpu(void *ptr)
...
@@ -602,45 +591,3 @@ void clean_nvidia_gpu(void *ptr)
nvmlShutdown
();
nvmlShutdown
();
}
}
// -------------------------------TEST_MAIN
#ifdef __NVIDIA__MAIN__TEST
int
main
()
{
void
*
ptr
=
NULL
;
char
*
none
=
NULL
;
unsigned
int
sensor_count
=
init_nvidia_gpu
(
none
,
&
ptr
);
NvidiaGpu
*
nvidia
=
(
NvidiaGpu
*
)
ptr
;
printf
(
"%d
\n
"
,
nvidia
->
count
);
printf
(
"%u
\n
"
,
sensor_count
);
uint64_t
results
[
sensor_count
];
char
*
labels
[
sensor_count
];
memset
(
results
,
0
,
sensor_count
*
sizeof
(
uint64_t
));
memset
(
labels
,
0
,
sensor_count
*
sizeof
(
char
**
));
unsigned
count_label
=
label_nvidia_gpu
(
labels
,
ptr
);
unsigned
count_get
=
get_nvidia_gpu
(
results
,
ptr
);
printf
(
"total : %u, get : %u, label : %u
\n
"
,
sensor_count
,
count_get
,
count_label
);
for
(
unsigned
int
i
=
0
;
i
<
sensor_count
;
i
++
)
{
printf
(
"%s "
,
labels
[
i
]);
}
printf
(
"
\n
"
);
for
(
unsigned
int
i
=
0
;
i
<
sensor_count
;
i
++
)
{
printf
(
"%lu "
,
results
[
i
]);
}
printf
(
"
\n
"
);
printf
(
"sensor_count: %d
\n
"
,
sensor_count
);
clean_nvidia_gpu
(
ptr
);
}
#endif
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