Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
95e744be
Unverified
Commit
95e744be
authored
May 06, 2025
by
Michael Yang
Committed by
GitHub
May 06, 2025
Browse files
discover: fix compiler warnings (#10572)
parent
3b2d2c83
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
discover/gpu_info.h
discover/gpu_info.h
+2
-0
discover/gpu_info_cudart.c
discover/gpu_info_cudart.c
+5
-4
discover/gpu_info_nvcuda.c
discover/gpu_info_nvcuda.c
+4
-3
No files found.
discover/gpu_info.h
View file @
95e744be
...
@@ -27,12 +27,14 @@
...
@@ -27,12 +27,14 @@
#endif
#endif
#ifndef LOG
#define LOG(verbose, ...) \
#define LOG(verbose, ...) \
do { \
do { \
if (verbose) { \
if (verbose) { \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, __VA_ARGS__); \
} \
} \
} while (0)
} while (0)
#endif
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
...
discover/gpu_info_cudart.c
View file @
95e744be
#ifndef __APPLE__ // TODO - maybe consider nvidia support on intel macs?
#ifndef __APPLE__ // TODO - maybe consider nvidia support on intel macs?
#include <string.h>
#include <string.h>
#include <inttypes.h>
#include "gpu_info_cudart.h"
#include "gpu_info_cudart.h"
void
cudart_init
(
char
*
cudart_lib_path
,
cudart_init_resp_t
*
resp
)
{
void
cudart_init
(
char
*
cudart_lib_path
,
cudart_init_resp_t
*
resp
)
{
...
@@ -168,9 +169,9 @@ void cudart_bootstrap(cudart_handle_t h, int i, mem_info_t *resp) {
...
@@ -168,9 +169,9 @@ void cudart_bootstrap(cudart_handle_t h, int i, mem_info_t *resp) {
resp
->
free
=
memInfo
.
free
;
resp
->
free
=
memInfo
.
free
;
resp
->
used
=
memInfo
.
used
;
resp
->
used
=
memInfo
.
used
;
LOG
(
h
.
verbose
,
"[%s] CUDA totalMem %
llu
\n
"
,
resp
->
gpu_id
,
resp
->
total
);
LOG
(
h
.
verbose
,
"[%s] CUDA totalMem %
"
PRId64
"
\n
"
,
resp
->
gpu_id
,
resp
->
total
);
LOG
(
h
.
verbose
,
"[%s] CUDA freeMem %
llu
\n
"
,
resp
->
gpu_id
,
resp
->
free
);
LOG
(
h
.
verbose
,
"[%s] CUDA freeMem %
"
PRId64
"
\n
"
,
resp
->
gpu_id
,
resp
->
free
);
LOG
(
h
.
verbose
,
"[%s] CUDA usedMem %
llu
\n
"
,
resp
->
gpu_id
,
resp
->
used
);
LOG
(
h
.
verbose
,
"[%s] CUDA usedMem %
"
PRId64
"
\n
"
,
resp
->
gpu_id
,
resp
->
used
);
LOG
(
h
.
verbose
,
"[%s] Compute Capability %d.%d
\n
"
,
resp
->
gpu_id
,
resp
->
major
,
resp
->
minor
);
LOG
(
h
.
verbose
,
"[%s] Compute Capability %d.%d
\n
"
,
resp
->
gpu_id
,
resp
->
major
,
resp
->
minor
);
}
}
...
...
discover/gpu_info_nvcuda.c
View file @
95e744be
#ifndef __APPLE__ // TODO - maybe consider nvidia support on intel macs?
#ifndef __APPLE__ // TODO - maybe consider nvidia support on intel macs?
#include <string.h>
#include <string.h>
#include <inttypes.h>
#include "gpu_info_nvcuda.h"
#include "gpu_info_nvcuda.h"
void
nvcuda_init
(
char
*
nvcuda_lib_path
,
nvcuda_init_resp_t
*
resp
)
{
void
nvcuda_init
(
char
*
nvcuda_lib_path
,
nvcuda_init_resp_t
*
resp
)
{
...
@@ -193,8 +194,8 @@ void nvcuda_bootstrap(nvcuda_handle_t h, int i, mem_info_t *resp) {
...
@@ -193,8 +194,8 @@ void nvcuda_bootstrap(nvcuda_handle_t h, int i, mem_info_t *resp) {
resp
->
total
=
memInfo
.
total
;
resp
->
total
=
memInfo
.
total
;
resp
->
free
=
memInfo
.
free
;
resp
->
free
=
memInfo
.
free
;
LOG
(
h
.
verbose
,
"[%s] CUDA totalMem %
llu
mb
\n
"
,
resp
->
gpu_id
,
resp
->
total
/
1024
/
1024
);
LOG
(
h
.
verbose
,
"[%s] CUDA totalMem %
"
PRId64
"
mb
\n
"
,
resp
->
gpu_id
,
resp
->
total
/
1024
/
1024
);
LOG
(
h
.
verbose
,
"[%s] CUDA freeMem %
llu
mb
\n
"
,
resp
->
gpu_id
,
resp
->
free
/
1024
/
1024
);
LOG
(
h
.
verbose
,
"[%s] CUDA freeMem %
"
PRId64
"
mb
\n
"
,
resp
->
gpu_id
,
resp
->
free
/
1024
/
1024
);
LOG
(
h
.
verbose
,
"[%s] Compute Capability %d.%d
\n
"
,
resp
->
gpu_id
,
resp
->
major
,
resp
->
minor
);
LOG
(
h
.
verbose
,
"[%s] Compute Capability %d.%d
\n
"
,
resp
->
gpu_id
,
resp
->
major
,
resp
->
minor
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment