/** Simulator Entry Point */ int main( int argc, char* argv[] ) { // Initialize process identifiers controller_pid = 0; //dynamics_pid = 0; // Get the sim process identifier sim_pid = getpid(); // Get priority for the sim process sim_priority = getpriority( PRIO_PROCESS, sim_pid ); //printf("Sim PID: %d\n", sim_pid ); //printf("Sim Priority: %d\n", sim_priority ); // Initialize before forking as children will inherit fd's initialize_ipc_pipes(); // Fork all child processes fork_controller(); fork_sensor(); init_dynamics(); // Transition Main Process to Coordinator main loop coordinator(); return 0; }
void CosineCalculator::asyncCalculateTerm(unsigned int offset, bool is_coordinator) { while (!stop) { worker(offset); barrier.wait(); if (is_coordinator) { stop = coordinator(); iteration++; } barrier.wait(); } }
int main(int argc, char **argv) { ros::init(argc, argv, "xbeeCoordinator"); ros::NodeHandle nh; std::string xbeePort; if(!nh.getParam("xbeeCoordinator/port", xbeePort)) { ROS_ERROR("Could not get xbeeCoordinator port name, will exit"); return -1; } XbeeCoordinator coordinator(nh, xbeePort); ros::spin(); return 0; }
int main(int argc, char** argv) { // see if we can initialise the mpi library this is always the first // thing that we must do at the start of an MPI program MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &world_size); MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); if(world_rank == 0) coordinator(); else participant(); MPI_Finalize(); return 0; }
int main(int argc, char **argv) { ros::init(argc, argv, "xbeeNode"); ros::NodeHandle nh; std::string xbeePort; if(!nh.getParam("xbeeNode/port", xbeePort)) { ROS_ERROR("Could not get xbeeNode parameters"); return -1; } XbeeNode coordinator(nh, xbeePort); ros::spin(); return 0; }
int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myid); MPI_Get_processor_name(processor_name,&namelen); /* 自定义MPI数据类型 */ MPI_Type_contiguous(2, MPI_DOUBLE, &MPI_CITY); MPI_Type_commit(&MPI_CITY); MPI_Datatype types[4] = {MPI_CITY, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE}; int lengths[4] = {MAXCITIES, 1, 1, 1}; MPI_Aint disp[4]; int base; MPI_Address(population, disp); MPI_Address(&population[0].fitness, disp+1); MPI_Address(&population[0].rfitness, disp+2); MPI_Address(&population[0].ifitness, disp+3); base = disp[0]; for(int i = 0; i < 4; i++) disp[i] -= base; MPI_Type_struct(4, lengths, disp, types, &MPI_GENETYPE); MPI_Type_commit(&MPI_GENETYPE); /* 自定义结构结束 */ init(); if(myid == 0) coordinator(); else worker(); MPI_Finalize(); return 0; }
PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) { RefPtr<ScrollingCoordinator> coordinator(adoptRef(new ScrollingCoordinator(page))); coordinator->m_private = new ScrollingCoordinatorPrivate; return coordinator.release(); }