Skip to content

Commit 605cd2f

Browse files
[Libraries/MPI] Minor sample fixes
1 parent 4449c28 commit 605cd2f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Libraries/MPI/jacobian_solver/src/01_jacobian_host_mpi_one-sided/mpi3_onesided_jacobian.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ int main(int argc, char *argv[])
2525
double *buffs[2] = { NULL, NULL };
2626
MPI_Win win[2] = { MPI_WIN_NULL, MPI_WIN_NULL };
2727

28+
/* Initialization of runtime and initial state of data */
29+
MPI_Init(&argc, &argv);
2830
/* Initialize subarray owned by current process
2931
* and create RMA-windows for MPI-3 one-sided communications.
3032
* - For this sample, we use host memory for buffers and windows.

Libraries/MPI/jacobian_solver/src/02_jacobian_device_mpi_one-sided_gpu_aware/mpi3_onesided_jacobian_gpu_openmp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
6464
*
6565
* NOTE: For simplification and unification across samples we use single team
6666
* to avoid extra syncronization across teams in the future */
67-
#pragma omp target teams distribute parallel for simd is_device_ptr(in, out) num_teams(1)
67+
#pragma omp target teams distribute parallel for is_device_ptr(in, out) num_teams(1)
6868
/* Calculate values on borders to initiate communications early */
6969
for (int column = 0; column < my_subarray.x_size; ++column) {
7070
RECALCULATE_POINT(out, in, column, 0, row_size);
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
8787
}
8888

8989
/* Offload compute loop to the device */
90-
#pragma omp target teams distribute parallel for simd is_device_ptr(in, out) collapse(2) num_teams(1)
90+
#pragma omp target teams distribute parallel for is_device_ptr(in, out) collapse(2) num_teams(1)
9191
/* Recalculate internal points in parallel with communication */
9292
for (int row = 1; row < my_subarray.y_size - 1; ++row) {
9393
for (int column = 0; column < my_subarray.x_size; ++column) {
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
104104
double result_norm = 0.0;
105105
double norm = 0.0;
106106

107-
#pragma omp target teams distribute parallel for simd is_device_ptr(b1, b2) reduction(+:norm) collapse(2)
107+
#pragma omp target teams distribute parallel for is_device_ptr(b1, b2) reduction(+:norm) collapse(2)
108108
for (int row = 0; row < my_subarray.y_size; ++row) {
109109
for (int column = 0; column < my_subarray.x_size; ++column) {
110110
int idx = XY_2_IDX(column, row, row_size);

Libraries/MPI/jacobian_solver/src/include/common.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#include <stdio.h>
44
#include <stdlib.h>
55

6-
//const int Nx = 16384; /* Grid size */
7-
const int Nx = 1024; /* Grid size */
6+
const int Nx = 16384; /* Grid size */
87
const int Ny = Nx;
98
const int Niter = 100; /* Nuber of algorithm iterations */
109
const int NormIteration = 10; /* Recaluculate norm after given number of iterations. 0 to disable norm calculation */

0 commit comments

Comments
 (0)