Closed harris-josh closed 9 months ago
would you mind merging out with the latest master
branch changes to trigger the test workflow?
also, if there are any test configurations you think should be covered there to demonstrate your fixes, it could be good to add them.
would you mind merging out with the latest
master
branch changes to trigger the test workflow?
thanks!
would you mind merging out with the latest
master
branch changes to trigger the test workflow?
I rebased on the lastest master
and force-pushed.
also, if there are any test configurations you think should be covered there to demonstrate your fixes, it could be good to add them.
Will do. One thing we've seen with macOS is that Ipopt seems to segfault when built with HSL (using a modified version of the Dymos double integrator example as a test). Runs fine with Mumps or with HSL on Ubuntu. I think that's another issue that's out of scope for this PR though (probably a problem with pyOptSparse itself?).
Instead of parsing the output of tar
I now inspect the tarfile with the Python standard library tarfile
module to get the folder name:
with tarfile.open(opts['hsl_tar_file'], 'r') as tf:
hsl_dir_name = tf.getnames()[0]
This should always return the directory name (assuming a valid input tarball) and avoid any issues with the regular expression based approach.
Also, I plan to add to the test matrix to have versions of the build that force compilation instead of using pre-compiled versions.
I added another three items to the workflow matrix to use the --force-build
flag for Ubuntu, Ubuntu latest, and macOS.
I disabled MPI for these builds as they would not complete due to a missing metis.h
(see this output for more info. I suspect the cause is the temporary folder with the METIS install getting cleaned up between stages but I am not familiar enough with GitHub Actions to say for certain.
There's probably a better way to add to the test matrix (I was hoping to not have to duplicate all the version numbers, for example) but again I'm pretty new to Actions and I'm not familiar with best practices yet.
I thought about a way to test an HSL build but couldn't think of one that I could implement due to licensing concerns.
Thank you for this contribution šš¼
Summary
This PR fixes several build issues when building pyOptSparse with Ipopt and HSL solvers.
The configuration logic for the Mumps and HSL builds was largely the same, so I refactored the common parts into a
get_common_solver_config_cmd
function in order to remove duplication; YMMV on whether this is a good change or not.This function sets up the arguments for the configure command and in particular:
-lm
needs to be explicitly included. I based this check on whether the OS was Linux or not; this is probably not the most reliable approach and probably merits changing. (It also probably doesn't hurt to just always include-lm
?)--disable-openmp
flag is provided. It's possible to build with OpenMP support, but I figured that wasn't worth it for this (see the "Notes" section below).I added a new key to the
sys_info
dictionary,gcc_is_apple_clang
, that is true if the compiled is detected as Apple clang viagcc --version
and false otherwise since Apple aliasesgcc
andg++
toclang
andclang++
on macOS by default. I added the logic for this flag to theselect_*_compilers
functions.For the HSL build, the logic to determine the directory name hard-coded the column of the name in the
tar
output, which depends on thetar
implementation used. This was not working on later versions of Ubuntu. Accordingly, the PR replaces thesubprocess.run
call totar
and subsequent parsing with direct use of thetarfile
module from the Python standard libary.I tested this with Mumps as the linear solver:
and HSL as the linear solver:
on both Ubuntu 22.04 and macOS and both built successfully.
Related Issues
Backwards incompatibilities
None
New Dependencies
The script now imports
tarfile
, but this is a part of the Python standard library and isn't really a new external dependency.Notes
It's possible to build Ipopt with Apple clang and OpenMP, but it requires the following:
CPPFLAGS
must be include-Xpreprocessor -fopenmp
CFLAGS
andCXXFLAGS
must include"-I$OMP_PATH/include"
LFLAGS
must include"-Wl,-rpath,$OMP_PATH/lib -L$OMP_PATH/lib -lomp"
The value of
OMP_PATH
above depends on the method of installation but is probably/opt/homebrew/opt/libomp
for Homebrew on Apple Silicon.I believe I also had to manually fix the output of the
coinhsl.pc
file for Ipopt when I last built it with OpenMP support on macOS.