Просмотр исходного кода

Communicate the dpfreq to the workers correctly

Ian Goldberg 14 лет назад
Родитель
Сommit
e5decaf5df
3 измененных файлов с 16 добавлено и 3 удалено
  1. 4 0
      controller.cc
  2. 2 0
      controller_main.cc
  3. 10 3
      subproblem.h

+ 4 - 0
controller.cc

@@ -200,6 +200,10 @@ struct SubproblemProgress : Subproblem {
 	    Subproblem(id, b, t, m, o, 4294967), solved(false) {
 
 	desired_resources(order, desired_dpnodes, max_workers, dpfreq);
+
+	// We need to update the binary description of the subproblem,
+	// as we may have just changed dpfreq.
+	updatedesc();
     }
 
     // Stop all dpnodes and workers

+ 2 - 0
controller_main.cc

@@ -9,7 +9,9 @@
 
 NTL_CLIENT
 
+// The total number of nodes (that is, dpnodes)
 static unsigned short total_nodes = 0;
+// The amount of memory we can use per dpnode
 static unsigned short GB_mem_per_node = 0;
 
 void desired_resources(const ZZ &order, unsigned short &desired_dpnodes,

+ 10 - 3
subproblem.h

@@ -22,9 +22,10 @@ struct Subproblem {
     unsigned int dpfreq;
     unsigned char desc[1 + SUBPROBLEM_DESC_LEN];
 
-    Subproblem(unsigned short id, const ZZ &b, const ZZ &t, const ZZ &m,
-	    const ZZ &o, unsigned int dpf) : problemid(id), base(b),
-	    target(t), modulus(m), order(o), dpfreq(dpf) {
+    // Update the binary description of the subproblem.  This is what
+    // gets sent to the dpnodes and workers.
+    void updatedesc(void)
+    {
 	desc[0] = 'P';
 	memmove(desc+1, &problemid, 2);
 	BytesFromZZ(desc+3, base, WORDS*sizeof(unsigned int));
@@ -38,6 +39,12 @@ struct Subproblem {
 	    sizeof(unsigned int));
     }
 
+    Subproblem(unsigned short id, const ZZ &b, const ZZ &t, const ZZ &m,
+	    const ZZ &o, unsigned int dpf) : problemid(id), base(b),
+	    target(t), modulus(m), order(o), dpfreq(dpf) {
+	updatedesc();
+    }
+
     // Initilize the Subproblem from the binary description, *without*
     // the leading 'P'
     Subproblem(const unsigned char *descnoP) {