Skip to content
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

Add support for macOS (everything but HSL solvers) #69

Closed
adowling2 opened this issue Jan 14, 2021 · 63 comments
Closed

Add support for macOS (everything but HSL solvers) #69

adowling2 opened this issue Jan 14, 2021 · 63 comments
Assignees
Labels
Priority:Normal Normal Priority Issue or PR

Comments

@adowling2
Copy link
Contributor

Goal: update idaes get-extensions to partially work with macOS.

Here is what happens when I run sh ./scripts/compile_libs.sh:

--2021-01-14 14:25:33--  https://coin-or-tools.github.io/ThirdParty-ASL/solvers-20180528.tgz
Resolving coin-or-tools.github.io (coin-or-tools.github.io)... 185.199.111.153, 185.199.108.153, 185.199.109.153, ...
Connecting to coin-or-tools.github.io (coin-or-tools.github.io)|185.199.111.153|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 349280 (341K) [application/octet-stream]
Saving to: ‘solvers-20180528.tgz’

solvers-20180528.tgz                       100%[=======================================================================================>] 341.09K  --.-KB/s    in 0.03s   

2021-01-14 14:25:33 (9.73 MB/s) - ‘solvers-20180528.tgz’ saved [349280/349280]

x solvers/
x solvers/r_op.hd
x solvers/obj2val.c
x solvers/r_qp.hd
x solvers/fpinitmt.c
x solvers/duthes.c
x solvers/wsu_desc.c
x solvers/sos_add.c
x solvers/punknown.c
x solvers/amplsolv.sy
x solvers/xp2known.c
x solvers/comeval.c
x solvers/stdio1.h0
x solvers/func_add.c
x solvers/mainexit.c
x solvers/op_typeb.hd
x solvers/fg_read.c
x solvers/funcadd0.c
x solvers/funcadd1.c
x solvers/funcaddk.c
x solvers/funcaddr.c
x solvers/asl.h
x solvers/fgh_read.c
x solvers/nlp.h
x solvers/errchk.h
x solvers/asl_pfgh.h
x solvers/makefile.wat
x solvers/fg_write.c
x solvers/README
x solvers/asl_pfg.h
x solvers/com2eval.c
x solvers/basename.c
x solvers/configure
x solvers/r_opn.hd
x solvers/conscale.c
x solvers/rops2.c
x solvers/nqpcheck.c
x solvers/asldate.c
x solvers/opcode.hd
x solvers/dtoa1.c
x solvers/fpsetprec.s
x solvers/avltree.c
x solvers/avltree.h
x solvers/auxinfo.c
x solvers/dvalue.hd
x solvers/fpsetprec64.s
x solvers/op_type.hd
x solvers/jacinc1.c
x solvers/objconst.c
x solvers/writesol.c
x solvers/repwhere.c
x solvers/qpcheckZ.c
x solvers/bscanf.c
x solvers/studchk0.c
x solvers/fpinit.c
x solvers/jacpdim.h
x solvers/conpval.c
x solvers/sigcatch.c
x solvers/sphes.c
x solvers/qpcheck.c
x solvers/fullhes.c
x solvers/g_fmt.c
x solvers/nl_obj.c
x solvers/arith.ibm
x solvers/atof.c
x solvers/names.c
x solvers/r_opn0.hd
x solvers/configurehere
x solvers/conadj.c
x solvers/xp1known.c
x solvers/jacdim.c
x solvers/dtoa.c
x solvers/indic_cons.c
x solvers/jacinc.c
x solvers/getenv.c
x solvers/conval.c
x solvers/obj_adj0.c
x solvers/libnamsave.c
x solvers/jac0dim.c
x solvers/00lastchange
x solvers/htcl.c
x solvers/xectim.c
x solvers/mip_pri.c
x solvers/pfg_read.c
x solvers/degree.c
x solvers/jac2dim.c
x solvers/jac2dim.h
x solvers/con2val.c
x solvers/derprop.c
x solvers/qsortv.c
x solvers/funcadd.c
x solvers/funcadd.h
x solvers/sscanf.c
x solvers/mach.c
x solvers/misc.c
x solvers/genrowno.c
x solvers/getstub.c
x solvers/getstub.h
x solvers/obj_adj.c
x solvers/obj_adj.h
x solvers/nlp2.h
x solvers/nqpcheckZ.c
x solvers/README.f77
x solvers/value.c
x solvers/mpec_adj.c
x solvers/wrtsol_.c
x solvers/mypow.c
x solvers/rops.c
x solvers/arith.h0
x solvers/sjac0dim.c
x solvers/amplsolv.lbc
x solvers/obj_prec.c
x solvers/con1ival.c
x solvers/objval.c
x solvers/printf.c
x solvers/stderr.c
x solvers/sprintf.c
x solvers/op_type.c
x solvers/arithchk.c
x solvers/rnd_prod.s
x solvers/xsum0.out
x solvers/opnos.hd
x solvers/makefile.lc
x solvers/makefile.sy
x solvers/makefile.vc
x solvers/b_search.c
x solvers/float.h0
x solvers/suf_sos.c
x solvers/pfghread.c
x solvers/con2ival.c
x solvers/mqpcheckv.c
x solvers/psinfo.h
x solvers/objval_.c
x solvers/strerror.c
x solvers/mpec_adj0.c
x solvers/comptry.bat
x solvers/qp_read.c
x solvers/fpecatch.c
x solvers/changes
x solvers/dynlink.c
x solvers/x2check.c
x solvers/ws_desc.c
x solvers/details.c0
x solvers/pshvprod.c
x solvers/readsol.c
x solvers/makefile.u
x solvers/f_read.c
cd ${OBJDIR=sys.`uname -m`.`uname -s`}; make
x86_64-apple-darwin13.4.0-clang -c -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -DASL_NO_FPINITMT fpinit.c
x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe arithchk.c fpinit.o -lm ||\
	 x86_64-apple-darwin13.4.0-clang -DNO_LONG_LONG -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe arithchk.c fpinit.o -lm ||\
	 x86_64-apple-darwin13.4.0-clang -DNO_SSIZE_T -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe arithchk.c fpinit.o -lm ||\
	 x86_64-apple-darwin13.4.0-clang -DNO_LONG_LONG -DNO_SSIZE_T -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe arithchk.c fpinit.o -lm
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd
Undefined symbols for architecture x86_64:
  "___error", referenced from:
      _main in arithchk-69a302.o
  "___stack_chk_fail", referenced from:
      _get_nanbits in arithchk-69a302.o
      _fpinit_ASL in fpinit.o
  "___stack_chk_guard", referenced from:
      _get_nanbits in arithchk-69a302.o
      _fpinit_ASL in fpinit.o
  "___stdoutp", referenced from:
      _main in arithchk-69a302.o
  "_acos", referenced from:
      _main in arithchk-69a302.o
  "_asin", referenced from:
      _main in arithchk-69a302.o
  "_exp", referenced from:
      _main in arithchk-69a302.o
  "_fprintf", referenced from:
      _main in arithchk-69a302.o
  "_fwrite", referenced from:
      _main in arithchk-69a302.o
  "_log", referenced from:
      _main in arithchk-69a302.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd
ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture x86_64:
  "___error", referenced from:
      _main in arithchk-ae2b3e.o
  "___stack_chk_fail", referenced from:
      _get_nanbits in arithchk-ae2b3e.o
      _fpinit_ASL in fpinit.o
  "___stack_chk_guard", referenced from:
      _get_nanbits in arithchk-ae2b3e.o
      _fpinit_ASL in fpinit.o
  "___stdoutp", referenced from:
      _main in arithchk-ae2b3e.o
  "_acos", referenced from:
      _main in arithchk-ae2b3e.o
  "_asin", referenced from:
      _main in arithchk-ae2b3e.o
  "_exp", referenced from:
      _main in arithchk-ae2b3e.o
  "_fprintf", referenced from:
      _main in arithchk-ae2b3e.o
  "_fwrite", referenced from:
      _main in arithchk-ae2b3e.o
  "_log", referenced from:
      _main in arithchk-ae2b3e.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture x86_64:
  "___error", referenced from:
      _main in arithchk-f9e3bb.o
  "___stack_chk_fail", referenced from:
      _get_nanbits in arithchk-f9e3bb.o
      _fpinit_ASL in fpinit.o
  "___stack_chk_guard", referenced from:
      _get_nanbits in arithchk-f9e3bb.o
      _fpinit_ASL in fpinit.o
  "___stdoutp", referenced from:
      _main in arithchk-f9e3bb.o
  "_acos", referenced from:
      _main in arithchk-f9e3bb.o
  "_asin", referenced from:
      _main in arithchk-f9e3bb.o
  "_exp", referenced from:
      _main in arithchk-f9e3bb.o
  "_fprintf", referenced from:
      _main in arithchk-f9e3bb.o
  "_fwrite", referenced from:
      _main in arithchk-f9e3bb.o
  "_log", referenced from:
      _main in arithchk-f9e3bb.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libm.tbd
Undefined symbols for architecture x86_64:
  "___error", referenced from:
      _main in arithchk-773485.o
  "___stack_chk_fail", referenced from:
      _get_nanbits in arithchk-773485.o
      _fpinit_ASL in fpinit.o
  "___stack_chk_guard", referenced from:
      _get_nanbits in arithchk-773485.o
      _fpinit_ASL in fpinit.o
  "___stdoutp", referenced from:
      _main in arithchk-773485.o
  "_acos", referenced from:
      _main in arithchk-773485.o
  "_asin", referenced from:
      _main in arithchk-773485.o
  "_exp", referenced from:
      _main in arithchk-773485.o
  "_fprintf", referenced from:
      _main in arithchk-773485.o
  "_fwrite", referenced from:
      _main in arithchk-773485.o
  "_log", referenced from:
      _main in arithchk-773485.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [arith.h] Error 1
make: *** [amplsolver] Error 2
/Library/Developer/CommandLineTools/usr/bin/make -C ./helmholtz/iapws95
cp ../common/helmholtz* ./
echo '#include"iapws95_param.h"' > helmholtz_param.h
sed s/EOS_TAG/iapws95/g helmholtz_asl_funcs.h > tmp
mv tmp helmholtz_asl_funcs.h
sed s/EOS_TAG/iapws95/g helmholtz_asl_funcs.cpp > tmp
mv tmp helmholtz_asl_funcs.cpp
g++ -c -Wall -Wextra -O3 -static -fPIC -I/Users/adowling/idaes-ext/solvers/sys.x86_64.Darwin -std=c++0x -fPIC helmholtz_external.cpp -o helmholtz_external.o
In file included from helmholtz_external.cpp:26:
helmholtz_memo.h:22:9: fatal error: boost/functional/hash.hpp: No such file or directory
   22 | #include<boost/functional/hash.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [helmholtz_external.o] Error 1
