Added #ifdef PHPYOPENMP for all pragma

This commit is contained in:
Atsushi Togo 2021-04-12 18:24:48 +09:00
parent 0503db6f81
commit 1be2a1c004
15 changed files with 60 additions and 0 deletions

View File

@ -2189,7 +2189,9 @@ static void pinv_from_eigensolution(double *data,
tmp_data = (double*)malloc(sizeof(double) * size * size);
#ifdef PHPYOPENMP
#pragma omp parallel for
#endif
for (i = 0; i < size * size; i++) {
tmp_data[i] = data[i];
}
@ -2208,7 +2210,9 @@ static void pinv_from_eigensolution(double *data,
}
}
#ifdef PHPYOPENMP
#pragma omp parallel for private(ib, j, k, i_s, j_s, sum)
#endif
for (i = 0; i < size / 2; i++) {
/* from front */
i_s = i * size;

View File

@ -183,7 +183,9 @@ static void get_collision_matrix(double *collision_matrix,
gp2tp_map = create_gp2tp_map(triplets_map, num_gp);
#ifdef PHPYOPENMP
#pragma omp parallel for private(j, k, l, m, n, ti, r_gp, collision, inv_sinh)
#endif
for (i = 0; i < num_ir_gp; i++) {
inv_sinh = (double*)malloc(sizeof(double) * num_band);
for (j = 0; j < num_rot; j++) {
@ -253,7 +255,9 @@ get_reducible_collision_matrix(double *collision_matrix,
gp2tp_map = create_gp2tp_map(triplets_map, num_gp);
#ifdef PHPYOPENMP
#pragma omp parallel for private(j, k, l, ti, collision, inv_sinh)
#endif
for (i = 0; i < num_gp; i++) {
inv_sinh = (double*)malloc(sizeof(double) * num_band);
ti = gp2tp_map[triplets_map[i]];

View File

@ -97,7 +97,9 @@ long dym_get_dynamical_matrix_at_q(double *dynamical_matrix,
long i, j, ij;
if (with_openmp) {
#ifdef PHPYOPENMP
#pragma omp parallel for
#endif
for (ij = 0; ij < num_patom * num_patom ; ij++) {
get_dynmat_ij(dynamical_matrix,
num_patom,

View File

@ -157,7 +157,9 @@ void fc3_set_permutation_symmetry_fc3(double *fc3, const long num_atom)
double fc3_elem[27];
long i, j, k;
#ifdef PHPYOPENMP
#pragma omp parallel for private(j, k, fc3_elem)
#endif
for (i = 0; i < num_atom; i++) {
for (j = i; j < num_atom; j++) {
for (k = j; k < num_atom; k++) {

View File

@ -123,7 +123,9 @@ void ise_get_imag_self_energy_at_bands_with_g(double *imag_self_energy,
g_index_shift = frequency_point_index * num_band * num_band;
}
#ifdef PHPYOPENMP
#pragma omp parallel for private(num_g_pos, j, g_pos)
#endif
for (i = 0; i < num_triplets; i++) {
g_pos = (long(*)[4])malloc(sizeof(long[4]) * num_band_prod);
/* ise_set_g_pos only works for the case of frquency points at */
@ -209,7 +211,9 @@ void ise_get_detailed_imag_self_energy_at_bands_with_g
/* detailed_imag_self_energy has the same shape as fc3_normal_squared. */
#ifdef PHPYOPENMP
#pragma omp parallel for
#endif
for (i = 0; i < num_triplets; i++) {
detailed_imag_self_energy_at_triplet
(detailed_imag_self_energy + i * num_band_prod,
@ -235,7 +239,9 @@ void ise_get_detailed_imag_self_energy_at_bands_with_g
for (i = 0; i < num_band0; i++) {
N = 0;
U = 0;
/* #ifdef PHPYOPENMP */
/* #pragma omp parallel for private(ise_tmp) reduction(+:N,U) */
/* #endif */
for (j = 0; j < num_triplets; j++) {
ise_tmp = ise[j * num_band0 + i] * triplet_weights[j];
if (is_N[j]) {

View File

@ -132,7 +132,9 @@ void itr_get_interaction(Darray *fc3_normal_squared,
openmp_per_triplets = 0;
}
#ifdef PHPYOPENMP
#pragma omp parallel for schedule(guided) private(num_g_pos, g_pos) if (openmp_per_triplets)
#endif
for (i = 0; i < num_triplets; i++) {
g_pos = (long(*)[4])malloc(sizeof(long[4]) * num_band_prod);
num_g_pos = ise_set_g_pos(g_pos,

View File

@ -79,7 +79,9 @@ iso_get_isotope_scattering_strength(double *gamma,
continue;
}
sum_g = 0;
#ifdef PHPYOPENMP
#pragma omp parallel for private(k, l, m, f, e1_r, e1_i, a, b, dist, sum_g_k) reduction(+:sum_g)
#endif
for (j = 0; j < num_grid_points; j++) {
sum_g_k = 0;
for (k = 0; k < num_band; k++) { /* band index */
@ -162,12 +164,16 @@ void iso_get_thm_isotope_scattering_strength
}
gamma_ij = (double*)malloc(sizeof(double) * num_grid_points * num_band0);
#ifdef PHPYOPENMP
#pragma omp parallel for
#endif
for (i = 0; i < num_grid_points * num_band0; i++) {
gamma_ij[i] = 0;
}
#ifdef PHPYOPENMP
#pragma omp parallel for private(j, k, l, m, f, gp, e1_r, e1_i, a, b, dist, sum_g_k)
#endif
for (i = 0; i < num_grid_points; i++) {
gp = ir_grid_points[i];
for (j = 0; j < num_band0; j++) { /* band index0 */

View File

@ -130,7 +130,9 @@ void phonopy_pinv_mt(double *data_out,
{
int i;
#ifdef PHPYOPENMP
#pragma omp parallel for
#endif
for (i = 0; i < num_thread; i++) {
info_out[i] = phonopy_pinv(data_out + i * max_row_num * column_num,
data_in + i * max_row_num * column_num,

View File

@ -823,7 +823,9 @@ void ph3py_symmetrize_collision_matrix(double *collision_matrix,
adrs_shift = (i * num_column * num_column * num_temp +
j * num_column * num_column);
/* show_colmat_info(py_collision_matrix, i, j, adrs_shift); */
#ifdef PHPYOPENMP
#pragma omp parallel for schedule(guided) private(l, val)
#endif
for (k = 0; k < num_column; k++) {
for (l = k + 1; l < num_column; l++) {
val = (collision_matrix[adrs_shift + k * num_column + l] +
@ -859,7 +861,9 @@ void ph3py_expand_collision_matrix(double *collision_matrix,
num_column = num_grid_points * num_band;
num_bgb = num_band * num_grid_points * num_band;
#ifdef PHPYOPENMP
#pragma omp parallel for schedule(guided) private(j, ir_gp)
#endif
for (i = 0; i < num_ir_gp; i++) {
ir_gp = ir_grid_points[i];
multi[i] = 0;
@ -874,7 +878,9 @@ void ph3py_expand_collision_matrix(double *collision_matrix,
for (j = 0; j < num_temp; j++) {
adrs_shift = (i * num_column * num_column * num_temp +
j * num_column * num_column);
#ifdef PHPYOPENMP
#pragma omp parallel for private(ir_gp, adrs_shift_plus, colmat_copy, l, gp_r, m, n, p)
#endif
for (k = 0; k < num_ir_gp; k++) {
ir_gp = ir_grid_points[k];
adrs_shift_plus = adrs_shift + ir_gp * num_bgb;
@ -935,7 +941,9 @@ long ph3py_get_neighboring_gird_points(long *relative_grid_points,
bzgrid->D_diag[i] = D_diag[i];
}
#ifdef PHPYOPENMP
#pragma omp parallel for
#endif
for (i = 0; i < num_grid_points; i++) {
tpi_get_neighboring_grid_points
(relative_grid_points + i * num_relative_grid_address,
@ -985,7 +993,9 @@ long ph3py_set_integration_weights(double *iw,
bzgrid->D_diag[i] = D_diag[i];
}
#ifdef PHPYOPENMP
#pragma omp parallel for private(j, k, bi, vertices, freq_vertices)
#endif
for (i = 0; i < num_gp; i++) {
for (j = 0; j < 24; j++) {
tpi_get_neighboring_grid_points(vertices[j],

View File

@ -338,7 +338,9 @@ static void get_undone_phonons(double *frequencies,
num_band = num_patom * 3;
#ifdef PHPYOPENMP
#pragma omp parallel for private(j, q, gp, is_nac)
#endif
for (i = 0; i < num_undone_grid_points; i++) {
gp = undone_grid_points[i];
for (j = 0; j < 3; j++) {
@ -368,8 +370,10 @@ static void get_undone_phonons(double *frequencies,
}
/* To avoid multithreaded BLAS in OpenMP loop */
#ifdef PHPYOPENMP
#ifndef MULTITHREADED_BLAS
#pragma omp parallel for private(j, gp, freqs_tmp, info)
#endif
#endif
for (i = 0; i < num_undone_grid_points; i++) {
gp = undone_grid_points[i];
@ -423,7 +427,9 @@ static void get_gonze_undone_phonons(double *frequencies,
num_band = num_patom * 3;
#ifdef PHPYOPENMP
#pragma omp parallel for private(j, q, gp, is_nac)
#endif
for (i = 0; i < num_undone_grid_points; i++) {
gp = undone_grid_points[i];
for (j = 0; j < 3; j++) {
@ -457,8 +463,10 @@ static void get_gonze_undone_phonons(double *frequencies,
/* To avoid multithreaded BLAS in OpenMP loop */
#ifdef PHPYOPENMP
#ifndef MULTITHREADED_BLAS
#pragma omp parallel for private(j, gp, freqs_tmp, info)
#endif
#endif
for (i = 0; i < num_undone_grid_points; i++) {
gp = undone_grid_points[i];

View File

@ -131,7 +131,9 @@ void ppc_get_pp_collision(double *imag_self_energy,
relative_grid_address,
2);
#ifdef PHPYOPENMP
#pragma omp parallel for schedule(guided) private(g, g_zero) if (openmp_per_triplets)
#endif
for (i = 0; i < num_triplets; i++) {
g = (double*)malloc(sizeof(double) * 2 * num_band_prod);
g_zero = (char*)malloc(sizeof(char) * num_band_prod);
@ -253,7 +255,9 @@ void ppc_get_pp_collision_with_sigma(
cutoff = sigma * sigma_cutoff;
#ifdef PHPYOPENMP
#pragma omp parallel for schedule(guided) private(g, g_zero) if (openmp_per_triplets)
#endif
for (i = 0; i < num_triplets; i++) {
g = (double*)malloc(sizeof(double) * 2 * num_band_prod);
g_zero = (char*)malloc(sizeof(char) * num_band_prod);

View File

@ -160,7 +160,9 @@ static double get_real_self_energy_at_band(const long band_index,
num_band = fc3_normal_squared->dims[2];
shift = 0;
#ifdef PHPYOPENMP
#pragma omp parallel for private(gp1, gp2) reduction(+:shift)
#endif
for (i = 0; i < num_triplets; i++) {
gp1 = triplets[i][1];
gp2 = triplets[i][2];

View File

@ -185,7 +185,9 @@ real_to_reciprocal_openmp(lapack_complex_double *fc3_reciprocal,
num_patom = svecs_dims[1];
for (i = 0; i < num_patom; i++) {
#ifdef PHPYOPENMP
#pragma omp parallel for private(j, k)
#endif
for (jk = 0; jk < num_patom * num_patom; jk++) {
j = jk / num_patom;
k = jk % num_patom;
@ -207,7 +209,9 @@ real_to_reciprocal_openmp(lapack_complex_double *fc3_reciprocal,
pre_phase_factor = get_pre_phase_factor(
i, q_vecs, shortest_vectors, svecs_dims, multiplicity, p2s_map);
adrs_shift = i * num_patom * num_patom * 27;
#ifdef PHPYOPENMP
#pragma omp parallel for
#endif
for (j = 0; j < num_patom * num_patom * 27; j++) {
fc3_reciprocal[adrs_shift + j] =
phonoc_complex_prod(fc3_reciprocal[adrs_shift + j], pre_phase_factor);

View File

@ -101,7 +101,9 @@ void reciprocal_to_normal_squared
loopStartCPUTime = clock();
#endif
#ifdef PHPYOPENMP
#pragma omp parallel for if (openmp_at_bands)
#endif
for (i = 0; i < num_g_pos; i++) {
if (freqs0[band_indices[g_pos[i][0]]] > cutoff_frequency) {
fc3_normal_squared[g_pos[i][3]] = get_fc3_sum(g_pos[i][1],

View File

@ -137,7 +137,9 @@ void tpl_get_integration_weight_with_sigma(double *iw,
num_band_prod = num_band0 * num_band * num_band;
const_adrs_shift = num_triplets * num_band0 * num_band * num_band;
#ifdef PHPYOPENMP
#pragma omp parallel for
#endif
for (i = 0; i < num_triplets; i++) {
tpi_get_integration_weight_with_sigma(
iw + i * num_band_prod,