Skip to content

Commit

Permalink
Restore omp simd clauses commented out during debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Oct 10, 2023
1 parent e24d894 commit 217ad04
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 57 deletions.
50 changes: 25 additions & 25 deletions src/libtoast/src/toast_math_qarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void toast::qa_list_dot(size_t n, size_t m, size_t d, double const * a,
double const * b, double * dotprod) {
if (toast::is_aligned(a) && toast::is_aligned(b) &&
toast::is_aligned(dotprod)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
dotprod[i] = 0.0;
size_t off = m * i;
Expand All @@ -42,7 +42,7 @@ void toast::qa_list_dot(size_t n, size_t m, size_t d, double const * a,

void toast::qa_inv(size_t n, double * q) {
if (toast::is_aligned(q)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
for (size_t j = 0; j < 3; ++j) {
q[4 * i + j] *= -1;
Expand Down Expand Up @@ -105,7 +105,7 @@ void toast::qa_normalize(size_t n, size_t m, size_t d,
toast::qa_amplitude(n, m, d, q_in, norm.data());

if (toast::is_aligned(q_in) && toast::is_aligned(q_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t off = m * i;
for (size_t j = 0; j < d; ++j) {
Expand Down Expand Up @@ -145,7 +145,7 @@ void toast::qa_normalize_inplace(size_t n, size_t m, size_t d, double * q) {
toast::qa_amplitude(n, m, d, q, norm.data());

if (toast::is_aligned(q)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
for (size_t j = 0; j < d; ++j) {
q[m * i + j] /= norm[i];
Expand Down Expand Up @@ -204,7 +204,7 @@ void toast::qa_rotate_many_one(size_t nq, double const * q,
toast::qa_normalize(nq, 4, 4, q, q_unit.data());

if (toast::is_aligned(v_in) && toast::is_aligned(v_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < nq; ++i) {
size_t vfout = 3 * i;
size_t qf = 4 * i;
Expand Down Expand Up @@ -278,7 +278,7 @@ void toast::qa_rotate_one_many(double const * q, size_t nv,
double z2 = -q_unit[2] * q_unit[2];

if (toast::is_aligned(v_in) && toast::is_aligned(v_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < nv; ++i) {
size_t vf = 3 * i;
v_out[vf + 0] = 2 *
Expand Down Expand Up @@ -322,7 +322,7 @@ void toast::qa_rotate_many_many(size_t n, double const * q,
toast::qa_normalize(n, 4, 4, q, q_unit.data());

if (toast::is_aligned(v_in) && toast::is_aligned(v_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t vf = 3 * i;
size_t qf = 4 * i;
Expand Down Expand Up @@ -416,7 +416,7 @@ void toast::qa_mult_one_one(double const * p, double const * q,
void toast::qa_mult_one_many(double const * p, size_t nq,
double const * q, double * r) {
if (toast::is_aligned(p) && toast::is_aligned(q) && toast::is_aligned(r)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < nq; ++i) {
size_t f = 4 * i;
r[f + 0] = p[0] * q[f + 3] + p[1] * q[f + 2] - p[2] * q[f + 1] +
Expand Down Expand Up @@ -448,7 +448,7 @@ void toast::qa_mult_one_many(double const * p, size_t nq,
void toast::qa_mult_many_one(size_t np, double const * p,
double const * q, double * r) {
if (toast::is_aligned(p) && toast::is_aligned(q) && toast::is_aligned(r)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < np; ++i) {
size_t f = 4 * i;
r[f + 0] = p[f + 0] * q[3] + p[f + 1] * q[2] -
Expand Down Expand Up @@ -480,7 +480,7 @@ void toast::qa_mult_many_one(size_t np, double const * p,
void toast::qa_mult_many_many(size_t np, double const * p, size_t nq,
double const * q, double * r) {
if (toast::is_aligned(p) && toast::is_aligned(q) && toast::is_aligned(r)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < np; ++i) {
size_t f = 4 * i;
r[f + 0] = p[f + 0] * q[f + 3] + p[f + 1] * q[f + 2] -
Expand Down Expand Up @@ -604,7 +604,7 @@ void toast::qa_exp(size_t n, double const * q_in, double * q_out) {
toast::qa_amplitude(n, 4, 3, q_in, normv.data());

if (toast::is_aligned(q_in) && toast::is_aligned(q_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t off = 4 * i;
double exp_q_w = ::exp(q_in[off + 3]);
Expand Down Expand Up @@ -641,7 +641,7 @@ void toast::qa_ln(size_t n, double const * q_in, double * q_out) {
toast::qa_normalize(n, 4, 3, q_in, q_out);

if (toast::is_aligned(q_in) && toast::is_aligned(q_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t off = 4 * i;
q_out[off + 3] = ::log(normq[i]);
Expand Down Expand Up @@ -673,7 +673,7 @@ void toast::qa_pow(size_t nq, size_t np, double const * p, double const * q_in,
toast::qa_ln(nq, q_in, q_tmp.data());

if (np == 1) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < nq; ++i) {
size_t off = 4 * i;
q_tmp[off] *= p[0];
Expand All @@ -683,7 +683,7 @@ void toast::qa_pow(size_t nq, size_t np, double const * p, double const * q_in,
}
} else if (np == nq) {
if (toast::is_aligned(p)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < nq; ++i) {
size_t off = 4 * i;
q_tmp[off] *= p[i];
Expand Down Expand Up @@ -734,7 +734,7 @@ void toast::qa_from_axisangle_one_many(size_t nang, double const * axis,
double const * angle, double * q_out) {
toast::AlignedVector <double> a(nang);
if (toast::is_aligned(angle)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < nang; ++i) {
a[i] = 0.5 * angle[i];
}
Expand All @@ -750,7 +750,7 @@ void toast::qa_from_axisangle_one_many(size_t nang, double const * axis,
toast::vsincos(nang, a.data(), sin_a.data(), cos_a.data());

if (toast::is_aligned(axis) && toast::is_aligned(q_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < nang; ++i) {
size_t off = 4 * i;
q_out[off] = axis[0] * sin_a[i];
Expand All @@ -776,7 +776,7 @@ void toast::qa_from_axisangle_many_one(size_t naxis, double const * axis,
double cos_a = ::cos(0.5 * angle);

if (toast::is_aligned(axis) && toast::is_aligned(q_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < naxis; ++i) {
size_t off = 4 * i;
size_t voff = 3 * i;
Expand All @@ -803,7 +803,7 @@ void toast::qa_from_axisangle_many_many(size_t n, double const * axis,
toast::AlignedVector <double> a(n);

if (toast::is_aligned(angle)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
a[i] = 0.5 * angle[i];
}
Expand All @@ -819,7 +819,7 @@ void toast::qa_from_axisangle_many_many(size_t n, double const * axis,
toast::vsincos(n, a.data(), sin_a.data(), cos_a.data());

if (toast::is_aligned(axis) && toast::is_aligned(q_out)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t off = 4 * i;
size_t voff = 3 * i;
Expand Down Expand Up @@ -889,7 +889,7 @@ void toast::qa_to_axisangle(size_t n, double const * q, double * axis,
double * angle) {
if (toast::is_aligned(q) && toast::is_aligned(axis) &&
toast::is_aligned(angle)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t qf = 4 * i;
size_t vf = 3 * i;
Expand Down Expand Up @@ -996,7 +996,7 @@ void toast::qa_from_vectors(size_t n, double const * vec1,
double const * vec2, double * q) {
if (toast::is_aligned(vec1) && toast::is_aligned(vec2) &&
toast::is_aligned(q)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t vf = 3 * i;
size_t qf = 4 * i;
Expand Down Expand Up @@ -1066,7 +1066,7 @@ void toast::qa_from_angles(size_t n, double const * theta,
double * quat, bool IAU) {
if (toast::is_aligned(theta) && toast::is_aligned(phi) &&
toast::is_aligned(pa) && toast::is_aligned(quat)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t qf = 4 * i;
double qR[4];
Expand Down Expand Up @@ -1167,7 +1167,7 @@ void toast::qa_to_angles(size_t n, double const * quat, double * theta,
double * phi, double * pa, bool IAU) {
if (toast::is_aligned(theta) && toast::is_aligned(phi) &&
toast::is_aligned(pa) && toast::is_aligned(quat)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
double const xaxis[3] = {1.0, 0.0, 0.0};
double const zaxis[3] = {0.0, 0.0, 1.0};
Expand Down Expand Up @@ -1249,7 +1249,7 @@ void toast::qa_from_position(size_t n, double const * theta,
double const * phi, double * quat) {
if (toast::is_aligned(theta) && toast::is_aligned(phi)
&& toast::is_aligned(quat)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
size_t qf = 4 * i;
double qR[4];
Expand Down Expand Up @@ -1312,7 +1312,7 @@ void toast::qa_to_position(size_t n, double const * quat, double * theta,
double * phi) {
if (toast::is_aligned(theta) && toast::is_aligned(phi) &&
toast::is_aligned(quat)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
double const zaxis[3] = {0.0, 0.0, 1.0};
size_t qf = 4 * i;
Expand Down
10 changes: 5 additions & 5 deletions src/libtoast/src/toast_math_rng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void toast::rng_dist_uint64(size_t n, uint64_t key1, uint64_t key2,
RNG::ukey_type uk = {{key1, key2}};

if (toast::is_aligned(data)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
data[i] = rng(
RNG::ctr_type({{counter1, counter2 + i}}),
Expand All @@ -51,7 +51,7 @@ void toast::rng_dist_uniform_01(size_t n,
RNG::ukey_type uk = {{key1, key2}};

if (toast::is_aligned(data)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
data[i] = r123::u01 <double, uint64_t> (
rng(RNG::ctr_type({{counter1, counter2 + i}}),
Expand All @@ -77,7 +77,7 @@ void toast::rng_dist_uniform_11(size_t n,
RNG::ukey_type uk = {{key1, key2}};

if (toast::is_aligned(data)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
data[i] = r123::uneg11 <double, uint64_t> (
rng(RNG::ctr_type({{counter1, counter2 + i}}),
Expand All @@ -104,7 +104,7 @@ void toast::rng_dist_normal(size_t n,
toast::rng_dist_uniform_01(n, key1, key2, counter1, counter2,
uni.data());

//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
uni[i] = 2.0 * uni[i] - 1.0;
}
Expand All @@ -118,7 +118,7 @@ void toast::rng_dist_normal(size_t n,
double rttwo = ::sqrt(2.0);

if (toast::is_aligned(data)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (size_t i = 0; i < n; ++i) {
data[i] *= rttwo;
}
Expand Down
20 changes: 10 additions & 10 deletions src/libtoast/src/toast_math_sf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void toast::vfast_erfinv(int n, double const * in, double * out) {

void toast::vsin(int n, double const * ang, double * sinout) {
if (toast::is_aligned(ang) && toast::is_aligned(sinout)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
sinout[i] = ::sin(ang[i]);
}
Expand All @@ -133,7 +133,7 @@ void toast::vsin(int n, double const * ang, double * sinout) {

void toast::vcos(int n, double const * ang, double * cosout) {
if (toast::is_aligned(ang) && toast::is_aligned(cosout)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
cosout[i] = ::cos(ang[i]);
}
Expand All @@ -149,7 +149,7 @@ void toast::vsincos(int n, double const * ang, double * sinout,
double * cosout) {
if (toast::is_aligned(ang) && toast::is_aligned(sinout) &&
toast::is_aligned(cosout)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
sinout[i] = ::sin(ang[i]);
cosout[i] = ::cos(ang[i]);
Expand All @@ -167,7 +167,7 @@ void toast::vatan2(int n, double const * y, double const * x,
double * ang) {
if (toast::is_aligned(ang) && toast::is_aligned(x) &&
toast::is_aligned(y)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
ang[i] = ::atan2(y[i], x[i]);
}
Expand All @@ -181,7 +181,7 @@ void toast::vatan2(int n, double const * y, double const * x,

void toast::vsqrt(int n, double const * in, double * out) {
if (toast::is_aligned(in) && toast::is_aligned(out)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
out[i] = ::sqrt(in[i]);
}
Expand All @@ -195,7 +195,7 @@ void toast::vsqrt(int n, double const * in, double * out) {

void toast::vrsqrt(int n, double const * in, double * out) {
if (toast::is_aligned(in) && toast::is_aligned(out)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
out[i] = 1.0 / ::sqrt(in[i]);
}
Expand All @@ -209,7 +209,7 @@ void toast::vrsqrt(int n, double const * in, double * out) {

void toast::vexp(int n, double const * in, double * out) {
if (toast::is_aligned(in) && toast::is_aligned(out)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
out[i] = ::exp(in[i]);
}
Expand All @@ -223,7 +223,7 @@ void toast::vexp(int n, double const * in, double * out) {

void toast::vlog(int n, double const * in, double * out) {
if (toast::is_aligned(in) && toast::is_aligned(out)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
out[i] = ::log(in[i]);
}
Expand Down Expand Up @@ -580,7 +580,7 @@ void toast::vfast_erfinv(int n, double const * in, double * out) {
toast::AlignedVector <double> lg(n);

if (toast::is_aligned(in)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
double ab = ::fabs(in[i]);
arg[i] = (1.0 - ab) * (1.0 + ab);
Expand All @@ -595,7 +595,7 @@ void toast::vfast_erfinv(int n, double const * in, double * out) {
toast::vfast_log(n, arg.data(), lg.data());

if (toast::is_aligned(out)) {
//DEBUG # pragma omp simd
# pragma omp simd
for (int i = 0; i < n; ++i) {
double w = -lg[i];
double p;
Expand Down
4 changes: 2 additions & 2 deletions src/libtoast/src/toast_template_offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void toast::template_offset_add_to_signal(int64_t step_length, int64_t n_amp,
int64_t n_data, double * data) {
// All but the last amplitude have the same number of samples.
if (toast::is_aligned(amplitudes) && toast::is_aligned(data)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (int64_t i = 0; i < n_amp - 1; ++i) {
int64_t doff = i * step_length;
for (int64_t j = 0; j < step_length; ++j) {
Expand Down Expand Up @@ -42,7 +42,7 @@ void toast::template_offset_project_signal(int64_t step_length, int64_t n_data,
double * amplitudes) {
// All but the last amplitude have the same number of samples.
if (toast::is_aligned(amplitudes) && toast::is_aligned(data)) {
//DEBUG #pragma omp simd
#pragma omp simd
for (int64_t i = 0; i < n_amp - 1; ++i) {
int64_t doff = i * step_length;

Expand Down
Loading

0 comments on commit 217ad04

Please sign in to comment.