make: *** [iapws95] Error 2
cp: ../src/dist/*.so: No such file or directory
a license_lib.txt
a tmp
a version_lib.txt

@eslickj @michaelbynum @ksbeattie any thoughts?

@adowling2
Copy link
Contributor Author

Looks like my machine is using clang by default. We want to use gfortran instead.

@eslickj
Copy link
Member

eslickj commented Jan 14, 2021

Looks like you don't have boost libraries installed. I set the scripts up to use gcc. Not really sure about clang. For some things it may work, but I probably hard coded gcc into the property library make files.

@adowling2
Copy link
Contributor Author

I set CC=/usr/bin/gcc in the make script (ugly). You are correct I'm missing boost.

@adowling2
Copy link
Contributor Author

I installed boost with conda install -c conda-forge boost.

@adowling2
Copy link
Contributor Author

Now I'm getting this error message:

In file included from helmholtz_external.cpp:26:
helmholtz_memo.h:22:9: fatal error: boost/functional/hash.hpp: No such file or directory
   22 | #include<boost/functional/hash.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [helmholtz_external.o] Error 1

@eslickj
Copy link
Member

eslickj commented Jan 14, 2021

For this you'll want to install, guessing, something like libboost-dev with home brew.

@adowling2
Copy link
Contributor Author

I removed boost with conda and ran conda install -c statiskit libboost-dev.

@eslickj
Copy link
Member

eslickj commented Jan 14, 2021

I searched a bit maybe brew install boost. I don't think conda will put it where the compilers are looking by default unless you got the compiler with conda too. There is something in your environment I guess that sets where to look for header files.

@adowling2
Copy link
Contributor Author

adowling2 commented Jan 14, 2021

Yep, I'm trying brew install boost now. Update: That did not work. Next steps for me:

@eslickj
Copy link
Member

eslickj commented Jan 14, 2021

You can set the BOOST_HEADER environment variable as described her https://github.com/IDAES/idaes-ext/blob/main/src/Makefile.in. Boost used to be a bigger issue before everything came precompiled. A lot of boost is implemented in header files, so I think if you have it and can track down the headers that's enough to make it work.

@adowling2
Copy link
Contributor Author

I got it to work. I pushed my code as a new branch: adowling2-macos. I hardcoded things.

@adowling2
Copy link
Contributor Author

I now have ./dist-lib/idaes-lib--64.tar.gz. Is this the file we want to test release?

@eslickj
Copy link
Member

eslickj commented Jan 14, 2021

Yeah. There is an OS string missing. I guess you had no way to know to set an environment variable for it. Anyway between the two -- goes darwin so you can rename it idaes-lib-darwin-64.tar.gz

@adowling2
Copy link
Contributor Author

adowling2 commented Jan 14, 2021

@eslickj @ksbeattie @michaelbynum I successfully compiled the IDAES-specific libraries (e.g., thermo functions). See my email for the file.

I think the next step is to post this to GitHub. I see there are a few special ways to run get-extensions:

idaes get-extensions --release <tag>

or

idaes get-extensions --url <URL>

My suggestion is to use the URL option. I can then try on my macOS laptop. (I compiled these on my macOS desktop.) If that works, I can get a few macOS users in my group to give it a try.

I anticipate we'll run into a few more snags to get this working on the first computer we test.

@adowling2
Copy link
Contributor Author

Yes, we'll want to use the URL option. Otherwise, IDAES will give up when it detects macOS:
https://github.com/IDAES/idaes-pse/blob/4438f0135f1bf8c543778afa9b8f77d1e92056b3/idaes/solvers.py#L93

@adowling2
Copy link
Contributor Author

Actually, the code linked above installs both the IDAES libraries and solvers at the same time. We might need to compile Ipopt without HSL to get macOS support working.

@eslickj
Copy link
Member

eslickj commented Jan 14, 2021

@adowling2 I think the solvers package includes pynumero, Ipopt, and k_aug. I think we can compile all except k_aug without hsl. May need to give this some thought. But I think we can get a full working set of binaries maybe omitting k_aug without HSL.

I think the URL option also fails from Mac, but I can make whatever changes we need to make it act right. The url option can be used to install from your local drive too like idaes get extensions --url file:///home/..., so it's really nice for testing.

@adowling2
Copy link
Contributor Author

Update: binaries compiled on macOS 10.15 will not work with macOS 10.13.

@adowling2
Copy link
Contributor Author

adowling2 commented Jan 15, 2021

Update: it appears part of conda doesn't work in macOS 10.13.

/Users/******/anaconda3/envs/idaes-pse/lib/python3.7/site-packages/zmq/backend/cython/../../.dylibs/libsodium.23.dylib (which was built for Mac OS X 10.15)

