-
Notifications
You must be signed in to change notification settings - Fork 4
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
bug: update with module and fix empty struct #2
base: dev
Are you sure you want to change the base?
Conversation
Problem: the current version does not have a go module, and the build / run will fail with recent versions of go (cgo) that do not allow creating an empty struct. This is an attempt to fix that. I will need to test it to see if it actually works. I am also adding GitHub CI (to run go test) along with a VSCode developer container environment that has hwloc ready to go for easier development. Signed-off-by: vsoch <[email protected]>
Ah I think I see the issues you were probably running into? Go doesn't like the static bit for a module: /tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking I tried building hwloc as a non static library, that doesn't work either. make[3]: Entering directory '/opt/hwloc/utils/hwloc'
CCLD hwloc-annotate
/usr/bin/ld: attempted static link of dynamic object `/opt/hwloc/hwloc/.libs/libhwloc.so'
collect2: error: ld returned 1 exit status I'll ping some of my colleagues and see if they have any ideas. We wanted to use this for a compatibility checking tool for applications and containers (for OCI) but seems like it might be the wrong tool if it's impossible to use. |
Thanks for your great PR.
If you want to use libhwloc as a shared lib, suggest removing the lines like |
* test: building without libgcc Signed-off-by: vsoch <[email protected]>
That worked! I've updated the PR here. Quick question for you - what is a "hello world" example for using this? I've been trying to do a basic init and then "print something out I can see" - my first effort the print segfaulted, and then I followed a pattern in a test and it doesn't segfault (but I don't see anything). I'm new to using hwloc outside of the command line tools so apologies for my naivete. Here is what I am testing: topo, err := hwloc.NewTopology()
if err != nil {
return info, err
}
err = topo.Load()
if err != nil {
return info, err
}
nodeSet := topo.HwlocGetNUMANodeObjByOSIndex(0)
topo.HwlocSetMemBind(nodeSet, hwloc.HwlocMemBindBind, hwloc.HwlocMemBindThread|hwloc.HwlocMemBindByNodeSet)
nodes, err := nodeSet.Values()
if err != nil {
return info, err
}
for _, node := range nodes {
fmt.Println(node)
} I'm mostly looking to print out metadata / see what I have to work with. |
To check the result of |
I'm generally interested in getting the equivalent output that I might get for lstopo or in the xml file generated - I'm not a C programmer so the "it's easy" part is probably not applicable here! 😆 Do you have examples / know someone that has used your library that might help me get started? |
Sorry for replying late. This repo was used to enable NUMA support on GxMiner. |
No worries, and thanks! I will likely take a look in the next few weeks (just very busy this week). |
Problem: the current version does not have a go module, and the build / run will fail with recent versions of go (cgo) that do not allow creating an empty struct. This is an attempt to fix that. I will need to test it to see if it actually works. I am also adding GitHub CI (to run go test) along with a VSCode developer container environment that has hwloc ready to go for easier development.
I'm going to do a quick test with my branch here (via a PR that specifies a different module path) and can report back.