bertiniteam / b2

Bertini 2.0: The redevelopment of Bertini in C++.
88 stars 34 forks source link

Bertini 1: How to measure homotopy continuation tracking time and where should I put the start file? #166

Closed C-H-Chien closed 2 years ago

C-H-Chien commented 2 years ago

Hi, I am using Beritni version 1.6 for mpi parallel execution.

  1. I would like to compare the efficiency of Bertini solving a problem with given start solutions. Should the start file be put under the same directory as the input file, or should it be put under the directory where the Bertini is executed? Is there a way that I can check whether the problem is indeed solved by tracking the homotopy from the given start points?
  2. How to measure the Bertini tracking time? Or where can I found the time it uses for the tracking?

Thank you!

ofloveandhate commented 2 years ago
  1. Put the file called start wherever. By default, when you run bertini input start, it looks here, wherever your pwd is. But it can be, in principle, anywhere, just use bertini input path/to/start. And of course, it doesn't have to be called start, but by default it's assumed that it is.
  2. You might have to dig a bit in the code to extract this information, depending on what exactly you're meaning to time. The produced file output has, at the bottom, five lines that look something like this:
Number of failures:  0
Number of successes:  2
Number of paths:  2
Parse Time = 0.002262s
Track Time = 0.024290s

I believe this to simply be the difference between the time at the start of all tracking, and the time after it's done doing everything else. But maybe not. Maybe it also includes the time it takes to write the start points to a file, etc. 🤷🏻‍♀️ .

Thus, whether the track time reported from output is exactly what you're trying to track is unclear to me, and I would have to read the code to find out (after you clarified what you're timing, of course). Dan Bates or Jon Hauenstein would both perhaps be better equipped to answer the question more immediately -- I was not an author for Bertini 1, I just wrote the build system, have helped solve a bunch of bugs along the way, and wrote a few pieces of software which link against Bertini 1 as a library (namely, paramotopy and bertini_real).

That is, I don't know what you're timing in your software. Are you including endgames? Do you want time for each path? ??? The more clear you are, the more your timing comparisons will have value.

C-H-Chien commented 2 years ago

Hi! Thank you for the quick reply!

Regarding the time, I don't see the five lines in the produced file output. The file input contains the basic, simple syntax. For example, the katsura9 problem:

CONFIG
TRACKTYPE: 1;
END;
INPUT
variable_group x1, x2, x3, x4, x5, x6, x7, x8, x9, x10;
function f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
f1 = -x1+2*x10^2+2*x9^2+2*x8^2+2*x7^2+2*x6^2+2*x5^2+2*x4^2+2*x3^2+2*x2^2+x1^2;
f2 = -x2+2*x10*x9+2*x9*x8+2*x8*x7+2*x7*x6+2*x6*x5+2*x5*x4+2*x4*x3+2*x3*x2+2*x2*x1;
f3 = -x3+2*x10*x8+2*x9*x7+2*x8*x6+2*x7*x5+2*x6*x4+2*x5*x3+2*x4*x2+2*x3*x1+x2^2;
f4 = -x4+2*x10*x7+2*x9*x6+2*x8*x5+2*x7*x4+2*x6*x3+2*x5*x2+2*x4*x1+2*x3*x2;
f5 = -x5+2*x10*x6+2*x9*x5+2*x8*x4+2*x7*x3+2*x6*x2+2*x5*x1+2*x4*x2+x3^2;
f6 = -x6+2*x10*x5+2*x9*x4+2*x8*x3+2*x7*x2+2*x6*x1+2*x5*x2+2*x4*x3;
f7 = -x7+2*x10*x4+2*x9*x3+2*x8*x2+2*x7*x1+2*x6*x2+2*x5*x3+x4^2;
f8 = -x8+2*x10*x3+2*x9*x2+2*x8*x1+2*x7*x2+2*x6*x3+2*x5*x4;
f9 = -x9+2*x10*x2+2*x9*x1+2*x8*x2+2*x7*x3+2*x6*x4+x5^2;
f10 = -1+2*x10+2*x9+2*x8+2*x7+2*x6+2*x5+2*x4+2*x3+2*x2+x1;
END;

Do I need to specifically set something so that I can see the time in the file output?

Let's say the algorithm tracks the homotopy solution from t=0 to t=1. The tracking time I am referring to is the time that the algorithm starts to track (at t=0), and ends when all tracks are finished (at t=1 for all tracks). So the procedure includes end games.

Therefore, the information from the output file you gave as an example,

Parse Time = 0.002262s
Track Time = 0.024290s

should fit my need, unless it also counts the time of writing data to files or other unrelated works.

Please let me know if the "tracking time" I am interested in is still unclear to you. Thank you!

ofloveandhate commented 2 years ago

Regarding the time, I don't see the five lines in the produced file output

That's because you're using tracktype 1. Change to 0, since you're solving a 0-dimensional system, and then it will give you those times. You may also want useregeneration: 1, if that's the method you're going for (it seems like it, since you were using tracktype 1, a posdim solve).

C-H-Chien commented 2 years ago

Thank you! Now I am able to see the time. I will document that the time in the output file may include the time it takes to write data to files.

ofloveandhate commented 2 years ago

I will document that the time in the output file may include the time it takes to write data to files.

It almost certainly does. Bertini 1 writes a ton of data to file, and I agree with much of the reasoning (leaves behind artifacts in case a run dies, etc).

A tool I've used in the past has been to run Bertini using a ramdisk, so that writing to disk is nearly as fast as writing to RAM. That is, running Bertini from a location like /dev/ramdisk, /dev/shm or similar could yield significant speedups -- especially on a cluster, which likely has a network in between the CPU and the disk, since many clusters use network drives. I noticed 10-100x speedups in Paramotopy simply by moving from a harddrive to a ramdisk for running Bertini. Just so you know.

C-H-Chien commented 2 years ago

Thanks for the valuable information! I might have a chance to give it a try in the future. Thank you again :)