I cannot run idaes get-extensions on my computer with macOS 10.13.

@adowling2
Copy link
Contributor Author

adowling2 commented Jan 15, 2021

I updated my computer. I'm now able to run IDAES.

@eslickj You are correct that IDAES throws an exception:

idaes get-extensions --url /my_path_here/idaes-pse/binaries

results in

  File "/my_path_here/idaes-pse/idaes/solvers.py", line 103, in download_binaries
    raise Exception('Mac OSX currently unsupported')

For clarity, I put the two .tar.gz files in /binaries.

@adowling2
Copy link
Contributor Author

Update: I got the binaries to work on the computer I compiled them on. I created this PR with a one-line change in IDAES: IDAES/idaes-pse#162

I'm now recompiling the extensions with my academic HSL license to test the workflow. These will not be redistributed.

@adowling2
Copy link
Contributor Author

Update: I was able to run the IDAES tests using my compiled binaries on macOS installed via idaes get-extensions (with the URL option to a local directory). Only 3 tests failed:

========================================================================================================================== short test summary info ===========================================================================================================================
FAILED idaes/dmf/tests/test_surrmod.py::test_init - TypeError: add() missing 1 required positional argument: 'rsrc'
FAILED idaes/generic_models/unit_models/tests/test_heat_exchanger.py::TestSaponification_crossflow::test_solve - ValueError: Cannot load a SolverResults object with bad status: error
FAILED idaes/tests/test_docs.py::test_doctests - assert 1 == 0
==================================================================================================== 3 failed, 3517 passed, 3 skipped, 83 deselected in 303.06s (0:05:03) ====================================================================================================

