Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/nvml/types_gen.go:9:10: undefined: _Ctype_struct_nvmlDevice_st #30

Open
wade-liwei opened this issue Mar 14, 2024 · 9 comments
Open
Labels
question Further information is requested

Comments

@wade-liwei
Copy link

How do you resolve the problem?
I saw you have the problem too.

NVIDIA/go-nvml#49

@roma-glushko
Copy link
Owner

@wade-liwei hey Wade 👋 sadly, I had to limit NVIDIA support to linux only in resbeat as nvml doesn't support any other OS (maybe windows, but it was not in the scope of this project).

So I had to add a dummy struct for non-linux platforms:

..and scope nvml usage to linux only:

@roma-glushko roma-glushko added the question Further information is requested label Mar 14, 2024
@wade-liwei
Copy link
Author

Could you please provide instructions on how to make a Docker image with your project?

@roma-glushko
Copy link
Owner

@wade-liwei do you want to use it as it was intended e.g. resbeat is installed as an agent into an existing docker image and broadcast utilization of that remaining stuff in the image? In that case, you can simply pull a built binary via curl, for example:

curl -fSL https://github.com/roma-glushko/resbeat/releases/download/1.0.4-dev5/resbeat_Linux_x86_64.tar.gz -o "./resbeat_Linux_x86_64.tar.gz" \
    && tar -vxf resbeat_Linux_x86_64.tar.gz \
    && chmod +x ./resbeat

and then make sure the resbeat is started in the image entrypoint.

You can also built a dedicated resbeat image, but on its own it's not that useful as there is nothing else that would utilize resources that resbeat can measure for you.

@wade-liwei
Copy link
Author

got it,
Thank you so much.
But I am not sure the resbeat in alpine work or not.

@roma-glushko
Copy link
Owner

@wade-liwei yeah, it should work in alpine-based images 👀
I was actually building it in alpine image for dev purposes: https://github.com/roma-glushko/resbeat/blob/main/Dockerfile#L3

@wade-liwei
Copy link
Author

Thank you, good man.

@wade-liwei
Copy link
Author

hey man

On the 3080 machine, I run the command "make image-build", work ok.
then I run the command "make image" and get the following errors:


[build 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -o /service/resbeat:
5.582 # github.com/NVIDIA/go-nvml/pkg/nvml
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/types_gen.go:9:10: undefined: _Ctype_struct_nvmlDevice_st
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/types_gen.go:320:10: undefined: _Ctype_struct_nvmlUnit_st
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/types_gen.go:358:10: undefined: _Ctype_struct_nvmlEventSet_st
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/types_gen.go:505:10: undefined: _Ctype_struct_nvmlGpuInstance_st
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/types_gen.go:548:10: undefined: _Ctype_struct_nvmlComputeInstance_st
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/types_gen.go:552:10: undefined: _Ctype_struct_nvmlGpmSample_st
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/device.go:22:19: undefined: MemoryErrorType
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/device.go:25:29: undefined: Return
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/device.go:32:49: undefined: Return
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/device.go:39:54: undefined: Return
5.582 /go/pkg/mod/github.com/!n!v!i!d!i!a/go-nvml@v0.12.0-1/pkg/nvml/device.go:39:54: too many errors

@wade-liwei
Copy link
Author

I read your build.Dockerfile file, in the file, you just copy go code into the docker image.
In the Dockerfile, build stage,RUN CGO_ENABLED=0 GOOS=linux go build -o /service/resbeat
but failed.

@roma-glushko
Copy link
Owner

@wade-liwei sorry about delay, Wade 🙏

https://github.com/roma-glushko/resbeat/blob/main/Makefile#L35-L40 - make image may not work with GPU monitoring, you are right. After I introduced that NVML dependency, the binary will be possible to built fully only with NVIDIA tooling in place (which is present in make image-built command since it's using a Dockerfile that is based on a CUDA image

https://github.com/roma-glushko/resbeat/blob/main/build.Dockerfile#L5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants