Skip to content
Snippets Groups Projects
Commit 879434a1 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent ca7b098d
No related branches found
No related tags found
1 merge request!287Particle caching
......@@ -54,11 +54,11 @@
* interactions have been performed, should be a multiple of the vector length.
*/
__attribute__((always_inline)) INLINE static void calcRemInteractions(
struct c2_cache *const int_cache,
const int icount, vector *rhoSum, vector *rho_dhSum, vector *wcountSum,
vector *wcount_dhSum, vector *div_vSum, vector *curlvxSum,
vector *curlvySum, vector *curlvzSum, vector v_hi_inv, vector v_vix,
vector v_viy, vector v_viz, int *icount_align) {
struct c2_cache *const int_cache, const int icount, vector *rhoSum,
vector *rho_dhSum, vector *wcountSum, vector *wcount_dhSum,
vector *div_vSum, vector *curlvxSum, vector *curlvySum, vector *curlvzSum,
vector v_hi_inv, vector v_vix, vector v_viy, vector v_viz,
int *icount_align) {
#ifdef HAVE_AVX512_F
KNL_MASK_16 knl_mask, knl_mask2;
......@@ -231,10 +231,9 @@ __attribute__((always_inline)) INLINE static void storeInteractions(
int icount_align = *icount;
/* Peform remainder interactions. */
calcRemInteractions(int_cache, *icount, rhoSum, rho_dhSum,
wcountSum, wcount_dhSum, div_vSum, curlvxSum, curlvySum,
curlvzSum, v_hi_inv, v_vix, v_viy, v_viz,
&icount_align);
calcRemInteractions(int_cache, *icount, rhoSum, rho_dhSum, wcountSum,
wcount_dhSum, div_vSum, curlvxSum, curlvySum, curlvzSum,
v_hi_inv, v_vix, v_viy, v_viz, &icount_align);
vector int_mask, int_mask2;
int_mask.m = vec_setint1(0xFFFFFFFF);
......@@ -256,7 +255,7 @@ __attribute__((always_inline)) INLINE static void storeInteractions(
#endif /* defined(HAVE_AVX2) || defined(HAVE_AVX512_F) */
}
#endif /* WITH_VECTORIZATION */
#endif /* WITH_VECTORIZATION */
/**
* @brief Compute the cell self-interaction (non-symmetric) using vector
......@@ -453,9 +452,9 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec(
}
/* Perform padded vector remainder interactions if any are present. */
calcRemInteractions(&int_cache, icount, &rhoSum, &rho_dhSum,
&wcountSum, &wcount_dhSum, &div_vSum, &curlvxSum,
&curlvySum, &curlvzSum, v_hi_inv, v_vix, v_viy, v_viz,
calcRemInteractions(&int_cache, icount, &rhoSum, &rho_dhSum, &wcountSum,
&wcount_dhSum, &div_vSum, &curlvxSum, &curlvySum,
&curlvzSum, v_hi_inv, v_vix, v_viy, v_viz,
&icount_align);
/* Initialise masks to true in case remainder interactions have been
......@@ -779,9 +778,9 @@ __attribute__((always_inline)) INLINE void runner_doself1_density_vec_2(
}
/* Perform padded vector remainder interactions if any are present. */
calcRemInteractions(&int_cache, icount, &rhoSum, &rho_dhSum,
&wcountSum, &wcount_dhSum, &div_vSum, &curlvxSum,
&curlvySum, &curlvzSum, v_hi_inv, v_vix, v_viy, v_viz,
calcRemInteractions(&int_cache, icount, &rhoSum, &rho_dhSum, &wcountSum,
&wcount_dhSum, &div_vSum, &curlvxSum, &curlvySum,
&curlvzSum, v_hi_inv, v_vix, v_viy, v_viz,
&icount_align);
calcRemInteractions(&int_cache2, icount2, &rhoSum2, &rho_dhSum2,
......
......@@ -257,7 +257,8 @@ typedef union {
} vector;
/**
* @brief Calculates the inverse ($1/x$) of a vector using intrinsics and a Newton iteration to obtain the correct level of accuracy.
* @brief Calculates the inverse ($1/x$) of a vector using intrinsics and a
* Newton iteration to obtain the correct level of accuracy.
*
* @param x #vector to be inverted.
* @return x_inv #vector inverted x.
......@@ -267,13 +268,16 @@ __attribute__((always_inline)) INLINE vector vec_reciprocal(vector x) {
vector x_inv;
x_inv.v = vec_rcp(x.v);
x_inv.v = vec_sub(x_inv.v, vec_mul(x_inv.v, (vec_fma(x.v, x_inv.v, vec_set1(-1.0f)))));
x_inv.v = vec_sub(x_inv.v,
vec_mul(x_inv.v, (vec_fma(x.v, x_inv.v, vec_set1(-1.0f)))));
return x_inv;
}
/**
* @brief Calculates the inverse and square root ($1/\sqrt{x}$) of a vector using intrinsics and a Newton iteration to obtain the correct level of accuracy.
* @brief Calculates the inverse and square root ($1/\sqrt{x}$) of a vector
* using intrinsics and a Newton iteration to obtain the correct level of
* accuracy.
*
* @param x #vector to be inverted.
* @return x_inv #vector inverted x.
......@@ -283,8 +287,11 @@ __attribute__((always_inline)) INLINE vector vec_reciprocal_sqrt(vector x) {
vector x_inv;
x_inv.v = vec_rsqrt(x.v);
x_inv.v = vec_sub(x_inv.v, vec_mul(vec_mul(vec_set1(0.5f), x_inv.v), (vec_fma(x.v, vec_mul(x_inv.v, x_inv.v), vec_set1(-1.0f)))));
x_inv.v = vec_sub(
x_inv.v,
vec_mul(vec_mul(vec_set1(0.5f), x_inv.v),
(vec_fma(x.v, vec_mul(x_inv.v, x_inv.v), vec_set1(-1.0f)))));
return x_inv;
}
......
......@@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
/* Finalize the dump. */
dump_close(&d);
/* Return a happy number. */
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment