Skip to content

Commit

Permalink
Merge pull request flintlib#1566 from albinahlback/prune_fft_small
Browse files Browse the repository at this point in the history
Prune printing for `fft_small`
  • Loading branch information
albinahlback authored Nov 2, 2023
2 parents 4135aac + 58ec206 commit 745e0c7
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 134 deletions.
2 changes: 0 additions & 2 deletions src/fft_small/test/t-fmpz_poly_mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
*/

#include "test_helpers.h"
#include "ulong_extras.h"
#include "fmpz.h"
#include "fmpz_vec.h"
#include "fmpz_poly.h"
#include "fft_small.h"
#include "profiler.h"

TEST_FUNCTION_START(_fmpz_poly_mul_mid_mpn_ctx, state)
{
Expand Down
1 change: 0 additions & 1 deletion src/fft_small/test/t-mpn_add_inplace_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

#include "test_helpers.h"
#include "ulong_extras.h"
#include "mpn_extras.h"
#include "fft_small.h"
#include "crt_helpers.h"
Expand Down
51 changes: 0 additions & 51 deletions src/fft_small/test/t-mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,13 @@
#include "fft_small.h"
#include "machine_vectors.h"

/* Defined in t-mul.c and t-sd_fft.c */
#ifndef flint_print_d_fixed
#define flint_print_d_fixed flint_print_d_fixed
void flint_print_d_fixed(double x, ulong l)
{
ulong i;
TMP_INIT;
TMP_START;
char* s = TMP_ARRAY_ALLOC(l + 1, char);

for (i = 0; i < l; i++)
s[i] = ' ';
s[l] = 0;

ulong y = fabs(rint(x));
while (l > 0)
{
s[--l] = '0' + (y%10);
y = y/10;
if (y == 0)
break;
}

printf("%s", s);

TMP_END;
}
#endif

void test_mul(mpn_ctx_t R, ulong minsize, ulong maxsize, ulong nreps, flint_rand_t state)
{
ulong* a = FLINT_ARRAY_ALLOC(maxsize, ulong);
ulong* b = FLINT_ARRAY_ALLOC(maxsize, ulong);
ulong* c = FLINT_ARRAY_ALLOC(maxsize, ulong);
ulong* d = FLINT_ARRAY_ALLOC(maxsize, ulong);

ulong dgs = n_sizeinbase(nreps, 10);

flint_printf(" mul ");
flint_print_d_fixed(0, dgs);
flint_printf("/");
flint_print_d_fixed(nreps, dgs);
fflush(stdout);

minsize = n_max(10, minsize);
maxsize = n_max(minsize, maxsize);
for (ulong rep = 0; rep < nreps; rep++)
Expand All @@ -73,16 +36,6 @@ void test_mul(mpn_ctx_t R, ulong minsize, ulong maxsize, ulong nreps, flint_rand
d[i] = n_randlimb(state);
}

for (ulong ii = 0; ii < 2*dgs + 6; ii++)
flint_printf("%c", '\b');
fflush(stdout);

flint_printf(" mul ");
flint_print_d_fixed(1+rep, dgs);
flint_printf("/");
flint_print_d_fixed(nreps, dgs);
fflush(stdout);

mpn_ctx_mpn_mul(R, d, a, an, b, bn);
mpn_mul(c, a, an, b, bn);
for (ulong i = 0; i < an + bn; i++)
Expand Down Expand Up @@ -118,10 +71,6 @@ void test_mul(mpn_ctx_t R, ulong minsize, ulong maxsize, ulong nreps, flint_rand
flint_free(b);
flint_free(c);
flint_free(d);

for (ulong ii = 0; ii < 2*dgs + 6; ii++)
flint_printf("%c", '\b');
fflush(stdout);
}

TEST_FUNCTION_START(mpn_ctx_mpn_mul, state)
Expand Down
21 changes: 0 additions & 21 deletions src/fft_small/test/t-nmod_poly_mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ TEST_FUNCTION_START(_nmod_poly_mul_mid_mpn_ctx, state)
ulong * a, *b, * c, * d;
ulong an, zn, zl, zh, sz, i, reps;

flint_printf("sqr nbits: %02wu", nbits);
fflush(stdout);

for (reps = 0; reps < 100; reps++)
{
flint_set_num_threads(1 + n_randint(state, 10));
Expand Down Expand Up @@ -125,20 +122,13 @@ TEST_FUNCTION_START(_nmod_poly_mul_mid_mpn_ctx, state)
flint_free(c);
flint_free(d);
}

for (i = 0; i < 13; i++)
flint_printf("%c", '\b');
fflush(stdout);
}

for (nbits = 1; nbits <= FLINT_BITS; nbits ++)
{
ulong * a, * b, * c, * d;
ulong an, bn, zn, zl, zh, sz, i, reps;

flint_printf("mul nbits: %02wu", nbits);
fflush(stdout);

for (reps = 0; reps < 100; reps++)
{
flint_set_num_threads(1 + n_randint(state, 10));
Expand Down Expand Up @@ -185,10 +175,6 @@ TEST_FUNCTION_START(_nmod_poly_mul_mid_mpn_ctx, state)
flint_free(c);
flint_free(d);
}

for (i = 0; i < 13; i++)
flint_printf("%c", '\b');
fflush(stdout);
}

for (nbits = 2; nbits <= FLINT_BITS; nbits++)
Expand All @@ -197,9 +183,6 @@ TEST_FUNCTION_START(_nmod_poly_mul_mid_mpn_ctx, state)
ulong an, bn, qn, i, reps;
nmod_poly_divrem_precomp_struct M[1];

flint_printf("divrem nbits: %02wu", nbits);
fflush(stdout);

for (reps = 0; reps < 100; reps++)
{
flint_set_num_threads(1 + n_randint(state, 10));
Expand Down Expand Up @@ -267,10 +250,6 @@ TEST_FUNCTION_START(_nmod_poly_mul_mid_mpn_ctx, state)
flint_free(r1);
flint_free(r2);
}

for (i = 0; i < 16; i++)
flint_printf("%c", '\b');
fflush(stdout);
}

