roma-glushko / resbeat

🔊 Broadcast resource utilization of the container to the rest of the system via HTTP/websocket protocols
MIT License
2 stars 0 forks source link

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

Open wade-liwei opened 8 months ago

wade-liwei commented 8 months ago

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

https://github.com/NVIDIA/go-nvml/issues/49

roma-glushko commented 8 months ago

@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:

wade-liwei commented 8 months ago

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

roma-glushko commented 8 months ago

@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 commented 8 months ago

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

roma-glushko commented 8 months ago

@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 commented 8 months ago

Thank you, good man.

wade-liwei commented 8 months ago

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 commented 8 months ago

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 commented 7 months ago

@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