NOMAD.jl icon indicating copy to clipboard operation
NOMAD.jl copied to clipboard

pkg> test NOMAD fails on FreeBSD 13

Open ko56 opened this issue 3 years ago • 15 comments

Thanks very much for your work on this! I'm running FreeBSD 13, and have clang 11. I'm using the latest NOMAD package. When I try to test it, I get a long error:

[8e850ede] nghttp2_jll @stdlib/nghttp2_jll [3f19e933] p7zip_jll @stdlib/p7zip_jll Testing Running tests... Test Summary: | Pass Total creation of a Nomad problem : assertions | 28 28

signal (11): Segmentation fault in expression starting at /usr/home/ko/.julia/packages/NOMAD/P7j5X/test/basic_problems.jl:1 ZN11NOMAD_4_0_010Parameters17setSpValueDefaultImEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET at /usr/home/ko/.julia/artifacts/d9b565aa4870bf0df27a4f90c279c945de56415a/lib/libnomadCInterface.so (unknown line) ZN11NOMAD_4_0_010Parameters17setAttributeValueIiEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET at /usr/home/ko/.julia/artifacts/d9b565aa4870bf0df27a4f90c279c945de56415a/lib/libnomadCInterface.so (unknown line) addNomadValParam at /usr/home/ko/.julia/artifacts/d9b565aa4870bf0df27a4f90c279c945de56415a/lib/libnomadCInterface.so (unknown line) create_c_nomad_problem at /usr/home/ko/.julia/packages/NOMAD/P7j5X/src/c_wrappers.jl:68 unknown function (ip: 0x818067cac) solve at /usr/home/ko/.julia/packages/NOMAD/P7j5X/src/core.jl:584 unknown function (ip: 0x818062e95) _jl_invoke at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:0 [inlined] jl_apply_generic at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:2419 jl_apply at /usr/home/julia/worker/package_freebsd64/build/src/./julia.h:1703 [inlined] do_call at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:115 eval_body at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:435 eval_body at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:490 eval_body at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:490 jl_interpret_toplevel_thunk at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:670 jl_toplevel_eval_flex at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:877 jl_toplevel_eval_flex at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:825 jl_toplevel_eval at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:886 [inlined] jl_toplevel_eval_in at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:929 eval at ./boot.jl:360 [inlined] include_string at ./loading.jl:1094 _jl_invoke at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:0 [inlined] jl_apply_generic at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:2419 _include at ./loading.jl:1148 include at ./client.jl:444 _jl_invoke at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:0 [inlined] jl_apply_generic at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:2419 jl_apply at /usr/home/julia/worker/package_freebsd64/build/src/./julia.h:1703 [inlined] do_call at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:115 eval_stmt_value at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:155 [inlined] eval_body at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:558 jl_interpret_toplevel_thunk at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:670 jl_toplevel_eval_flex at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:877 jl_toplevel_eval_flex at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:825 jl_toplevel_eval at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:886 [inlined] jl_toplevel_eval_in at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:929 eval at ./boot.jl:360 [inlined] include_string at ./loading.jl:1094 _jl_invoke at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:0 [inlined] jl_apply_generic at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:2419 _include at ./loading.jl:1148 include at ./client.jl:444 _jl_invoke at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:0 [inlined] jl_apply_generic at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:2419 jl_apply at /usr/home/julia/worker/package_freebsd64/build/src/./julia.h:1703 [inlined] do_call at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:115 eval_stmt_value at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:155 [inlined] eval_body at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:558 jl_interpret_toplevel_thunk at /usr/home/julia/worker/package_freebsd64/build/src/interpreter.c:670 jl_toplevel_eval_flex at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:877 jl_toplevel_eval_flex at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:825 jl_toplevel_eval at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:886 [inlined] jl_toplevel_eval_in at /usr/home/julia/worker/package_freebsd64/build/src/toplevel.c:929 eval at ./boot.jl:360 [inlined] exec_options at ./client.jl:261 _start at ./client.jl:485 jfptr__start_32242.clone_1 at /opt/julia-1.6.1/lib/julia/sys.so (unknown line) _jl_invoke at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:0 [inlined] jl_apply_generic at /usr/home/julia/worker/package_freebsd64/build/src/gf.c:2419 jl_apply at /usr/home/julia/worker/package_freebsd64/build/src/./julia.h:1703 [inlined] true_main at /usr/home/julia/worker/package_freebsd64/build/src/jlapi.c:560 repl_entrypoint at /usr/home/julia/worker/package_freebsd64/build/src/jlapi.c:702 main at /opt/julia-1.6.1/bin/julia (unknown line) _start at /opt/julia-1.6.1/bin/julia (unknown line) unknown function (ip: 0x800623007) Allocations: 38615606 (Pool: 38601434; Big: 14172); GC: 50 ERROR: Package NOMAD errored during testing (received signal: 11)

(@v1.6) pkg>

ko56 avatar May 21 '21 14:05 ko56

