| 18 | DECLARE_int32(num_servers); |
| 19 | |
| 20 | void Van::init() { |
| 21 | |
| 22 | scheduler_ = parseNode(FLAGS_scheduler); |
| 23 | if (FLAGS_my_rank < 0) { |
| 24 | my_node_ = parseNode(FLAGS_my_node); |
| 25 | } else { |
| 26 | my_node_ = assembleMyNode(); |
| 27 | } |
| 28 | |
| 29 | if (FLAGS_print_van) { |
| 30 | debug_out_.open("van_"+my_node_.id()); |
| 31 | // LI << "I am [" << my_node_.ShortDebugString() << "]; pid:" << getpid(); |
| 32 | } |
| 33 | |
| 34 | context_ = zmq_ctx_new(); |
| 35 | // TODO the following does not work... |
| 36 | // zmq_ctx_set(context_, ZMQ_MAX_SOCKETS, 1000000); |
| 37 | // zmq_ctx_set(context_, ZMQ_IO_THREADS, 4); |
| 38 | // LL << "ZMQ_MAX_SOCKETS: " << zmq_ctx_get(context_, ZMQ_MAX_SOCKETS); |
| 39 | |
| 40 | CHECK(context_ != NULL) << "create 0mq context failed"; |
| 41 | bind(); |
| 42 | connect(my_node_); |
| 43 | connect(scheduler_); |
| 44 | |
| 45 | } |
| 46 | |
| 47 | void Van::destroy() { |
| 48 | for (auto& it : senders_) zmq_close (it.second); |