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; }