1 2 // Copyright Oliver Kowalke 2017. 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 #include <cstdlib> 8 #include <cstring> 9 #include <exception> 10 #include <iostream> 11 #include <vector> 12 13 #include <boost/assert.hpp> 14 #include <boost/fiber/numa/topology.hpp> 15 main(int argc,char * argv[])16int main( int argc, char * argv[]) { 17 try { 18 std::vector< boost::fibers::numa::node > topo = boost::fibers::numa::topology(); 19 for ( auto n : topo) { 20 std::cout << "node: " << n.id << " | "; 21 std::cout << "cpus: "; 22 for ( auto cpu_id : n.logical_cpus) { 23 std::cout << cpu_id << " "; 24 } 25 std::cout << "| distance: "; 26 for ( auto d : n.distance) { 27 std::cout << d << " "; 28 } 29 std::cout << std::endl; 30 } 31 std::cout << "done" << std::endl; 32 return EXIT_SUCCESS; 33 } catch ( std::exception const& ex) { 34 std::cerr << "exception: " << ex.what() << std::endl; 35 } 36 return EXIT_FAILURE; 37 } 38