Skip to content

Commit

Permalink
fix printing steps for multi-modular computations of parametrization …
Browse files Browse the repository at this point in the history
…and new printing of lifting of Gb timings and data
  • Loading branch information
jerebertho committed Jul 23, 2024
1 parent 1a588c8 commit e0fad6c
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/fglm/fglm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ void print_fglm_data(
fprintf(file, "density of the nonfree part %5.1f%%\n", 100*matrix->nonfreepartdensity);
}
fprintf(file, "deg. elim. pol. %16lu\n", (unsigned long)param->degelimpol);

fprintf(file, "deg. sqfr. elim. pol. %13lu\n", (unsigned long)param->degsqfrelimpol);
fprintf(file, "-----------------------------------------\n\n");
}
Expand Down Expand Up @@ -870,6 +869,7 @@ static inline long make_square_free_elim_poly(param_t *param,
if(boo && dim == dimquot){
nmod_poly_set(param->elim, data_bms->BMS->V1);
nmod_poly_one(param->denom);
param->degsqfrelimpol = dim;
}
else{

Expand Down
91 changes: 70 additions & 21 deletions src/msolve/lifting-gb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1326,16 +1326,29 @@ int msolve_gbtrace_qq(
dlinit = 1;
}

/* if(info_level){ */
/* int s= 0; */
/* for(int i = 0; i < dlift->nsteps; i++){ */
/* fprintf(stderr, "[%d]", dlift->steps[i]); */
/* s+=dlift->steps[i]; */
/* } */
/* fprintf(stderr, "\n"); */
/* if(s > 1){ */
/* fprintf(stderr, "%d polynomials to lift\n", s); */
/* } */
/* } */
if(info_level){
fprintf(stdout,"\n\n---------- COMPUTATIONAL DATA -----------\n");
int s= 0;
for(int i = 0; i < dlift->nsteps; i++){
fprintf(stderr, "[%d]", dlift->steps[i]);
fprintf(stdout, "[%d]", dlift->steps[i]);
s+=dlift->steps[i];
}
fprintf(stderr, "\n");
if(s > 1){
fprintf(stderr, "%d polynomials to lift\n", s);
}
fprintf(stdout, "\n");
fprintf(stdout,
"#polynomials to lift %14lu\n",
(unsigned long) s);
fprintf(stdout, "-----------------------------------------\n");
}

if(lmb_ori == NULL || success == 0 || gens->field_char) {
Expand Down Expand Up @@ -1368,9 +1381,10 @@ int msolve_gbtrace_qq(
msd->blht[i] = lht;
}

if(info_level){
fprintf(stderr, "\nStarts multi-modular computations\n");
}
/* if(info_level){ */
/* fprintf(stderr, "\nStarts multi-modular computations\n"); */
/* } */
/* print postponed */

learn = 0;
while(apply){
Expand Down Expand Up @@ -1430,11 +1444,32 @@ int msolve_gbtrace_qq(
fprintf(stderr, "#REDUCTIONS %13lu\n", (unsigned long)st->application_nr_red);
fprintf(stderr, "------------------------------------------\n");
}
if(info_level>1){
fprintf(stderr, "Application phase %.2f Gops/sec\n",
(st->application_nr_add+st->application_nr_mult)/1000.0/1000.0/(stf4));
fprintf(stderr, "Elapsed time: %.2f\n", stf4);
}
/* if(info_level>1){ */
/* fprintf(stderr, "Application phase %.2f Gops/sec\n", */
/* (st->application_nr_add+st->application_nr_mult)/1000.0/1000.0/(stf4)); */
/* fprintf(stderr, "Elapsed time: %.2f\n", stf4); */
/* } */
if(info_level){
fprintf(stdout,
"\n---------------- TIMINGS ----------------\n");
fprintf(stdout,
"multi-mod overall(elapsed) %9.2f sec\n",
stf4);
if (info_level > 1){
fprintf(stdout,
"application phase %9.2f Gops/sec\n",
(st->application_nr_add+st->application_nr_mult)/1000.0/1000.0/(stf4));
}
fprintf(stdout,
"-----------------------------------------\n");
}
if (info_level) {
fprintf(stdout,
"\nmulti-modular steps\n");
fprintf(stdout, "-------------------------------------------------\
-----------------------------------------------------\n");
}

}
int bad = 0;
for(int i = 0; i < nthrds/* st->nthrds */; i++){
Expand Down Expand Up @@ -1470,12 +1505,12 @@ int msolve_gbtrace_qq(
if((st_crt -ost_crt) + (st_rrec - ost_rrec) > dlift->rr * stf4){
dlift->rr = 2*dlift->rr;
if(info_level){
fprintf(stderr, "(->%d)", dlift->rr);
fprintf(stdout, "(->%d)", dlift->rr);
}
}
if(info_level){
if(!(nprimes & (nprimes - 1))){
fprintf(stderr, "{%d}", nprimes);
fprintf(stdout, "{%d}", nprimes);
}
}
apply = 0;
Expand All @@ -1487,21 +1522,35 @@ int msolve_gbtrace_qq(
}
if(dlift->lstart != lstart){
if(info_level){
fprintf(stderr, "<%.2f%%>", 100* (float)MIN((dlift->lstart + 1), modgbs->ld)/modgbs->ld);
fprintf(stdout, "<%.2f%%>", 100* (float)MIN((dlift->lstart + 1), modgbs->ld)/modgbs->ld);
}
lstart = dlift->lstart;
}
/* this is where learn could be reset to 1 */
/* but then duplicated datas and others should be free-ed */
}
if (info_level){
fprintf(stdout, " \n-------------------------------------------------\
-----------------------------------------------------\n");
}
}
if(info_level){
fprintf(stderr, "\nCRT time = %.2f, Rational reconstruction time = %.2f\n", st_crt, st_rrec);
}
/* if(info_level){ */
/* fprintf(stderr, "\nCRT time = %.2f, Rational reconstruction time = %.2f\n", st_crt, st_rrec); */
/* } */
if(info_level){
long nbits = max_bit_size_gb(modgbs);
fprintf(stderr, "Maximum bit size of the coefficients: %ld\n", nbits);
fprintf(stderr, "%d primes used. \nElapsed time: %.2f\n", nprimes, realtime()-st0);
/* fprintf(stderr, "Maximum bit size of the coefficients: %ld\n", nbits); */
/* fprintf(stderr, "%d primes used. \nElapsed time: %.2f\n", nprimes, realtime()-st0); */
fprintf(stdout,"\n\n---------- COMPUTATIONAL DATA -----------\n");
fprintf(stdout, "Max coeff. bitsize %16lu\n", (unsigned long) nbits);
fprintf(stdout, "#primes %16lu\n", (unsigned long) nprimes);
fprintf(stdout, "#bad primes %16lu\n", (unsigned long) nbadprimes);
fprintf(stdout, "-----------------------------------------\n");
fprintf(stdout, "\n---------------- TIMINGS ----------------\n");
fprintf(stdout, "CRT (elapsed) %10.2f sec\n", st_crt);
fprintf(stdout, "ratrecon(elapsed) %10.2f sec\n", st_rrec);
/* fprintf(stdout, "CRT and ratrecon(elapsed) %10.2f sec\n", realtime()-st0); */
fprintf(stdout, "-----------------------------------------\n");
}
free_mstrace(msd, st);
if(dlinit){
Expand Down
2 changes: 1 addition & 1 deletion src/msolve/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ int main(int argc, char **argv){
if (info_level > 0) {
double st1 = cputime();
double rt1 = realtime();
fprintf(stderr, "\n-------------------------------------------------\
fprintf(stderr, "\n\n-------------------------------------------------\
-----------------------------------\n");
fprintf(stderr, "msolve overall time %13.2f sec (elapsed) / %5.2f sec (cpu)\n",
rt1-rt0, st1-st0);
Expand Down
27 changes: 20 additions & 7 deletions src/msolve/msolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -2161,9 +2161,10 @@ int msolve_trace_qq(mpz_param_t *mpz_paramp,
bsquvars);
normalize_nmod_param(nmod_params[0]);

if (info_level) {
fprintf(stderr, "\nStarts multi-modular computations\n");
}
/* if (info_level) { */
/* fprintf(stderr, "\nStarts multi-modular computations\n"); */
/* } */
/* print postponed */

mpz_param_t tmp_mpz_param;
mpz_param_init(tmp_mpz_param);
Expand Down Expand Up @@ -2370,6 +2371,13 @@ int msolve_trace_qq(mpz_param_t *mpz_paramp,
fprintf(stdout,
"-----------------------------------------\n");
}
if (info_level) {
fprintf(stdout,
"\nmulti-modular steps\n");
fprintf(stdout, "-------------------------------------------------\
-----------------------------------------------------\n");
}

}
for (int i = 0; i < st->nthrds; i++) {
if (bad_primes[i] == 0) {
Expand Down Expand Up @@ -2406,7 +2414,7 @@ int msolve_trace_qq(mpz_param_t *mpz_paramp,
nprimes++;
} else {
if (info_level) {
fprintf(stderr, "<bp: %d>\n", lp->p[i]);
fprintf(stdout, "<bp: %d>\n", lp->p[i]);
}
nbadprimes++;
if (nbadprimes > nprimes) {
Expand All @@ -2432,7 +2440,7 @@ int msolve_trace_qq(mpz_param_t *mpz_paramp,
lpow2 = 2 * nprimes;
doit = 0;
if (info_level) {
fprintf(stderr, "\n<Step:%d/%.2f/%.2f>", nbdoit, scrr, t);
fprintf(stdout, "\n<Step:%d/%.2f/%.2f>", nbdoit, scrr, t);
}
prdone = 0;
} else {
Expand All @@ -2442,7 +2450,7 @@ int msolve_trace_qq(mpz_param_t *mpz_paramp,
if ((LOG2(nprimes) > clog) ||
(nbdoit != 1 && (nprimes % (lpow2 + 1) == 0))) {
if (info_level) {
fprintf(stderr, "{%d}", nprimes);
fprintf(stdout, "{%d}", nprimes);
}
clog++;
lpow2 = 2 * lpow2;
Expand All @@ -2456,12 +2464,17 @@ int msolve_trace_qq(mpz_param_t *mpz_paramp,
mpz_mul_ui((*mpz_paramp)->denom->coeffs[i - 1],
(*mpz_paramp)->denom->coeffs[i - 1], i);
}
if(info_level){
fprintf(stdout,
"\n-------------------------------------------------\
-----------------------------------------------------\n");
}


if(info_level){
/* fprintf(stderr, "\n%d primes used\n", nprimes); */
/* fprintf(stderr, "Time for CRT + rational reconstruction = %.2f\n", strat); */
fprintf(stdout,"\n\n---------- COMPUTATIONAL DATA -----------\n");
fprintf(stdout,"\n---------- COMPUTATIONAL DATA -----------\n");
fprintf(stdout, "#primes %16lu\n", (unsigned long) nprimes);
fprintf(stdout, "#bad primes %16lu\n", (unsigned long) nbadprimes);
fprintf(stdout, "-----------------------------------------\n");
Expand Down

0 comments on commit e0fad6c

Please sign in to comment.