-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathapp.c
44 lines (37 loc) · 808 Bytes
/
app.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// app.c
#include "gddr6.h"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
void register_signal_handlers(void)
{
struct sigaction sa;
sa.sa_handler = gddr6_cleanup;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGINT, &sa, NULL);
sigaction(SIGHUP, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
}
int main(int argc, char **argv)
{
register_signal_handlers();
gddr6_init();
int num_devs = gddr6_detect_compatible_gpus();
if (num_devs == 0)
{
fprintf(stderr, "No compatible GPU found.\n");
return 1;
}
gddr6_memory_map();
if (argc >= 2 && !strcmp(argv[1], "-j"))
{
gddr6_print_temperatures_json();
}
else
{
gddr6_monitor_temperatures();
}
return 0;
}