/** Adds an edge to the batch ingress buffer, and updates the query set. */ void add_edge(vertex_id_type source, vertex_id_type target, const EdgeData& edata) { BEGIN_TRACEPOINT(batch_ingress_add_edge); edgesend_lock.lock(); ASSERT_LT(edgesend.size(), bufsize); edgesend.push_back(std::make_pair(source, target)); edatasend.push_back(edata); query_set[graph_hash::hash_vertex(source) % rpc.numprocs()].insert(source); query_set[graph_hash::hash_vertex(target) % rpc.numprocs()].insert(target); ++num_edges; edgesend_lock.unlock(); END_TRACEPOINT(batch_ingress_add_edge); if (is_full()) flush(); } // end of add_edge
void distributed_control::exec_function_call(procid_t source, unsigned char packet_type_mask, const char* data, const size_t len) { BEGIN_TRACEPOINT(dc_call_dispatch); // extract the dispatch function iarchive arc(data, len); size_t f; arc >> f; // a regular funcion call dc_impl::dispatch_type dispatch = (dc_impl::dispatch_type)f; dispatch(*this, source, packet_type_mask, data + arc.off, len - arc.off); if ((packet_type_mask & CONTROL_PACKET) == 0) inc_calls_received(source); END_TRACEPOINT(dc_call_dispatch); }
void distributed_control::exec_function_call(procid_t source, unsigned char packet_type_mask, const char* data, const size_t len) { BEGIN_TRACEPOINT(dc_call_dispatch); // not a POD call if ((packet_type_mask & POD_CALL) == 0) { // extract the dispatch function iarchive arc(data, len); size_t f; arc >> f; // a regular funcion call dc_impl::dispatch_type dispatch = (dc_impl::dispatch_type)f; dispatch(*this, source, packet_type_mask, data + arc.off, len - arc.off); }
void distributed_control::deferred_function_call_chunk(char* buf, size_t len, procid_t src) { BEGIN_TRACEPOINT(dc_receive_queuing); fcallqueue_entry* fc = new fcallqueue_entry; fc->chunk_src = buf; fc->chunk_len = len; fc->chunk_ref_counter = NULL; fc->is_chunk = true; fc->source = src; fcallqueue_length.inc(); #ifdef RPC_BLOCK_STRIPING static size_t __idx; // approximate balancing size_t idx = __idx++ % fcallqueue.size(); fcallqueue[idx].enqueue(fc, !fcall_handler_blockers.get(idx)); #else idx = src % fcallqueue.size(); fcallqueue[idx].enqueue(fc, !fcall_handler_blockers.get(idx)); #endif /* if (get_block_sequentialization_key(*fc) > 0) { fcallqueue[src % fcallqueue.size()].enqueue(fc); } else { const uint32_t prod = random::fast_uniform(uint32_t(0), uint32_t(fcallqueue.size() * fcallqueue.size() - 1)); const uint32_t r1 = prod / fcallqueue.size(); const uint32_t r2 = prod % fcallqueue.size(); uint32_t idx = (fcallqueue[r1].size() < fcallqueue[r2].size()) ? r1 : r2; fcallqueue[idx].enqueue(fc); } */ // const uint32_t prod = // random::fast_uniform(uint32_t(0), // uint32_t(fcallqueue.size() * fcallqueue.size() - 1)); // const uint32_t r1 = prod / fcallqueue.size(); // const uint32_t r2 = prod % fcallqueue.size(); // uint32_t idx = (fcallqueue[r1].size() < fcallqueue[r2].size()) ? r1 : r2; // fcallqueue[idx].enqueue(fc); // END_TRACEPOINT(dc_receive_queuing); }
void orthogonalize_vs_all(DistSlicedMat & mat, int curoffset){ assert(mi.ortho_repeats >=1 && mi.ortho_repeats <= 3); INITIALIZE_TRACER(orthogonalize_vs_alltrace, "orthogonalization step"); BEGIN_TRACEPOINT(orthogonalize_vs_alltrace); bool old_debug = debug; debug = false; DistVec current = mat[curoffset]; //DistDouble * alphas = new DistDouble[curoffset]; //cout<<current.to_vec().transpose() << endl; for (int j=0; j < mi.ortho_repeats; j++){ for (int i=0; i< curoffset; i++){ DistDouble alpha = mat[i]*current; // //cout<<mat[i].to_vec().transpose()<<endl; // //cout<<"alpha is: " <<alpha.toDouble()<<endl; if (alpha.toDouble() > 1e-10) current = current - mat[i]*alpha; } } END_TRACEPOINT(orthogonalize_vs_alltrace); debug = old_debug; current.debug_print(current.name); }