Commit e5e905bd authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting and correct file permission for the new test script.

parent 7a0804aa
File mode changed from 100644 to 100755
......@@ -179,7 +179,7 @@ __attribute__((always_inline)) INLINE static void hydro_init_part(
for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS; ++i) p->ids_ngbs_density[i] = -1;
p->num_ngb_density = 0;
#endif
p->rho = 0.f;
p->density.wcount = 0.f;
p->density.wcount_dh = 0.f;
......@@ -320,7 +320,7 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS; ++i) p->ids_ngbs_force[i] = -1;
p->num_ngb_force = 0;
#endif
/* Reset the acceleration. */
p->a_hydro[0] = 0.0f;
p->a_hydro[1] = 0.0f;
......
......@@ -103,18 +103,17 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
pj->density.rot_v[0] += facj * curlvr[0];
pj->density.rot_v[1] += facj * curlvr[1];
pj->density.rot_v[2] += facj * curlvr[2];
#ifdef DEBUG_INTERACTIONS_SPH
/* Update ngb counters */
if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
if (pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] = pj->id;
++pi->num_ngb_density;
if(pj->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
if (pj->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pj->ids_ngbs_density[pj->num_ngb_density] = pi->id;
++pj->num_ngb_density;
#endif
}
/**
......@@ -163,14 +162,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
pi->density.rot_v[0] += fac * curlvr[0];
pi->density.rot_v[1] += fac * curlvr[1];
pi->density.rot_v[2] += fac * curlvr[2];
#ifdef DEBUG_INTERACTIONS_SPH
/* Update ngb counters */
if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
if (pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] = pj->id;
++pi->num_ngb_density;
#endif
}
#ifdef WITH_VECTORIZATION
......@@ -494,18 +492,17 @@ __attribute__((always_inline)) INLINE static void runner_iact_force(
/* Change in entropy */
pi->entropy_dt += mj * visc_term * dvdr;
pj->entropy_dt += mi * visc_term * dvdr;
#ifdef DEBUG_INTERACTIONS_SPH
/* Update ngb counters */
if(pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
if (pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_force[pi->num_ngb_force] = pj->id;
++pi->num_ngb_force;
if(pj->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
if (pj->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
pj->ids_ngbs_force[pj->num_ngb_force] = pi->id;
++pj->num_ngb_force;
#endif
}
/**
......@@ -595,14 +592,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
/* Change in entropy */
pi->entropy_dt += mj * visc_term * dvdr;
#ifdef DEBUG_INTERACTIONS_SPH
/* Update ngb counters */
if(pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
if (pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_force[pi->num_ngb_force] = pj->id;
++pi->num_ngb_force;
#endif
}
#ifdef WITH_VECTORIZATION
......
......@@ -119,15 +119,16 @@ void hydro_write_particles(const struct part* parts, struct io_props* list,
"Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, convert_P);
#ifdef DEBUG_INTERACTIONS_SPH
list[10] = io_make_output_field("Num_ngb_density", INT, 1, UNIT_CONV_NO_UNITS,
parts, num_ngb_density);
parts, num_ngb_density);
list[11] = io_make_output_field("Num_ngb_force", INT, 1, UNIT_CONV_NO_UNITS,
parts, num_ngb_force);
list[12] = io_make_output_field("Ids_ngb_density", LONGLONG, MAX_NUM_OF_NEIGHBOURS,
UNIT_CONV_NO_UNITS, parts, ids_ngbs_density);
list[13] = io_make_output_field("Ids_ngb_force", LONGLONG, MAX_NUM_OF_NEIGHBOURS,
UNIT_CONV_NO_UNITS, parts, ids_ngbs_force);
parts, num_ngb_force);
list[12] =
io_make_output_field("Ids_ngb_density", LONGLONG, MAX_NUM_OF_NEIGHBOURS,
UNIT_CONV_NO_UNITS, parts, ids_ngbs_density);
list[13] =
io_make_output_field("Ids_ngb_force", LONGLONG, MAX_NUM_OF_NEIGHBOURS,
UNIT_CONV_NO_UNITS, parts, ids_ngbs_force);
#endif
}
/**
......
......@@ -279,9 +279,9 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
#ifdef IO_SPEED_MEASUREMENT
MPI_Barrier(MPI_COMM_WORLD);
if(engine_rank == 0)
message("Copying for '%s' took %.3f %s." , props.name,
clocks_from_ticks(getticks() - tic), clocks_getunit());
if (engine_rank == 0)
message("Copying for '%s' took %.3f %s.", props.name,
clocks_from_ticks(getticks() - tic), clocks_getunit());
#endif
/* Create data space */
......@@ -324,9 +324,9 @@ void writeArray_chunk(struct engine* e, hid_t h_data, hid_t h_plist_id,
H5Sselect_none(h_filespace);
}
/* message("Writing %lld '%s', %zd elements = %zd bytes (int=%d) at offset
* %zd", N, props.name, N * props.dimension, N * props.dimension * typeSize, */
/* (int)(N * props.dimension * typeSize), offset); */
/* message("Writing %lld '%s', %zd elements = %zd bytes (int=%d) at offset
* %zd", N, props.name, N * props.dimension, N * props.dimension * typeSize, */
/* (int)(N * props.dimension * typeSize), offset); */
#ifdef IO_SPEED_MEASUREMENT
MPI_Barrier(MPI_COMM_WORLD);
......@@ -502,9 +502,9 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
#ifdef IO_SPEED_MEASUREMENT
MPI_Barrier(MPI_COMM_WORLD);
if(engine_rank == 0)
message("'%s' took %.3f %s." , props.name,
clocks_from_ticks(getticks() - tic), clocks_getunit());
if (engine_rank == 0)
message("'%s' took %.3f %s.", props.name,
clocks_from_ticks(getticks() - tic), clocks_getunit());
#endif
}
......@@ -847,7 +847,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
/* Activate parallel i/o */
hid_t h_err = H5Pset_fapl_mpio(plist_id, comm, info);
if (h_err < 0) error("Error setting parallel i/o");
/* Align on 4k pages. */
h_err = H5Pset_alignment(plist_id, 1024, 4096);
if (h_err < 0) error("Error setting Hdf5 alignment");
......
......@@ -728,7 +728,7 @@ static void repart_edge_metis(int partweights, int bothweights, int timebins,
/* Scale to the METIS range. */
double wscale = 1.0;
if ((wmaxv - wminv) > 0.0) {
wscale = (metis_maxweight - 1.0) / (wmaxv - wminv);
wscale = (metis_maxweight - 1.0) / (wmaxv - wminv);
}
for (int k = 0; k < nr_cells; k++) {
weights_v[k] = (weights_v[k] - wminv) * wscale + 1.0;
......
......@@ -397,15 +397,13 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
* @param max_active_bin The largest time-bin active during this step.
*/
__attribute__((always_inline)) INLINE static void
populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
const struct entry *restrict sort_i,
const struct entry *restrict sort_j,
const float dx_max, const float rshift,
const double hi_max_raw,
const double hj_max_raw, const double h_max,
const double di_max, const double dj_min, int *max_index_i,
int *max_index_j, int *init_pi, int *init_pj,
const timebin_t max_active_bin) {
populate_max_index_no_cache_force(
const struct cell *ci, const struct cell *cj,
const struct entry *restrict sort_i, const struct entry *restrict sort_j,
const float dx_max, const float rshift, const double hi_max_raw,
const double hj_max_raw, const double h_max, const double di_max,
const double dj_min, int *max_index_i, int *max_index_j, int *init_pi,
int *init_pj, const timebin_t max_active_bin) {
const struct part *restrict parts_i = ci->parts;
const struct part *restrict parts_j = cj->parts;
......@@ -468,7 +466,7 @@ populate_max_index_no_cache_force(const struct cell *ci, const struct cell *cj,
last_pj = -1;
active_id = last_pj;
while (last_pj < cj->count &&
sort_j[last_pj + 1].d - h_max - dx_max < di_max) {
sort_j[last_pj + 1].d - h_max - dx_max < di_max) {
last_pj++;
/* Store the index of the particle if it is active. */
if (part_is_active_no_debug(&parts_j[sort_j[last_pj].i], max_active_bin))
......@@ -668,15 +666,17 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec(
#ifdef DEBUG_INTERACTIONS_SPH
for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
if (doi_mask & (1 << bit_index)) {
if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + bit_index].id;
if (doi_mask & (1 << bit_index)) {
if (pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] =
parts[pjd + bit_index].id;
++pi->num_ngb_density;
}
if (doi_mask2 & (1 << bit_index)) {
if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + VEC_SIZE + bit_index].id;
if (doi_mask2 & (1 << bit_index)) {
if (pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] =
parts[pjd + VEC_SIZE + bit_index].id;
++pi->num_ngb_density;
}
}
......@@ -893,14 +893,16 @@ __attribute__((always_inline)) INLINE void runner_doself_subset_density_vec(
#ifdef DEBUG_INTERACTIONS_SPH
for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
if (doi_mask & (1 << bit_index)) {
if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + bit_index].id;
if (pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] =
parts[pjd + bit_index].id;
++pi->num_ngb_density;
}
if (doi_mask2 & (1 << bit_index)) {
if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] = parts[pjd + VEC_SIZE + bit_index].id;
if (pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] =
parts[pjd + VEC_SIZE + bit_index].id;
++pi->num_ngb_density;
}
}
......@@ -1113,7 +1115,7 @@ __attribute__((always_inline)) INLINE void runner_doself2_force_vec(
#ifdef DEBUG_INTERACTIONS_SPH
for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
if (vec_is_mask_true(v_doi_mask) & (1 << bit_index)) {
if(pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
if (pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_force[pi->num_ngb_force] = parts[pjd + bit_index].id;
++pi->num_ngb_force;
}
......@@ -1362,9 +1364,10 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
#ifdef DEBUG_INTERACTIONS_SPH
for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
if (vec_is_mask_true(v_doi_mask) & (1 << bit_index)) {
if(pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] = parts_j[sort_j[pjd + bit_index].i].id;
if (vec_is_mask_true(v_doi_mask) & (1 << bit_index)) {
if (pi->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_density[pi->num_ngb_density] =
parts_j[sort_j[pjd + bit_index].i].id;
++pi->num_ngb_density;
}
}
......@@ -1487,9 +1490,10 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
#ifdef DEBUG_INTERACTIONS_SPH
for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
if (vec_is_mask_true(v_doj_mask) & (1 << bit_index)) {
if(pj->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pj->ids_ngbs_density[pj->num_ngb_density] = parts_i[sort_i[ci_cache_idx + first_pi + bit_index].i].id;
if (vec_is_mask_true(v_doj_mask) & (1 << bit_index)) {
if (pj->num_ngb_density < MAX_NUM_OF_NEIGHBOURS)
pj->ids_ngbs_density[pj->num_ngb_density] =
parts_i[sort_i[ci_cache_idx + first_pi + bit_index].i].id;
++pj->num_ngb_density;
}
}
......@@ -1634,9 +1638,9 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
/* Also find the first pi that interacts with any particle in cj and the last
* pj that interacts with any particle in ci. */
populate_max_index_no_cache_force(ci, cj, sort_i, sort_j, dx_max, rshift,
hi_max_raw, hj_max_raw, h_max,
di_max, dj_min, max_index_i, max_index_j,
&first_pi, &last_pj, max_active_bin);
hi_max_raw, hj_max_raw, h_max, di_max,
dj_min, max_index_i, max_index_j, &first_pi,
&last_pj, max_active_bin);
/* Limits of the outer loops. */
const int first_pi_loop = first_pi;
......@@ -1748,8 +1752,9 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
#ifdef DEBUG_INTERACTIONS_SPH
for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
if (vec_is_mask_true(v_doi_mask) & (1 << bit_index)) {
if(pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_force[pi->num_ngb_force] = parts_j[sort_j[pjd + bit_index].i].id;
if (pi->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
pi->ids_ngbs_force[pi->num_ngb_force] =
parts_j[sort_j[pjd + bit_index].i].id;
++pi->num_ngb_force;
}
}
......@@ -1883,8 +1888,9 @@ void runner_dopair2_force_vec(struct runner *r, struct cell *ci,
#ifdef DEBUG_INTERACTIONS_SPH
for (int bit_index = 0; bit_index < VEC_SIZE; bit_index++) {
if (vec_is_mask_true(v_doj_mask) & (1 << bit_index)) {
if(pj->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
pj->ids_ngbs_force[pj->num_ngb_force] = parts_i[sort_i[ci_cache_idx + first_pi + bit_index].i].id;
if (pj->num_ngb_force < MAX_NUM_OF_NEIGHBOURS)
pj->ids_ngbs_force[pj->num_ngb_force] =
parts_i[sort_i[ci_cache_idx + first_pi + bit_index].i].id;
++pj->num_ngb_force;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment