Closed Ann-Geo closed 1 week ago
It has been a while since I looked at mpich vs openmpi etc but the relevant bits are in the top of the mpi.go and numeric.gen.go files:
#cgo pkg-config: ompi
#include "mpi.h"
You could do a quick workaround by changing those to whatever works for mpich
meanwhile, I'm not sure exactly how cgo works with tags etc to select this more systematically, but that is what we would need to do here. I'm happy to have a PR that implements this if you can get it working.
Thank you for your prompt reply. I was able to figure it out and get it working for MPICH library. This is what I changed in mpi.go and numeric_gen.go files
Instead of adding these CGO_CFLAGS and CGO_LDFLAGS can also be exported with their corresponding paths. After these changes I was able to build my application for MPICH using "go build -tags mpi -o main"
However, to extend this codebase to support both ompi and mpich how do I add both cases using conditional directives? For example for mpich build, it needs to skip the #cgo pkg-config: ompi. And similarly for ompi build, it should skip the FLAGS settings for mpich.
I tried a couple of ways using ifdef definitions and using two tags (//go:build mpich || ompi). But none of ways gave me successful build for either mpich or ompi. Would you have any suggestions ?
It looks like you can use the build tags right in the #cgo directives -- I'll give it a try: https://groups.google.com/g/golang-nuts/c/H5KaCPTO49A
Describe the feature
Is there support for MPICH for this package: cogentcore.org/core/base/mpi For example, building the code like go build -tags mpich -o main ?
Relevant code
No response