Skip to content

Commit 0b3b9d8

Browse files
committed
fluids - change HIP backends to use VECHIP and MATAIJHIPSPARSE by default
1 parent 5efef3b commit 0b3b9d8

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

examples/fluids/navierstokes.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,28 @@ int main(int argc, char **argv) {
147147
break;
148148
case CEED_MEM_DEVICE: {
149149
const char *resolved;
150+
150151
PetscCallCeed(ceed, CeedGetResource(ceed, &resolved));
151-
if (strstr(resolved, "/gpu/cuda"))
152+
if (strstr(resolved, "/gpu/cuda")) {
152153
vec_type = VECCUDA;
153-
else if (strstr(resolved, "/gpu/hip"))
154-
vec_type = VECKOKKOS;
155-
else if (strstr(resolved, "/gpu/sycl"))
154+
} else if (strstr(resolved, "/gpu/hip")) {
155+
vec_type = VECHIP;
156+
} else if (strstr(resolved, "/gpu/sycl")) {
156157
vec_type = VECKOKKOS;
157-
else
158+
} else {
158159
vec_type = VECSTANDARD;
160+
}
159161
}
160162
}
161-
if (strstr(vec_type, VECCUDA))
163+
if (strstr(vec_type, VECCUDA)) {
162164
mat_type = MATAIJCUSPARSE;
163-
else if (strstr(vec_type, VECKOKKOS))
165+
} else if (strstr(vec_type, VECHIP)) {
166+
mat_type = MATAIJHIPSPARSE;
167+
} else if (strstr(vec_type, VECKOKKOS)) {
164168
mat_type = MATAIJKOKKOS;
165-
else
169+
} else {
166170
mat_type = MATAIJ;
171+
}
167172
PetscCall(CreateDM(comm, problem, mat_type, vec_type, &dm));
168173
user->dm = dm;
169174
PetscCall(DMSetApplicationContext(dm, user));

examples/fluids/src/mat-ceed.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,12 +467,15 @@ PetscErrorCode MatCreateCeed(DM dm_x, DM dm_y, CeedOperator op_mult, CeedOperato
467467
MatType coo_mat_type;
468468

469469
PetscCall(VecGetType(ctx->X_loc, &vec_type));
470-
if (strstr(vec_type, VECCUDA))
470+
if (strstr(vec_type, VECCUDA)) {
471471
coo_mat_type = MATAIJCUSPARSE;
472-
else if (strstr(vec_type, VECKOKKOS))
472+
} else if (strstr(vec_type, VECHIP)) {
473+
coo_mat_type = MATAIJHIPSPARSE;
474+
} else if (strstr(vec_type, VECKOKKOS)) {
473475
coo_mat_type = MATAIJKOKKOS;
474-
else
476+
} else {
475477
coo_mat_type = MATAIJ;
478+
}
476479
PetscCall(PetscStrallocpy(coo_mat_type, &ctx->coo_mat_type));
477480
}
478481
// -- Set mat operations

0 commit comments

Comments
 (0)