You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Libraries/MPI/jacobian_solver/src/04_jacobian_device_mpi_one-sided_device_initiated_notify/mpi3_onesided_jacobian_cpu_notify.c
+17-16Lines changed: 17 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -64,25 +64,10 @@ int main(int argc, char *argv[])
64
64
for (intk=0; k<iterations_batch; ++k)
65
65
{
66
66
inti=passed_iters+k;
67
-
MPI_Winprev_win=win[i % 2];
68
67
MPI_Wincurrent_win=win[(i+1) % 2];
69
68
double*in=buffs[i % 2];
70
69
double*out=buffs[(1+i) % 2];
71
70
72
-
/* Wait for the notification counter to reach the expected value:
73
-
* here we check that communication operations issued by peers on the previous iteration are completed
74
-
* and data is ready for the next iteration.
75
-
*
76
-
* NOTE:
77
-
* To be completely standard compliant, the application should check the memory model
78
-
* and call MPI_Win_sync(prev_win) in case of MPI_WIN_SEPARATE mode after the notification has been received.
79
-
* Although, IntelMPI uses the MPI_WIN_UNIFIED memory model, so this call could be omitted.
80
-
*/
81
-
MPI_Countc=0;
82
-
MPI_Win_flush_local_all(current_win);
83
-
while (c< (iter_counter_step*i)) {
84
-
MPI_Win_notify_get_value(prev_win, 0, &c);
85
-
}
86
71
87
72
/* Calculate values on the borders to initiate communications early */
88
73
for (intcolumn=0; column<my_subarray.x_size; column++) {
@@ -119,6 +104,22 @@ int main(int argc, char *argv[])
119
104
RECALCULATE_POINT(out, in, column, row, row_size);
120
105
}
121
106
}
107
+
108
+
/* Wait for the notification counter to reach the expected value:
109
+
* here we check that communication operations issued by peers on the previous iteration are completed
110
+
* and data is ready for the next iteration.
111
+
*
112
+
* NOTE:
113
+
* To be completely standard compliant, the application should check the memory model
114
+
* and call MPI_Win_sync(prev_win) in case of MPI_WIN_SEPARATE mode after the notification has been received.
115
+
* Although, IntelMPI uses the MPI_WIN_UNIFIED memory model, so this call could be omitted.
116
+
*/
117
+
MPI_Countc=0;
118
+
MPI_Win_flush_all(current_win);
119
+
while (c<iter_counter_step) {
120
+
MPI_Win_notify_get_value(current_win, 0, &c);
121
+
}
122
+
MPI_Win_notify_set_value(current_win, 0, 0);
122
123
}
123
124
124
125
/* Calculate the norm value after the given number of iterations */
@@ -154,4 +155,4 @@ int main(int argc, char *argv[])
Copy file name to clipboardExpand all lines: Libraries/MPI/jacobian_solver/src/04_jacobian_device_mpi_one-sided_device_initiated_notify/mpi3_onesided_jacobian_gpu_omp_device_initiated_notify.c
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -81,26 +81,10 @@ int main(int argc, char *argv[])
81
81
for (intk=0; k<iterations_batch; ++k)
82
82
{
83
83
inti=passed_iters+k;
84
-
MPI_Winprev_win=win[i % 2];
85
84
MPI_Wincurrent_win=win[(i+1) % 2];
86
85
double*in= (i % 2) ? b1 : b2;
87
86
double*out= ((1+i) % 2) ? b1 : b2;
88
87
89
-
/* Wait for the notification counter to reach the expected value:
90
-
* here we check that communication operations issued by peers on the previous iteration are completed
91
-
* and data is ready for the next iteration.
92
-
*
93
-
* NOTE:
94
-
* To be completely standard compliant, the application should check the memory model
95
-
* and call MPI_Win_sync(prev_win) in case of MPI_WIN_SEPARATE mode after the notification has been received.
96
-
* Although, IntelMPI uses the MPI_WIN_UNIFIED memory model, so this call could be omitted.
97
-
*/
98
-
MPI_Countc=0;
99
-
MPI_Win_flush_all(current_win);
100
-
while (c< (iter_counter_step*i)) {
101
-
MPI_Win_notify_get_value(prev_win, 0, &c);
102
-
}
103
-
104
88
/* Start parallel loop on the device to accelerate calculation */
105
89
#pragma omp parallel for
106
90
/* Calculate values on the borders to initiate communications early */
@@ -141,6 +125,22 @@ int main(int argc, char *argv[])
141
125
RECALCULATE_POINT(out, in, column, row, row_size);
142
126
}
143
127
}
128
+
129
+
/* Wait for the notification counter to reach the expected value:
130
+
* here we check that communication operations issued by peers on the previous iteration are completed
131
+
* and data is ready for the next iteration.
132
+
*
133
+
* NOTE:
134
+
* To be completely standard compliant, the application should check the memory model
135
+
* and call MPI_Win_sync(prev_win) in case of MPI_WIN_SEPARATE mode after the notification has been received.
136
+
* Although, IntelMPI uses the MPI_WIN_UNIFIED memory model, so this call could be omitted.
0 commit comments