What is strange is that if I take the function call that uses cubit and put it into its own script, it works fine, but in this script, where the function call is within another function, I am getting this error.
Most likely your other function is loading a different HDF5 library from somewhere other than the Coreform-Cubit-2021.11/bin folder. That other HDF5 library doesn’t have the function H5Pset_dxpl_mpio that we require, thus the error. Do you have another installation of HDF5 somewhere on your system?
conda env config vars sets an environment variable within your conda environment. The hdf5=1.12.*=mpi_openmpi* is not an environment variable, it’s a version specification string to tell conda what version of hdf5 to install in your environment. The string tells conda to install the openmpi variant of HDF5 version 1.12. Use it like this:
If that fails to solve, that likely means that your environment has conflicting library dependencies. You can try to loosen that by changing the version string to something like this: hdf5=*=mpi, which won’t pin the version of HDF5 to be the same as Cubit’s, but at least it’ll get a parallel version built against MPI.
That’s not really a problem with conda itself, it has to do with conflicting mpi versions. You have libraries in your conda environment that use the MPICH implementation of MPI, and Cubit uses the OpenMPI implementation of MPI. The two are not compatible. This is an unfortunate feature of the scientific computing landscape, almost everything needs to be built against the same implementation of MPI. The solution here is to go through your conda environment and make sure all your dependencies use the OpenMPI variant instead of the the MPICH variant, specifying the *mpi_openmpi section of the version string like above. It’s probably best if you create an environment.yml file and use that to fully specify your conda environment, see Managing environments — conda 4.13.0.post29+660f9d90 documentation.
This is a huge pain, unfortunately, but it’s the only way of making sure that all your dependencies are compatible. In computer science we call this dependency hell, and it’s something you’re sure to run into once your C/C++ program does much of anything non-trivial. Python tries to handle this for you, but Python is really just C under the hood and there’s only so much it can do.