diff --git a/examples/main.c b/examples/main.c index a8cbd8ca7fb0d0eb9ef8fa58d27ca997c4c4a8d4..84ef690a5a09708affa653029a46d1052e04a9b3 100644 --- a/examples/main.c +++ b/examples/main.c @@ -851,7 +851,7 @@ int main(int argc, char *argv[]) { /* Get ready to read particles of all kinds */ size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0; double dim[3] = {0., 0., 0.}; - float high_res_DM_mass = -1.f; + if (myrank == 0) clocks_gettime(&tic); #if defined(HAVE_HDF5) #if defined(WITH_MPI) @@ -864,18 +864,17 @@ int main(int argc, char *argv[]) { cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, dry_run); #else - read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, - &Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart, - &flag_entropy_ICs, &high_res_DM_mass, with_hydro, - (with_external_gravity || with_self_gravity), with_stars, - with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h, - cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, - nr_threads, dry_run); + read_ic_serial( + ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas, &Ngpart, + &Ngpart_background, &Nspart, &Nbpart, &flag_entropy_ICs, with_hydro, + (with_external_gravity || with_self_gravity), with_stars, + with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, + nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, dry_run); #endif #else read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart, - &flag_entropy_ICs, &high_res_DM_mass, with_hydro, + &flag_entropy_ICs, with_hydro, (with_external_gravity || with_self_gravity), with_stars, with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, nr_threads, dry_run); diff --git a/examples/main_fof.c b/examples/main_fof.c index 9b2f5dbcbbed0197d0c1762889f0676d69b62c9b..81b8adcdc8bf100b7fcf2c4bccce56691aa666cf 100644 --- a/examples/main_fof.c +++ b/examples/main_fof.c @@ -425,14 +425,14 @@ int main(int argc, char *argv[]) { int flag_entropy_ICs = 0; size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0; double dim[3] = {0., 0., 0.}; - float high_res_DM_mass = -1.f; + if (myrank == 0) clocks_gettime(&tic); #if defined(HAVE_HDF5) #if defined(WITH_MPI) #if defined(HAVE_PARALLEL_HDF5) read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart, - &flag_entropy_ICs, &high_res_DM_mass, with_hydro, + &flag_entropy_ICs, with_hydro, /*with_grav=*/1, with_stars, with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, @@ -440,7 +440,7 @@ int main(int argc, char *argv[]) { #else read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart, - &flag_entropy_ICs, &high_res_DM_mass, with_hydro, + &flag_entropy_ICs, with_hydro, /*with_grav=*/1, with_stars, with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, /*dry_run=*/0); @@ -448,7 +448,7 @@ int main(int argc, char *argv[]) { #else read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart, - &flag_entropy_ICs, &high_res_DM_mass, with_hydro, + &flag_entropy_ICs, with_hydro, /*with_grav=*/1, with_stars, with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, nr_threads, /*dry_run=*/0); #endif diff --git a/src/serial_io.c b/src/serial_io.c index 300e2f27639adc60368dd0d06f8be20140ac3824..c90a933a07852bb7de5580a81bba06482c23c692 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -493,11 +493,11 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units, double dim[3], struct part** parts, struct gpart** gparts, struct spart** sparts, struct bpart** bparts, size_t* Ngas, size_t* Ngparts, size_t* Ngparts_background, size_t* Nstars, - size_t* Nblackholes, int* flag_entropy, float* gpart_mass, - int with_hydro, int with_gravity, int with_stars, - int with_black_holes, int cleanup_h, int cleanup_sqrt_a, - double h, double a, int mpi_rank, int mpi_size, - MPI_Comm comm, MPI_Info info, int n_threads, int dry_run) { + size_t* Nblackholes, int* flag_entropy, int with_hydro, + int with_gravity, int with_stars, int with_black_holes, + int cleanup_h, int cleanup_sqrt_a, double h, double a, + int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info, + int n_threads, int dry_run) { hid_t h_file = 0, h_grp = 0; /* GADGET has only cubic boxes (in cosmological mode) */ @@ -801,13 +801,6 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units, /* Prepare the DM particles */ io_prepare_dm_gparts(&tp, *gparts, Ndm); - /* Record the mass of the DM particles */ - const float local_gpart_mass = (*gparts)[0].mass; - float global_gpart_mass; - MPI_Allreduce(&local_gpart_mass, &global_gpart_mass, 1, MPI_FLOAT, MPI_MAX, - comm); - *gpart_mass = global_gpart_mass; - /* Prepare the DM background particles */ io_prepare_dm_background_gparts(&tp, *gparts + Ndm, Ndm_background); diff --git a/src/serial_io.h b/src/serial_io.h index e038d578a8d8c1acfd582515263ef9b086f9edbe..c6ca7ad66df038791fbd62277f406a7f34340e04 100644 --- a/src/serial_io.h +++ b/src/serial_io.h @@ -39,11 +39,11 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units, double dim[3], struct part** parts, struct gpart** gparts, struct spart** sparts, struct bpart** bparts, size_t* Ngas, size_t* Ngparts, size_t* Ngparts_background, size_t* Nstars, - size_t* Nblackholes, int* flag_entropy, float* gpart_mass, - int with_hydro, int with_gravity, int with_stars, - int with_black_holes, int cleanup_h, int cleanup_sqrt_a, - double h, double a, int mpi_rank, int mpi_size, - MPI_Comm comm, MPI_Info info, int n_threads, int dry_run); + size_t* Nblackholes, int* flag_entropy, int with_hydro, + int with_gravity, int with_stars, int with_black_holes, + int cleanup_h, int cleanup_sqrt_a, double h, double a, + int mpi_rank, int mpi_size, MPI_Comm comm, MPI_Info info, + int n_threads, int dry_run); void write_output_serial(struct engine* e, const char* baseName, const struct unit_system* internal_units, @@ -56,6 +56,7 @@ void writeArray(const struct engine* e, hid_t grp, char* fileName, int mpi_rank, long long offset, const struct unit_system* internal_units, const struct unit_system* snapshot_units); -#endif + +#endif /* HAVE_HDF5 && WITH_MPI && !HAVE_PARALLEL_HDF5 */ #endif /* SWIFT_SERIAL_IO_H */ diff --git a/src/single_io.c b/src/single_io.c index 8dd4da4cd7e298e852b29308c7a1e201c4dbdfbb..017f9498ffc7d11e1a03d27eca733d2d417b9777 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -405,10 +405,10 @@ void read_ic_single(const char* fileName, struct part** parts, struct gpart** gparts, struct spart** sparts, struct bpart** bparts, size_t* Ngas, size_t* Ngparts, size_t* Ngparts_background, size_t* Nstars, - size_t* Nblackholes, int* flag_entropy, float* gpart_mass, - int with_hydro, int with_gravity, int with_stars, - int with_black_holes, int cleanup_h, int cleanup_sqrt_a, - double h, double a, int n_threads, int dry_run) { + size_t* Nblackholes, int* flag_entropy, int with_hydro, + int with_gravity, int with_stars, int with_black_holes, + int cleanup_h, int cleanup_sqrt_a, double h, double a, + int n_threads, int dry_run) { hid_t h_file = 0, h_grp = 0; /* GADGET has only cubic boxes (in cosmological mode) */ @@ -665,9 +665,6 @@ void read_ic_single(const char* fileName, /* Prepare the DM particles */ io_prepare_dm_gparts(&tp, *gparts, Ndm); - /* Record the mass of the DM particles */ - *gpart_mass = (*gparts)[0].mass; - /* Prepare the DM background particles */ io_prepare_dm_background_gparts(&tp, *gparts + Ndm, Ndm_background); @@ -1290,4 +1287,4 @@ void write_output_single(struct engine* e, const char* baseName, e->snapshot_output_count++; } -#endif /* HAVE_HDF5 */ +#endif /* HAVE_HDF5 && !WITH_MPI */ diff --git a/src/single_io.h b/src/single_io.h index 6044d903efffe587d32d66e4e6785503ed6b10d2..47b575272c2fbe5b170eb4370743cd6830b99ae0 100644 --- a/src/single_io.h +++ b/src/single_io.h @@ -35,10 +35,10 @@ void read_ic_single(const char* fileName, struct part** parts, struct gpart** gparts, struct spart** sparts, struct bpart** bparts, size_t* Ngas, size_t* Ndm, size_t* Ndm_background, size_t* Nstars, - size_t* Nblackholes, int* flag_entropy, float* gpart_mass, - int with_hydro, int with_gravity, int with_stars, - int with_black_holes, int cleanup_h, int cleanup_sqrt_a, - double h, double a, int nr_threads, int dry_run); + size_t* Nblackholes, int* flag_entropy, int with_hydro, + int with_gravity, int with_stars, int with_black_holes, + int cleanup_h, int cleanup_sqrt_a, double h, double a, + int nr_threads, int dry_run); void write_output_single(struct engine* e, const char* baseName, const struct unit_system* internal_units,