So this is positive news.

@eslickj @michaelbynum I'm having trouble compiling idaes-ext using HSL on my local machine. Lots of clang versus g++ conflicts. We can talk more during our Zoom meeting next week.

@adowling2
Copy link
Contributor Author

I figured out the clang/gcc issue. Right now I'm stuck on k_aug. There seems to be a linker issue.

[  5%] Building C object CMakeFiles/dot_sens.dir/src/k_aug/dot_driver/dot_driver.c.o
/Users/adowling/DowlingLab/IDAES/idaes-ext-with-hsl/k_aug/src/k_aug/dot_driver/dot_driver.c:62:14: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char **argv) {
             ^
1 warning generated.
[ 10%] Linking C executable dot_sens
clang: warning: argument unused during compilation: '-ansi' [-Wunused-command-line-argument]
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [dot_sens] Error 1
make[1]: *** [CMakeFiles/dot_sens.dir/all] Error 2
make: *** [all] Error 2
cp: bin/k_aug*: No such file or directory
cp: dot_sens*: No such file or directory
a idaes-solvers--64.tar.gz: Can't add archive to itself
a ipopt
a libpynumero_ASL.dylib
a license.txt
a tmp
a version_solvers.txt
HSL Present: YES

@adowling2
Copy link
Contributor Author

I'm still stuck on compiling k_aug:

Cloning into 'k_aug'...
remote: Enumerating objects: 82, done.
remote: Counting objects: 100% (82/82), done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 1825 (delta 40), reused 30 (delta 14), pack-reused 1743
Receiving objects: 100% (1825/1825), 17.32 MiB | 26.59 MiB/s, done.
Resolving deltas: 100% (1111/1111), done.
M	CMakeLists.txt
Already on 'ma57'
Your branch is up to date with 'origin/ma57'.
expr: syntax error
-- The C compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_COMPILER
    CMAKE_FORTRAN_COMPILER


-- Build files have been written to: /Users/adowling/DowlingLab/IDAES/idaes-ext-with-hsl/k_aug
Scanning dependencies of target dot_sens
[  5%] Building C object CMakeFiles/dot_sens.dir/src/k_aug/dot_driver/dot_driver.c.o
/Users/adowling/DowlingLab/IDAES/idaes-ext-with-hsl/k_aug/src/k_aug/dot_driver/dot_driver.c:62:14: warning: unused
      parameter 'argc' [-Wunused-parameter]
int main(int argc, char **argv) {
             ^
1 warning generated.
[ 10%] Linking C executable dot_sens
clang: warning: argument unused during compilation: '-ansi' [-Wunused-command-line-argument]
ld: warning: could not create compact unwind for _libload_ASL: stack subq instruction is too different from dwarf stack size
[ 10%] Built target dot_sens
Scanning dependencies of target k_aug
[ 15%] Building C object CMakeFiles/k_aug.dir/src/k_aug/main_.c.o
In file included from /Users/adowling/DowlingLab/IDAES/idaes-ext-with-hsl/k_aug/src/k_aug/main_.c:39:
/Users/adowling/DowlingLab/IDAES/idaes-ext-with-hsl/k_aug/src/k_aug/get_grad_f.h:8:24: error: no newline at end of file
      [-Werror,-Wnewline-eof]
#endif /* GET_GRAD_F */
                       ^
/Users/adowling/DowlingLab/IDAES/idaes-ext-with-hsl/k_aug/src/k_aug/main_.c:162:14: warning: unused parameter 'argc'
      [-Wunused-parameter]
int main(int argc, char **argv){
             ^
1 warning and 1 error generated.
make[2]: *** [CMakeFiles/k_aug.dir/src/k_aug/main_.c.o] Error 1
make[1]: *** [CMakeFiles/k_aug.dir/all] Error 2
make: *** [all] Error 2

@adowling2
Copy link
Contributor Author

I think I got it to work ;)

@adowling2
Copy link
Contributor Author

adowling2 commented Jan 15, 2021

I used idaes get-extensions to install the compiled solvers with HSL. Here are the results from running the tests:

================================================================================================ short test summary info =================================================================================================
FAILED idaes/dmf/tests/test_surrmod.py::test_init - TypeError: add() missing 1 required positional argument: 'rsrc'
FAILED idaes/generic_models/flowsheets/tests/test_demo_flowsheet.py::test_solve_flowsheet - assert 374.61789615752025 == 368.2 ± 3.7e-02
FAILED idaes/generic_models/unit_models/tests/test_heat_exchanger.py::TestSaponification_crossflow::test_solve - ValueError: Cannot load a SolverResults object with bad status: error
FAILED idaes/tests/test_docs.py::test_doctests - assert 1 == 0
========================================================================== 4 failed, 3516 passed, 3 skipped, 83 deselected in 297.87s (0:04:57) ==========================================================================

Edit: I believe these binaries we compiled on my desktop and then tests on the same machine.

@eslickj
Copy link
Member

eslickj commented Jan 15, 2021

@adowling2 that's awesome. Now we just have to figure out if they work on MacOS in general or if there may be shared library or version issues. We can talk Tuesday, but the non-HSL versions should be okay to add to like a Mac Testing release or something to make it easy for people to try out.

I'll modify the get-extensions to only raise the exception about unsupported MacOS only if the files are missing at the URL you point it to, so we won't have to deal with that issue. We can keep testing with --url since I think the release option will try to verify checksums, and we don't have those yet.

@adowling2
Copy link
Contributor Author

Update: I installed the binaries (including HSL) compiled on one macOS machine (Mojave) on a different macOS machine (Big Sur). On the different machine, 300+ tests are failing, many with Solver (ipopt) did not exit normally error. Attached are all of the error messages.

errors.txt

@adowling2
Copy link
Contributor Author

adowling2 commented Jan 16, 2021

I also reran the tests with the non-HSL binaries. Lots of failing tests:

================================================================================ 397 failed, 3116 passed, 6 skipped, 83 deselected, 4 errors in 254.74s (0:04:14) =================================================================================

Here are some common error messages:

/Users/adowling/anaconda3/envs/idaes-pse/lib/python3.7/ctypes/__init__.py:364: OSError
-------------------------------------------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------------------------------------------
ERROR: evaluating object as numeric value:
    fs.main_compressor.control_volume.properties_in[0.0].temperature
        (object: <class 'pyomo.core.base.expression.SimpleExpression'>)
    dlopen(/Users/adowling/.idaes/bin/swco2_external.so, 6): Symbol not found:
    __ZNKSt5ctypeIcE13_M_widen_initEv
      Referenced from: /Users/adowling/.idaes/bin/swco2_external.so Expected
      in: /usr/lib/libstdc++.6.dylib
     in /Users/adowling/.idaes/bin/swco2_external.so
---------------------------------------------------------------------------------------------------------------- Captured log call ----------------------------------------------------------------------------------------------------------------
ERROR    pyomo.core:numvalue.py:244 evaluating object as numeric value: fs.main_compressor.control_volume.properties_in[0.0].temperature
    (object: <class 'pyomo.core.base.expression.SimpleExpression'>)
dlopen(/Users/adowling/.idaes/bin/swco2_external.so, 6): Symbol not found: __ZNKSt5ctypeIcE13_M_widen_initEv
  Referenced from: /Users/adowling/.idaes/bin/swco2_external.so
  Expected in: /usr/lib/libstdc++.6.dylib
 in /Users/adowling/.idaes/bin/swco2_external.so
-------------------------------------------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------------------------------------------
ERROR: Solver (ipopt) returned non-zero return code (-6)
ERROR: See the solver log above for diagnostic information.
2021-01-15 19:29:03 [DEBUG] idaes.solver: dyld: Library not loaded: /usr/local/lib/libcoinhsl.2.dylib
dyld: Library not loaded: /usr/local/lib/libcoinhsl.2.dylib
dyld: Library not loaded: /usr/local/lib/libcoinhsl.2.dylib
2021-01-15 19:29:03 [DEBUG] idaes.solver: Referenced from: /Users/adowling/.idaes/bin/ipopt
Referenced from: /Users/adowling/.idaes/bin/ipopt
Referenced from: /Users/adowling/.idaes/bin/ipopt
2021-01-15 19:29:03 [DEBUG] idaes.solver: Reason: image not found
Reason: image not found
Reason: image not found
---------------------------------------------------------------------------------------------------------------- Captured log call ----------------------------------------------------------------------------------------------------------------
ERROR    pyomo.opt:solvers.py:591 Solver (ipopt) returned non-zero return code (-6)
ERROR    pyomo.opt:solvers.py:594 See the solver log above for diagnostic information.
DEBUG    idaes.solver:logger.py:280 dyld: Library not loaded: /usr/local/lib/libcoinhsl.2.dylib
DEBUG    idaes.solver:logger.py:280 Referenced from: /Users/adowling/.idaes/bin/ipopt
DEBUG    idaes.solver:logger.py:280 Reason: image not found
-------------------------------------------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------------------------------------------
ERROR: Solver (ipopt) returned non-zero return code (-6)
ERROR: Solver log: dyld: Library not loaded: /usr/local/lib/libcoinhsl.2.dylib
      Referenced from: /Users/adowling/.idaes/bin/ipopt Reason: image not
      found
---------------------------------------------------------------------------------------------------------------- Captured log call ----------------------------------------------------------------------------------------------------------------
ERROR    pyomo.opt:solvers.py:591 Solver (ipopt) returned non-zero return code (-6)
ERROR    pyomo.opt:solvers.py:596 Solver log:
dyld: Library not loaded: /usr/local/lib/libcoinhsl.2.dylib
  Referenced from: /Users/adowling/.idaes/bin/ipopt
  Reason: image not found

@adowling2
Copy link
Contributor Author

adowling2 commented Jan 22, 2021

I switched over to the with HSL folder on the desktop. I'm still getting this error:

##################################################
### Building Ipopt idaes-3.13 
##################################################

libtool: warning: '-version-info' is ignored for programs
ld: library not found for -lcoinhsl
collect2: error: ld returned 1 exit status
make[2]: *** [ipopt] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

Build failed, see error output above

Looks like HSL is getting skipped:

##################################################
### Skipping ThirdParty/HSL 
##################################################

Next step:

  • Look at the default coinbrew line in main
  • Why is coinbrew not compiling HSL?

@adowling2
Copy link
Contributor Author

Here is the debug output from compiling with HSL:

+ for entry in $deps
+ expr 'ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0' : '^#'
++ echo 'ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0'
++ tr '\t' ' '
++ tr -s ' '
++ cut -d ' ' -f 1
+ dir=ThirdParty/HSL
++ echo 'ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0'
++ tr '\t' ' '
++ tr -s ' '
++ cut -d ' ' -f 2
+ url=https://github.com/coin-or-tools/ThirdParty-HSL
++ echo https://github.com/coin-or-tools/ThirdParty-HSL
++ cut -d / -f 5
+ proj=ThirdParty-HSL
+ sha=
+ '[' ThirdParty/HSL '!=' Ipopt ']'
+ should_fetch
+ '[' -d ThirdParty/HSL ']'
+ '[' false = true ']'
+ '[' false '!=' true ']'
+ return 1
+ '[' false = true ']'
+ '[' -d ThirdParty/HSL ']'
+ pushd_ ThirdParty/HSL
+ pushd ThirdParty/HSL
++ get_version_git
+++ git rev-parse HEAD
++ current_rev=34c47eb64d3a899414012875a8c38dd0ea593299
+++ git show-ref --tags
+++ fgrep 34c47eb64d3a899414012875a8c38dd0ea593299
++ [[ '' == *releases* ]]
+++ git show-ref --heads
+++ fgrep 34c47eb64d3a899414012875a8c38dd0ea593299
++ [[ 34c47eb64d3a899414012875a8c38dd0ea593299 refs/heads/stable/2.0 == *stable* ]]
++ git show-ref --heads
++ fgrep 34c47eb64d3a899414012875a8c38dd0ea593299
++ fgrep stable
++ cut -d / -f 4
+ version_num=2.0
+ popd_
+ popd
+ '[' true = true ']'
+ '[' ThirdParty/HSL '!=' BuildTools ']'
+ '[' ThirdParty/HSL '!=' examples ']'
+ should_build ThirdParty/HSL
+ TMP_IFS='
'
+ unset IFS
++ echo ThirdParty/HSL
++ cut -d / -f 1
+ '[' ThirdParty = ThirdParty ']'
++ echo ThirdParty/HSL
++ cut -d / -f 2
+ '[' HSL = HSL ']'
+ '[' '!' -f ThirdParty/HSL/coinhsl/common/deps.f ']'
+ IFS='
'
+ return 1
+ print_action 'Skipping ThirdParty/HSL'
+ echo

+ echo '##################################################'
##################################################
+ echo '### Skipping ThirdParty/HSL '
### Skipping ThirdParty/HSL 
+ echo '##################################################'
##################################################

@adowling2
Copy link
Contributor Author

There was a strange zip issue creating a coinhsl folder inside the coinhsl folder. I do not know what I did to fix it. I recently committed updated macOS scripts. Running pytest now.

@adowling2
Copy link
Contributor Author

@eslickj @michaelbynum Good news. We've tested these instructions on 7+ macOS computers ranging from High Sierra to Big Sur. I think we have a solid set of instructions. There is still work to be done on getting the executable to be transferable between machines.

I'm going to open a PR. @eslickj, I'll need your help cleaning up the bash scripts.

@ksbeattie
Copy link
Member

Related to: IDAES/idaes-pse#148 and IDAES/idaes-pse#157

@ksbeattie ksbeattie added this to To do in 2021 May idaes-pse Release via automation Mar 4, 2021
@ksbeattie ksbeattie removed this from In progress in 2021 Feb idaes-pse Release Mar 4, 2021
@ksbeattie ksbeattie moved this from To do to In progress in 2021 May idaes-pse Release Mar 4, 2021
@ksbeattie ksbeattie added this to To do in idaes-ext 2.4.0 release via automation Mar 16, 2021
@ksbeattie ksbeattie moved this from To do to In progress in idaes-ext 2.4.0 release Mar 16, 2021
@ksbeattie ksbeattie removed this from In progress in idaes-ext 2.4.0 release Mar 25, 2021
@ksbeattie ksbeattie added this to To do in idaes-ext 2.5.0 release via automation Mar 25, 2021
@ksbeattie ksbeattie moved this from To do to In progress in idaes-ext 2.5.0 release Mar 25, 2021
@ksbeattie ksbeattie removed this from In progress in 2021 May idaes-pse Release May 27, 2021
@ksbeattie ksbeattie added this to To do in 2021 August idaes-pse Release via automation May 27, 2021
@ksbeattie ksbeattie moved this from To do to In progress in 2021 August idaes-pse Release May 27, 2021
@ksbeattie ksbeattie removed this from In progress in 2021 August idaes-pse Release Jul 15, 2021
@ksbeattie ksbeattie added this to To do in 2021 November idaes-pse Release via automation Jul 15, 2021
@ksbeattie ksbeattie moved this from To do to In progress in 2021 November idaes-pse Release Nov 10, 2021
@ksbeattie ksbeattie removed this from In progress in 2021 November idaes-pse Release Dec 2, 2021
@ksbeattie ksbeattie added this to To do in 2022 February idaes-pse release via automation Dec 2, 2021
@ksbeattie ksbeattie moved this from To do to In progress in 2022 February idaes-pse release Dec 2, 2021
@ksbeattie ksbeattie removed this from In progress in 2022 February idaes-pse release Mar 10, 2022
@andrewlee94 andrewlee94 added Priority:Normal Normal Priority Issue or PR and removed Priority:High High Priority Issue or PR labels Apr 21, 2022
@andrewlee94 andrewlee94 removed this from In progress in idaes-ext 2.5.0 release Apr 21, 2022
@eslickj
Copy link
Member

eslickj commented Apr 24, 2022

I think I have Arm64 extensions for macOS ready to go. I'm going to close this and we can add new specific issues moving forward.

@eslickj eslickj closed this as completed Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Normal Normal Priority Issue or PR
Projects
No open projects
Development

No branches or pull requests

4 participants