Thank you for your feedback @ko56. Infortunately, I do not have a FreeBSD environment... From the logs, it looks like it does not find the libraries. Could you try the following steps:

  • Compile the NOMAD C++ solver on your architecture (see https://github.com/bbopt/nomad) without OpenMP. If it does not compile or the examples do not work, it means that the NOMAD C++ solver does not work on FreeBSD. Please, in this case submit an issue to the C++ repertory. We will try to update the jll as soon as this potential? issue is fixed.
  • If you manage to execute the C++ solver and the examples, try to use your own C library version. In the src/c_wrappers.jl, an ENV variable allows you to indicate the path towards the CInterface library. julia> ENV["JULIA_NOMAD_LIBRARY_PATH"] = your-path-towards-your-compiled-library And then you can try to test the package. For the moment, we have some troubles with the different compilers. A rule of thumb is to compile the library with the same compiler as Julia without OpenMP. On Linux and MacOS, the gcc compiler without openMP is the most robust one.

salomonl avatar May 25 '21 17:05 salomonl

I see, thanks. Indeed, I don't have OpenMP installed at all. I'm surprised the compilation works. There is OpenMPI3 and OpenMPI4 for FreeBSD. Which do you recommend?

ko56 avatar May 25 '21 20:05 ko56

The CMakefile can detect if you have openMP or not. For Julia, do not use openMP, as it does not work for interfacing (the threads part of Julia is still experimental). The jll does not use openMP. We also made some tests before creating the jll and we noticed it does not really work well when Julia and Nomad are compiled with different compilers.

I never compiled myself juliabut a lot of its components (I think?) depend on the presence of gcc. If you take a look at the Nomad tarball build script of Yggdrasil.jl, you can see it is only compiled with gcc by default (see https://github.com/JuliaPackaging/Yggdrasil/blob/master/N/NOMAD/build_tarballs.jl).

salomonl avatar May 25 '21 20:05 salomonl

Hmm, I'm confused. I use the official Julia binary for FreeBSD. That seems to be compiled with clang 10, the official compiler on FreeBSD.

Are you saying that NOMAD needs gcc to be present in the system? And if so, which version?

ko56 avatar May 25 '21 21:05 ko56

@salomonl https://github.com/ararslan/CirrusCI.jl

dpo avatar May 25 '21 22:05 dpo

@ko56 I apologize, I was not really clear.

NOMAD is principally tested with gcc (at least a version which supports C++14, so >= 9) and Apple clang(without openMP for this last one). When we started to develop NOMAD.jl, we tested different compilers on Linux and OSX. In summary,

  • In all cases, do not compile it with openMP. It does not work when calling the C interface from Julia.
  • gcc works on Linux and OSX.
  • llvm clang did not work well on Linux and OSX.
  • I am not really familiar with the internal details of Julia C interfacing, but one should avoid to mix the compilers.

We did not test it on detail on FreeBSD, but for the moment, NOMAD_jll is compiled with gcc (@amontoison could you confirm ?). In your cases, I would suggest to

  • Compile NOMAD with the same compiler that Julia was compiled with, so clang. In NOMAD_FOLDER_PATH where the Nomad folder is (I suppose your base compiler is clang)
NOMAD_FOLDER_PATH > mkdir build
NOMAD_FOLDER_PATH > cd build && cmake  -DBUILD_INTERFACES=ON -DTEST_OPENMP=OFF .. 
NOMAD_FOLDER_PATH > make -j 4

Once it is done, indicate the path towards the C interface as explained previously, and test the package.

  • If it does not work, I recommend to try with gcc. In NOMAD_FOLDER_PATH where the Nomad folder is (I suppose gcc is installed)
NOMAD_FOLDER_PATH > mkdir build
NOMAD_FOLDER_PATH > cd build && CC=your_path_to_gcc_bin CXX=your_path_to_g++_bin cmake  -DBUILD_INTERFACES=ON -DTEST_OPENMP=OFF .. 
NOMAD_FOLDER_PATH > make -j 4

Once it is done, indicate the path towards the C interface as explained previously, and test the package.

If it does not work, we will try to investigate.

salomonl avatar May 25 '21 22:05 salomonl

@dpo Thanks for the link !

salomonl avatar May 25 '21 22:05 salomonl

I opened a PR to recompile NOMAD with Clang on FreeBSD and OSX platforms (https://github.com/JuliaPackaging/Yggdrasil/pull/3072). I tested the compilation with BinaryBuilder and it worked.

After the release of the new NOMAD_jll, I will add again CirrusCI (#33).

amontoison avatar May 26 '21 00:05 amontoison

Thank you. I don't understand what CirrusCl is about, however.

ko56 avatar May 26 '21 00:05 ko56

CirrusCI is similar to Travis or GitHub Actions. The main difference is the support of FreeBSD platforms.

amontoison avatar May 26 '21 00:05 amontoison

I interpret that to mean that, as a user, I don't have to worry about it. Right?

ko56 avatar May 26 '21 00:05 ko56

Yep, you're right. It allows package developers to verify if the code compiles and works fine on Windows / OSX / linux / FreeBSD at each new modification.

amontoison avatar May 26 '21 00:05 amontoison

@ko56 Can you upgrade NOMAD_jllto see if it works now ? You need NOMAD_jll v4.0.1+1.

amontoison avatar May 27 '21 03:05 amontoison

I'm having problems updating right now. Will re-try on Sunday.

ko56 avatar May 27 '21 12:05 ko56

I updated to NOMAD_jll v4.0.1+1. Problem seems the same:

[8e850ede] nghttp2_jll @stdlib/nghttp2_jll [3f19e933] p7zip_jll @stdlib/p7zip_jll Testing Running tests... Test Summary: | Pass Total creation of a Nomad problem : assertions | 28 28

signal (11): Segmentation fault in expression starting at /usr/home/ko/.julia/packages/NOMAD/P7j5X/test/basic_problems.jl:1 ZN11NOMAD_4_0_010Parameters17setSpValueDefaultImEEvRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEET at /usr/home/ko/.julia/artifacts/c6e887e7e9ef7db6256d92acb679212861b9cf42/lib/libnomadCInterface.so (unknown line) _ZN11NOMAD_4_0_010Parameters10setSpValueERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi at /usr/home/ko/.julia/artifacts/c6e887e7e9ef7db6256d92acb679212861b9cf42/lib/libnomadCInterface.so (unknown line)

ko56 avatar May 31 '21 00:05 ko56