mpn_ctx_clear(R);
Expand Down
59 changes: 0 additions & 59 deletions src/fft_small/test/t-sd_fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,53 +23,11 @@ vec1d vec1d_eval_poly_mod(const vec1d* a, ulong an, const vec1d b, const vec1d n
return vec1d_reduce_to_pm1n(x, n, ninv);
}

/* Defined in t-mul.c and t-sd_fft.c */
#ifndef flint_print_d_fixed
#define flint_print_d_fixed flint_print_d_fixed
void flint_print_d_fixed(double x, ulong l)
{
ulong i;
TMP_INIT;
TMP_START;
char* s = TMP_ARRAY_ALLOC(l + 1, char);

for (i = 0; i < l; i++)
s[i] = ' ';
s[l] = 0;

ulong y = fabs(rint(x));
while (l > 0)
{
s[--l] = '0' + (y%10);
y = y/10;
if (y == 0)
break;
}

printf("%s", s);

TMP_END;
}
#endif

void test_v2_fft(sd_fft_ctx_t Q, ulong minL, ulong maxL, ulong ireps, flint_rand_t state)
{
ulong irepmul = 10;
minL = n_max(minL, LG_BLK_SZ);

ulong dgs1 = n_sizeinbase(maxL, 10);
ulong dgs2 = n_sizeinbase(ireps + irepmul*maxL, 10);

flint_printf(" fft ");
flint_print_d_fixed(0, dgs1);
flint_printf(".");
flint_print_d_fixed(0, dgs2);
flint_printf("/");
flint_print_d_fixed(maxL, dgs1);
flint_printf(".");
flint_print_d_fixed(0, dgs2);
fflush(stdout);

for (ulong L = minL; L <= maxL; L++)
{
ulong i;
Expand All @@ -81,19 +39,6 @@ void test_v2_fft(sd_fft_ctx_t Q, ulong minL, ulong maxL, ulong ireps, flint_rand
ulong nreps = ireps + irepmul*L;
for (ulong rep = 0; rep < nreps; rep++)
{
for (ulong ii = 0; ii < 2*(dgs1 + dgs2) + 8; ii++)
flint_printf("%c", '\b');

flint_printf(" fft ");
flint_print_d_fixed(L, dgs1);
flint_printf(".");
flint_print_d_fixed(1+rep, dgs2);
flint_printf("/");
flint_print_d_fixed(maxL, dgs1);
flint_printf(".");
flint_print_d_fixed(nreps, dgs2);
fflush(stdout);

// randomize input data
for (i = 0; i < Xn; i++)
X[i] = i + 1;
Expand Down Expand Up @@ -147,10 +92,6 @@ void test_v2_fft(sd_fft_ctx_t Q, ulong minL, ulong maxL, ulong ireps, flint_rand
flint_aligned_free(data);
flint_free(X);
}

for (ulong ii = 0; ii < 2*(dgs1 + dgs2) + 8; ii++)
flint_printf("%c", '\b');
fflush(stdout);
}

TEST_FUNCTION_START(sd_fft, state)
Expand Down

0 comments on commit 745e0c7

Please sign in to comment.