MCPcopy Create free account
hub / github.com/RaftLib/RaftLib / start

Method start

src/basicparallel.cpp:43–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42
43void
44basic_parallel::start()
45{
46 using hash_t = std::uintptr_t;
47 //FIXME, need to add the code that'll limit this without a count
48 while( ! exit_para )
49 {
50 kernelkeeper::value_type &kernels( source_kernels.acquire() );
51 /**
52 * since we have to have a lock on the ports
53 * for both BFS and duplication, we'll mark
54 * the kernels inside of BFS and duplicate
55 * outside of it.
56 */
57 std::vector< raft::kernel* > dup_list;
58 GraphTools::BFS( kernels,
59 (vertex_func) [&dup_list]( raft::kernel *kernel,
60 void *data )
61 {
62 static std::map< hash_t, stats > hashmap;
63 static uint64_t count( 0 );
64
65 UNUSED( data );
66
67 if( kernel->dup_enabled )
68 {
69 /** start checking stats **/
70 auto hash(
71 reinterpret_cast< std::uintptr_t >( kernel ) );
72 /** input stats **/
73 raft::streamingstat< float > in;
74 raft::streamingstat< float > out;
75 if( kernel->input.hasPorts() )
76 {
77 auto &input( kernel->input.getPortInfo() );
78 auto *fifo( input.getFIFO() );
79 in.update( static_cast< float >( fifo->size() )/
80 static_cast< float >( fifo->capacity() ) );
81 }
82 if( kernel->output.hasPorts() )
83 {
84 auto &output( kernel->output.getPortInfo() );
85 auto *fifo( output.getFIFO() );
86 out.update( static_cast< float >( fifo->size() )/
87 static_cast< float >( fifo->capacity() ) );
88 }
89 /** apply criteria **/
90 if( ( kernel->input.count() == 0 ||
91 in.mean< float >() > .5 ) &&
92 ( out.mean< float >() < .5 ||
93 kernel->output.count() == 0 ) )
94 {
95 hashmap[ hash ].occ_in++;
96 }
97 if( hashmap[ hash ].occ_in > 3 && count < 2 )
98 {
99 count++;
100 dup_list.emplace_back( kernel );

Callers

nothing calls this directly

Calls 7

hasPortsMethod · 0.80
countMethod · 0.80
lockMethod · 0.80
allocateMethod · 0.80
unlockMethod · 0.80
scheduleKernelMethod · 0.80
addPortMethod · 0.45

Tested by

no test coverage detected