Exemple #1
0
int128_t S2_hard_mpi(int128_t x,
                     int64_t y,
                     int64_t z,
                     int64_t c,
                     int128_t s2_hard_approx,
                     int threads)
{
  print("");
  print("=== S2_hard_mpi(x, y) ===");
  print("Computation of the hard special leaves");
  print(x, y, c, threads);

  int128_t s2_hard = 0;
  double time = get_wtime();

  if (is_mpi_master_proc())
    s2_hard = S2_hard_mpi_master(x, y, z, c, s2_hard_approx, threads);
  else
  {
    // uses less memory
    if (y <= FactorTable<uint16_t>::max())
      S2_hard_mpi_slave<uint16_t>((intfast128_t) x, y, z, c, (intfast128_t) s2_hard_approx, threads);
    else
      S2_hard_mpi_slave<uint32_t>((intfast128_t) x, y, z, c, (intfast128_t) s2_hard_approx, threads);
  }

  print("S2_hard", s2_hard, time);
  return s2_hard;
}
int64_t S2_hard_mpi(int64_t x,
                    int64_t y,
                    int64_t z,
                    int64_t c,
                    int64_t s2_hard_approx,
                    int threads)
{
  print("");
  print("=== S2_hard_mpi(x, y) ===");
  print("Computation of the hard special leaves");
  print(x, y, c, threads);

  int64_t s2_hard = 0;
  double time = get_time();

  if (is_mpi_master_proc())
    s2_hard = S2_hard_mpi_master(x, y, z, s2_hard_approx);
  else
  {
    FactorTable<uint16_t> factor(y, threads);
    int64_t max_prime = min(y, z / isqrt(y));
    auto primes = generate_primes<int32_t>(max_prime);

    S2_hard_slave((intfast64_t) x, y, z, c, primes, factor, threads);
  }

  print("S2_hard", s2_hard, time);
  return s2_hard;
}
Exemple #3
0
void set_print_variables(bool print_variables)
{
#ifdef HAVE_MPI
  print_variables_ = print_variables && is_mpi_master_proc();
#else
  print_variables_ = print_variables;
#endif
}
Exemple #4
0
bool print_result()
{
#ifdef HAVE_MPI
  return !print_variables() && is_mpi_master_proc();
#else
  return !print_variables();
#endif
}
Exemple #5
0
void set_print_status(bool print_status)
{
#ifdef HAVE_MPI
  print_status_ = print_status && is_mpi_master_proc();
#else
  print_status_ = print_status;
#endif
}