Thread: G++ PGO Blows Up

  1. #1
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587

    G++ PGO Blows Up

    I've written a program that finds the order of the max clique in a graph. I'm trying to use profile guided optimizations (PGO) to squeeze a little extra performance out of it, b/c it's pretty maxed out in terms of algorithms. (That is, without using some weird math stuffs to further reduce the problem or optimize for the likely cases.)

    I compile with the following makefile:
    Code:
    CXX        :=g++-4.8.1
    OPTS    :=-O3 -flto -march=native -std=c++11 -pthread
    
    all : first first-threaded first-pool second second-threaded \
        second-pool primes
    
    debug : CXX        :=g++-4.8.1
    debug : OPTS    :=-g -std=c++11 -pthread
    
    gen-prof : OPTS    :=$(OPTS) -fprofile-generate=./pgo-data
    use-prof : OPTS    :=$(OPTS) -fprofile-use=./pgo-data
    
    gen-prof : all
        touch *.cpp
    
    use-prof : all
    
    debug : all
    
    .PHONY : clean
    clean :
        rm -f first first-threaded first-pool second second-threaded \
        second-pool primes *.o
    
    first : main1.cpp graph.o util.cpp thread_pool.o
        $(CXX) $(OPTS) -o $@ $+
    
    first-threaded : main1.cpp graph.o util.cpp thread_pool.o
        $(CXX) $(OPTS) -DTHREADS -o $@ $+
    
    first-pool : main1.cpp graph.o util.cpp thread_pool.o
        $(CXX) $(OPTS) -DTHREADS -DPOOL -o $@ $+
    
    second : main2.cpp graph.o util.cpp thread_pool.o
        $(CXX) $(OPTS) -o $@ $+
    
    second-threaded : main2.cpp graph.o util.cpp thread_pool.o
        $(CXX) $(OPTS) -DTHREADS -o $@ $+
    
    second-pool : main2.cpp graph.o util.cpp thread_pool.o
        $(CXX) $(OPTS) -DTHREADS -DPOOL -o $@ $+
    
    primes : primes.cpp
        $(CXX) $(OPTS) -o primes primes.cpp
    
    graph.o : graph.cpp
        $(CXX) $(OPTS) -c -o $@ $+
    
    thread_pool.o : thread_pool/thread_pool.cpp
        $(CXX) $(OPTS) -c -o $@ $+
    Then I run:
    make gen-prof
    ./second 89 # leaves PGO data in ./pgo-data
    make clean
    make use-prof # errors, lots and lots of them

    Here's some of the errors. In short, it's a lot of stuff about coverage mismatches and control flow of functions not matching their profile data.
    Code:
    g++-4.8.1 -O3 -flto -march=native -std=c++11 -pthread -fprofile-use=./pgo-data -o second main2.cpp graph.o util.cpp thread_pool.o
    g++-4.8.1 -O3 -flto -march=native -std=c++11 -pthread -fprofile-use=./pgo-data -DTHREADS -o second-threaded main2.cpp graph.o util.cpp thread_pool.o
    g++-4.8.1 -O3 -flto -march=native -std=c++11 -pthread -fprofile-use=./pgo-data -DTHREADS -DPOOL -o second-pool main2.cpp graph.o util.cpp thread_pool.o
    main2.cpp: In function ‘thread_pool::async(std::function<void ()>&&)::{lambda()#2}::operator()() const [clone .isra.78]’:
    main2.cpp:144:1: error: the control flow of function ‘_ZZN11thread_pool5asyncEOSt8functionIFvvEEENKUlvE0_clEv.isra.78’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
     }
     ^
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In function ‘__gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*) [clone .isra.72]’:
    main2.cpp:144:1: error: the control flow of function ‘_ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv.isra.72’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In function ‘std::allocator_traits<std::allocator<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void> > >::_S_destroy<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >(std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>&, std::allocator<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void> >::__destroy_helper*)std::enable_if<std::allocator<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void> >::__destroy_helper<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >::value, void>::type’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt16allocator_traitsISaINSt13__future_base15_Deferred_stateISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEEEE10_S_destroyISB_EENSt9enable_ifIXsrNSD_16__destroy_helperIT_EE5valueEvE4typeERSC_PSH_’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In function ‘std::get<0ul, std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1}>(std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1}&)std::__add_ref<std::tuple_element<0ul, std::tuple<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1}> >::type>::type’:
    main2.cpp:144:1: error: the control flow of function ‘_ZSt3getILm0EIZNSt13__future_base17_Async_state_implISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEC1EOSA_EUlvE_EENSt9__add_refINSt13tuple_elementIXT_ESt5tupleIIDpT0_EEE4typeEE4typeERSJ_’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)> >, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base15_Deferred_stateISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlS7_E_S6_EEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EED2Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base17_Async_state_implISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >, (__gnu_cxx::_Lock_policy)2>::_M_dispose()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base17_Async_state_implISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base17_Async_state_implISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EED0Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base17_Async_state_implISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EED2Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base15_Deferred_stateISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >, (__gnu_cxx::_Lock_policy)2>::_M_destroy()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base15_Deferred_stateISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EE10_M_destroyEv’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >, (__gnu_cxx::_Lock_policy)2>::_M_dispose()’:
    main2.cpp:144:1: warning: source locations for function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base15_Deferred_stateISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv’ have changed, the profile data may be out of date [enabled by default]
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>, std::allocator<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()’:
    main2.cpp:144:1: warning: source locations for function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt13__future_base15_Deferred_stateISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEESaISB_ELN9__gnu_cxx12_Lock_policyE2EED0Ev’ have changed, the profile data may be out of date [enabled by default]
    main2.cpp: In member function ‘std::thread::_Impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1} ()> >::_M_run()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt6thread5_ImplISt12_Bind_simpleIFZNSt13__future_base17_Async_state_implIS1_IFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEC1EOSB_EUlvE_vEEE6_M_runEv’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::thread::_Impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (&&)(std::function<void ()>))::{lambda()#1} ()> >, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (&&)(std::function<void ()>))::{lambda()#1} ()>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt6thread5_ImplISt12_Bind_simpleIFZNSt13__future_base17_Async_state_implIS2_IFZN11thread_pool5asyncEOSt8functionIFvvEEEUlS9_E_S8_EEvEC1EOSC_EUlvE_vEEEESaISI_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::thread::_Impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (&&)(std::function<void ()>))::{lambda()#1} ()> >, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (&&)(std::function<void ()>))::{lambda()#1} ()>, (__gnu_cxx::_Lock_policy)2>::_M_destroy()’:
    main2.cpp:144:1: warning: source locations for function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt6thread5_ImplISt12_Bind_simpleIFZNSt13__future_base17_Async_state_implIS2_IFZN11thread_pool5asyncEOSt8functionIFvvEEEUlS9_E_S8_EEvEC1EOSC_EUlvE_vEEEESaISI_ELN9__gnu_cxx12_Lock_policyE2EE10_M_destroyEv’ have changed, the profile data may be out of date [enabled by default]
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::thread::_Impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (&&)(std::function<void ()>))::{lambda()#1} ()> >, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (&&)(std::function<void ()>))::{lambda()#1} ()>, (__gnu_cxx::_Lock_policy)2>::_M_dispose()’:
    main2.cpp: In function ‘thread_pool::async(std::function<void ()>&&)::{lambda()#2}::operator()() const [clone .isra.78]’:
    main2.cpp:144:1: warning: source locations for function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt6thread5_ImplISt12_Bind_simpleIFZNSt13__future_base17_Async_state_implIS2_IFZN11thread_pool5asyncEOSt8functionIFvvEEEUlS9_E_S8_EEvEC1EOSC_EUlvE_vEEEESaISI_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv’ have changed, the profile data may be out of date [enabled by default]
    main2.cpp:144:1: error: the control flow of function ‘_ZZN11thread_pool5asyncEOSt8functionIFvvEEENKUlvE0_clEv.isra.78’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
     }
     ^
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::thread::_Impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1} ()> >, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1} ()>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt6thread5_ImplISt12_Bind_simpleIFZNSt13__future_base17_Async_state_implIS2_IFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEC1EOSC_EUlvE_vEEEESaISI_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp: In function ‘__gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*) [clone .isra.72]’:
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp:144:1: error: the control flow of function ‘_ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv.isra.72’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::thread::_Impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1} ()> >, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1} ()>, (__gnu_cxx::_Lock_policy)2>::_M_destroy()’:
    main2.cpp:144:1: warning: source locations for function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt6thread5_ImplISt12_Bind_simpleIFZNSt13__future_base17_Async_state_implIS2_IFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEC1EOSC_EUlvE_vEEEESaISI_ELN9__gnu_cxx12_Lock_policyE2EE10_M_destroyEv’ have changed, the profile data may be out of date [enabled by default]
    main2.cpp: In member function ‘std::_Sp_counted_ptr_inplace<std::thread::_Impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1} ()> >, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>::_Async_state_impl(thread_pool::async(std::function<void ()>&&)::{lambda()#2} (&&)())::{lambda()#1} ()>, (__gnu_cxx::_Lock_policy)2>::_M_dispose()’:
    main2.cpp:144:1: warning: source locations for function ‘_ZNSt23_Sp_counted_ptr_inplaceINSt6thread5_ImplISt12_Bind_simpleIFZNSt13__future_base17_Async_state_implIS2_IFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEC1EOSC_EUlvE_vEEEESaISI_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv’ have changed, the profile data may be out of date [enabled by default]
    main2.cpp: In function ‘__static_initialization_and_destruction_0(int, int)’:
    main2.cpp:144:1: error: the control flow of function ‘_Z41__static_initialization_and_destruction_0ii’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘__gnu_cxx::__concurrence_lock_error::~__concurrence_lock_error()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZN9__gnu_cxx24__concurrence_lock_errorD0Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘__gnu_cxx::__concurrence_unlock_error::~__concurrence_unlock_error()’:
    main2.cpp:144:1: warning: source locations for function ‘_ZN9__gnu_cxx26__concurrence_unlock_errorD2Ev’ have changed, the profile data may be out of date [enabled by default]
    main2.cpp: In member function ‘__gnu_cxx::__concurrence_broadcast_error::~__concurrence_broadcast_error()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZN9__gnu_cxx29__concurrence_broadcast_errorD0Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘__gnu_cxx::__concurrence_broadcast_error::~__concurrence_broadcast_error()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZN9__gnu_cxx29__concurrence_broadcast_errorD2Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘__gnu_cxx::__concurrence_wait_error::~__concurrence_wait_error()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZN9__gnu_cxx24__concurrence_wait_errorD0Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘__gnu_cxx::__concurrence_wait_error::~__concurrence_wait_error()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZN9__gnu_cxx24__concurrence_wait_errorD2Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::__future_base::_Result<void>::~_Result()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt13__future_base7_ResultIvED0Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In member function ‘std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda(std::function<void ()>&&)#1} (std::function<void ()>)>, void>::~_Deferred_state()’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt13__future_base15_Deferred_stateISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlS6_E_S5_EEvED2Ev’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
    main2.cpp:144:1: note: use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot
    main2.cpp: In function ‘std::allocator_traits<std::allocator<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void> > >::_S_destroy<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >(std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void>&, std::allocator<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void> >::__destroy_helper*)std::enable_if<std::allocator<std::__future_base::_Deferred_state<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()>, void> >::__destroy_helper<std::_Bind_simple<thread_pool::async(std::function<void ()>&&)::{lambda()#2} ()> >::value, void>::type’:
    main2.cpp:144:1: error: the control flow of function ‘_ZNSt16allocator_traitsISaINSt13__future_base15_Deferred_stateISt12_Bind_simpleIFZN11thread_pool5asyncEOSt8functionIFvvEEEUlvE0_vEEvEEEE10_S_destroyISB_EENSt9enable_ifIXsrNSD_16__destroy_helperIT_EE5valueEvE4typeERSC_PSH_’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    All the errors seem to come from the second-threaded (and second-pool) compilation -- whatever changes in your code are happening when that THREADS symbol is defined, they are causing mismatches with the non-threaded version that you actually ran and profiled.

    If there are some real differences there, you may want to set up your makefile to use different profile files for the different versions (rather than all using the same data file).

  3. #3
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    I should have noticed that second-pool was the only target failing. Thanks for pointing it out. I guess the massive wall of text confused me. (The errors I posted were only like 1/2 or 1/3.) I changed (gen,use)-prof to depend only on "second". When I used to same set of commands as before, I get an ICE (segfault) from gcc when I run use-prof. So I guess that might be a compiler error.

    Code:
    g++-4.8.1 -O3 -flto -march=native -std=c++11 -pthread -fprofile-use=./pgo-data -c -o graph.o graph.cpp
    g++-4.8.1 -O3 -flto -march=native -std=c++11 -pthread -fprofile-use=./pgo-data -o second main2.cpp graph.o util.cpp thread_pool.o
    main2.cpp: In function ‘chain_p(int)’:
    main2.cpp:144:1: internal compiler error: Segmentation fault
     }
     ^
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <http://bugs.gentoo.org/> for instructions.
    make: *** [second] Error 1

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory usage blows up
    By violatro in forum C Programming
    Replies: 4
    Last Post: 03-28-2012, 10:13 AM