static void saveDistributedParticles__ (int enabled, FILE* fp_out, int n_local, const particle_t* particles_local, MPI_Comm comm) { if (!enabled) return; int P = mpih_getSize (comm); int rank = mpih_getRank (comm); static int printed_header = 0; if (!printed_header) { int n_global = 0; MPI_Reduce (&n_local, &n_global, 1, MPI_INT, MPI_SUM, 0, comm); if (rank == 0 && fp_out) fprintf (fp_out, "%d %f\n", n_global, DOMAIN_SIZE); printed_header = 1; } int n_local_max = 0; MPI_Reduce (&n_local, &n_local_max, 1, MPI_INT, MPI_MAX, 0, comm); particle_t* buffer = NULL; int n_buffer = -1; if (rank == 0) { particle_t* buffer = (particle_t *)malloc (n_local_max * sizeof (particle_t)); mpih_assert (buffer != NULL); print__ (fp_out, n_local, particles_local); for (int i = 1; i < P; ++i) { int n_buffer = -1; MPI_Status stat; MPI_Recv (buffer, n_local_max, MPI_PARTICLE_T, i, i, comm, &stat); MPI_Get_count (&stat, MPI_PARTICLE_T, &n_buffer); mpih_assert (n_buffer >= 0 && n_buffer <= n_local_max); print__ (fp_out, n_buffer, buffer); } free (buffer); } else { /* rank > 0 */ MPI_Send ((particle_t *)particles_local, n_local, MPI_PARTICLE_T, 0, rank, comm); } }
inline void PredicateFunctionalLexer::print() { print__(); }
inline void ParametersLexer::print() { print__(); }