/** * ktxnmgrd - kernel txnmgr daemon * @arg: pointer to super block * * The background transaction manager daemon, started as a kernel thread during * reiser4 initialization. */ static int ktxnmgrd(void *arg) { struct super_block *super; ktxnmgrd_context *ctx; txn_mgr *mgr; int done = 0; super = arg; mgr = &get_super_private(super)->tmgr; /* * do_fork() just copies task_struct into the new thread. ->fs_context * shouldn't be copied of course. This shouldn't be a problem for the * rest of the code though. */ current->journal_info = NULL; ctx = mgr->daemon; while (1) { try_to_freeze(); set_comm("wait"); { DEFINE_WAIT(__wait); prepare_to_wait(&ctx->wait, &__wait, TASK_INTERRUPTIBLE); if (kthread_should_stop()) done = 1; else schedule_timeout(ctx->timeout); finish_wait(&ctx->wait, &__wait); } if (done) break; set_comm("run"); spin_lock(&ctx->guard); /* * wait timed out or ktxnmgrd was woken up by explicit request * to commit something. Scan list of atoms in txnmgr and look * for too old atoms. */ do { ctx->rescan = 0; scan_mgr(super); spin_lock(&ctx->guard); if (ctx->rescan) { /* * the list could be modified while ctx * spinlock was released, we have to repeat * scanning from the beginning */ break; } } while (ctx->rescan); spin_unlock(&ctx->guard); } return 0; }
int sendExpproc(char *acqaddrstr, char *filename, char *info, int nextflag) { #if ( !defined(MACOS) && !defined(NOACQ) ) int stat; CommPort acq_addr = &comm_addr[ACQ_COMM_ID]; initExpQs(0); /* map in queue don't clear */ if (!nextflag) expQaddToTail(NORMALPRIO, filename, info); else expQaddToHead(NORMALPRIO, filename, info); set_comm( ACQ_COMM_ID, ADDRESS, acqaddrstr ); stat = InitRecverAddr(acq_addr->host,acq_addr->port,&(acq_addr->messname)); if (stat != RET_OK) { expQdelete(NORMALPRIO, filename); return(RET_ERROR); } stat = SendAsyncInova( acq_addr, NULL, "chkExpQ" ); if (stat != RET_OK) { expQdelete(NORMALPRIO, filename); return(RET_ERROR); } else #endif return(RET_OK); }
int sendNvExpproc(char *acqaddrstr, char *filename, char *info, int nextflag) { #if ( !defined(MACOS) && !defined(NOACQ) ) int stat; char cmdstr[256]; CommPort acq_addr = &comm_addr[ACQ_COMM_ID]; cmdstr[0] = 0; sprintf(cmdstr,"%s, %s,",filename,info); if (!nextflag) sprintf(cmdstr,"add2Qtail %s, %s,",filename,info); else sprintf(cmdstr,"add2Qhead %s, %s,",filename,info); set_comm( ACQ_COMM_ID, ADDRESS, acqaddrstr ); stat = InitRecverAddr(acq_addr->host,acq_addr->port,&(acq_addr->messname)); if (stat != RET_OK) { expQdelete(NORMALPRIO, filename); return(RET_ERROR); } stat = SendAsyncInova( acq_addr, NULL, cmdstr ); if (stat != RET_OK) { expQdelete(NORMALPRIO, filename); return(RET_ERROR); } else #endif return(RET_OK); }
int main(int argc, char** argv) { auto lib = Omega_h::Library(&argc, &argv); auto world = lib.world(); if (argc != 4) { if (!world->rank()) { std::cout << "usage: " << argv[0] << " in.osh <nparts> out.osh\n"; } return -1; } auto nparts_total = world->size(); auto path_in = argv[1]; auto nparts_out = atoi(argv[2]); auto path_out = argv[3]; auto t0 = Omega_h::now(); if (nparts_out < 1) { if (!world->rank()) { std::cout << "error: invalid output part count " << nparts_out << '\n'; } return -1; } if (nparts_out > nparts_total) { if (!world->rank()) { std::cout << "error: output part count " << nparts_out << " greater than MPI job size " << nparts_total << '\n'; } return -1; } auto nparts_in = Omega_h::binary::read_nparts(path_in); if (nparts_in > nparts_total) { if (!world->rank()) { std::cout << "error: input part count " << nparts_in << " greater than MPI job size " << nparts_total << '\n'; } return -1; } auto is_in = (world->rank() < nparts_in); auto comm_in = world->split(int(is_in), 0); auto is_out = (world->rank() < nparts_out); auto comm_out = world->split(int(is_out), 0); auto mesh = Omega_h::Mesh(&lib); if (is_in) { Omega_h::binary::read_in_comm(path_in, comm_in, &mesh); if (nparts_out < nparts_in) { Omega_h_fail( "partitioning to a smaller part count not yet implemented\n"); } } if (is_in || is_out) mesh.set_comm(comm_out); if (is_out) { if (nparts_out != nparts_in) mesh.balance(); Omega_h::binary::write(path_out, &mesh); } world->barrier(); auto t1 = Omega_h::now(); auto imb = mesh.imbalance(); if (!world->rank()) { std::cout << "repartitioning took " << (t1 - t0) << " seconds\n"; std::cout << "imbalance is " << imb << "\n"; } }
static int deliverMessage(char *interface, char *message ) { int stat; CommPort tmp_addr = &comm_addr[LOCAL_COMM_ID]; set_comm( LOCAL_COMM_ID, ADDRESS, interface ); stat = InitRecverAddr(tmp_addr->host,tmp_addr->port,&(tmp_addr->messname)); if (stat != RET_OK) return(RET_ERROR); stat = SendAsyncInovaVnmr( tmp_addr, NULL, message ); if (stat != RET_OK) return(RET_ERROR); else return(RET_OK); }
MPICommunicator(MPI_Comm comm) { set_comm(comm); }