| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #include <NTL/ZZ.h>
- #include <iostream>
- #include <string.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include "desired_resources.h"
- #include "controller.h"
- NTL_CLIENT
- // The total number of nodes (that is, dpnodes)
- static unsigned short total_nodes = 1;
- // The amount of memory we can use per dpnode
- static unsigned short GB_mem_per_node = 1;
- // Input: order
- // Output: desired_dpnodes, max_workers, dpfreq
- void custom_desired_resources(const ZZ &order,
- unsigned short &desired_dpnodes, unsigned int &max_workers,
- unsigned int &dpfreq)
- {
- return desired_resources(order, total_nodes,
- GB_mem_per_node, desired_dpnodes,
- max_workers, dpfreq);
- }
- static void boundcb(const char *boundaddr, unsigned short boundport)
- {
- cout << "Listening on " << boundaddr << ":" << boundport << "\n";
- const char *fdenv = getenv("CONTROLLER_BOUNDCB_FD");
- if (fdenv) {
- int fd = atoi(fdenv);
- if (fd > 2) {
- write(fd, &boundport, 2);
- write(fd, boundaddr, strlen(boundaddr));
- close(fd);
- }
- }
- }
- int main(int argc, char **argv)
- {
- #ifdef SAVE_DPS
- std::cerr << "Note: Saving the distinguished points. Do not run huge problems or else it will use up all of your disk space.\n";
- #ifndef DERANDOMIZE
- std::cerr << "Saving DPs without derandomization!\n";
- #endif
- #endif
- unsigned short bindport = 0;
- Worklist worklist;
- if (controller_parse_args(argc, argv, bindport, worklist,
- total_nodes, GB_mem_per_node)) {
- std::cerr << "Usage: " << argv[0] << " [-p listenport] [-n num_nodes] [-m GB_mem_per_node] [-r reps] N1 iter1 N2 iter2 ...\n";
- return 1;
- }
- return controller_main(worklist, bindport, boundcb);
- }
|