Bug 252643 - devel/hpx : hpx application crashes since hwloc2 is used
Summary: devel/hpx : hpx application crashes since hwloc2 is used
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Yuri Victorovich
URL: https://github.com/open-mpi/hwloc/iss...
Keywords:
Depends on: 252645
Blocks:
  Show dependency treegraph
 
Reported: 2021-01-13 17:09 UTC by Thibault Payet
Modified: 2021-01-19 22:54 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (yuri)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thibault Payet 2021-01-13 17:09:17 UTC
Since the change of hwloc dependency my project that use hpx crash at startup with an abort.

I tested with the simple fibonacci example and get the same kind of error.

Here a backtrace

#0  thr_kill () at thr_kill.S:3
#1  0x0000000801d76084 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x0000000801cec279 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
#3  0x00000008003b5fa9 in report_failure (err=<optimized out>, 
    thrown_exception=0x802a4fb08) at /usr/src/contrib/libcxxrt/exception.cc:719
#4  0x000000080033bfcc in std::rethrow_exception (p=...)
    at /usr/src/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp:68
#5  0x0000000801317896 in void hpx::detail::throw_exception<hpx::exception>(hpx::exception const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, long) () from /usr/local/lib/libhpx.so.1
#6  0x000000080137d045 in hpx::detail::throw_exception(hpx::error, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, long) () from /usr/local/lib/libhpx.so.1
#7  0x000000080137d46e in hpx::detail::throws_if(hpx::error_code&, hpx::error, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, long) () from /usr/local/lib/libhpx.so.1
#8  0x00000008018548d0 in hpx::threads::topology::get_pu_number(unsigned long, unsigned long, hpx::error_code&) const () from /usr/local/lib/libhpx.so.1
#9  0x000000080182e78f in hpx::threads::detail::decode_balanced_distribution(hpx::threads::topology&, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >&, unsigned long, unsigned long, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >&, hpx::error_code&) () from /usr/local/lib/libhpx.so.1
#10 0x000000080182f834 in hpx::threads::parse_affinity_options(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >&, unsigned long, unsigned long, unsigned long, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >&, hpx::error_code&) () from /usr/local/lib/libhpx.so.1
#11 0x000000080182aa5a in hpx::threads::policies::detail::affinity_data::init(hpx::util::command_line_handling const&) () from /usr/local/lib/libhpx.so.1
#12 0x000000080175f359 in hpx::resource::detail::partitioner::parse(hpx::util::function<int (boost::program_options::variables_map&), false> const&, boost::program_options::options_description, int, char**, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, hpx::resource::partitioner_mode, hpx::runtime_mode, bool) () from /usr/local/lib/libhpx.so.1
#13 0x0000000801762b48 in hpx::resource::detail::create_partitioner(hpx::util::function<int (boost::program_options::variables_map&), false> const&, boost::program_options::options_description const&, int, char**, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, hpx::resource::partitioner_mode, hpx::runtime_mode, bool) () from /usr/local/lib/libhpx.so.1
--Type <RET> for more, q to quit, c to continue without paging--
on const&, int, char**, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&&, hpx::util::unique_function<void (), false>, hpx::util::unique_function<void (), false>, hpx::runtime_mode, bool)
    () from /usr/local/lib/libhpx.so.1
#15 0x00000000002237ff in hpx::init(hpx::util::function<int (boost::program_options::variables_map&), false> const&, boost::program_options::options_description const&, int, char**, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, hpx::util::unique_function<void (), false>, hpx::util::unique_function<void (), false>, hpx::runtime_mode) ()
#16 0x0000000000223558 in hpx::init(boost::program_options::options_description const&, int, char**, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, hpx::util::unique_function<void (), false>, hpx::util::unique_function<void (), false>, hpx::runtime_mode) ()
#17 0x00000000002233d6 in hpx::init(int, char**, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, hpx::runtime_mode) ()
#18 0x00000000002231ad in main ()

While here, the generated pkgconfig files have an error for pthread
-l-pthread while this should be -lpthread
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2021-01-13 18:23:49 UTC
Hi Thibault,

The stack trace indicates that exception is thrown.

When I add exception handling to one of the test cases (hpx_thread_phase.cpp):
>         try {
>                 ...all your code...
>         } catch (hpx::exception const& e) {
>                 std::cout << "caught exception: " << e.what() << "\n\n";
>                 std::cout << "diagnostic information:" << hpx::diagnostic_information(e) << "\n";
>                 return -1;
>         }
> }

I get:
> caught exception: Failed to get number of cores: HPX(no_success)

It seems to be a hwloc2 failure since hwloc_get_nbobjs_by_type fails to find number of cores. This test program:

> #include <hwloc.h>
> #include <iostream>
> 
> 
> int main() {
>         hwloc_topology_t topo(nullptr);
>         int err = hwloc_topology_init(&topo);
>         if (err != 0)
>                 std::cout << "err=" << err << std::endl;
> 
>         int num_cores = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_CORE);
>         std::cout << "num_cores=" << num_cores << std::endl;
> 
>         return 0;
> }

Prints num_cores=0.
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2021-01-19 22:53:58 UTC
This issue is now fixed through the backported patch in devel/hwloc2 that fixes its ability to determine the number of cores.

Please reopen if this is still a problem.
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-01-19 22:54:13 UTC
A commit references this bug:

Author: yuri
Date: Tue Jan 19 22:53:17 UTC 2021
New revision: 562096
URL: https://svnweb.freebsd.org/changeset/ports/562096

Log:
  devel/hwloc2: Bugfix: backport the patch that fixes hwloc2's ability to determine n umber of cores on some systems

  GH issue: https://github.com/open-mpi/hwloc/issues/442

  PR:		252643

Changes:
  head/devel/hwloc2/Makefile
  head/devel/hwloc2/distinfo