Skip to content

Commit 27723f1

Browse files
author
Riccardo Balin
committed
fluids: fixed bug with petsc log events for SmartRedis calls
1 parent c3f083c commit 27723f1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

examples/fluids/src/misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ PetscLogEvent FLUIDS_SmartRedis_Train;
347347
PetscLogEvent FLUIDS_TrainDataCompute;
348348
PetscLogEvent FLUIDS_DifferentialFilter;
349349
PetscLogEvent FLUIDS_VelocityGradientProjection;
350-
static PetscClassId libCEED_classid;
350+
static PetscClassId libCEED_classid, onlineTrain_classid, misc_classid;
351351

352352
PetscErrorCode RegisterLogEvents() {
353353
PetscFunctionBeginUser;

examples/fluids/src/smartsim/sgs_dd_training.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ PetscErrorCode SGS_DD_TrainingSetup(Ceed ceed, User user, CeedData ceed_data, Pr
234234
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
235235
PetscSmartRedisCall(put_tensor(smartsim->client, "sizeInfo", 8, array_info, &array_info_dim, 1, SRTensorTypeInt64, SRMemLayoutContiguous));
236236
PetscCall(SmartRedisVerifyPutTensor(smartsim->client, "sizeInfo", 8));
237-
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
237+
PetscCall(PetscLogEventEnd(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
238238

239239
// -- Send array that communicates if tensors are overwritten in database
240240
PetscInt tensor_overwrite[2] = {sgs_dd_train->overwrite_training_data};
@@ -243,7 +243,7 @@ PetscErrorCode SGS_DD_TrainingSetup(Ceed ceed, User user, CeedData ceed_data, Pr
243243
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
244244
PetscSmartRedisCall(put_tensor(smartsim->client, "tensor-ow", 9, tensor_overwrite, dim_2, 1, SRTensorTypeInt64, SRMemLayoutContiguous));
245245
PetscCall(SmartRedisVerifyPutTensor(smartsim->client, "tensor-ow", 9));
246-
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
246+
PetscCall(PetscLogEventEnd(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
247247
}
248248
}
249249

@@ -319,7 +319,7 @@ PetscErrorCode TSMonitor_SGS_DD_Training(TS ts, PetscInt step_num, PetscReal sol
319319
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Train, 0, 0, 0, 0));
320320
PetscSmartRedisCall(put_tensor(smartsim->client, array_key, array_key_len, (void *)training_data, sgs_dd_train->training_data_array_dims, 2,
321321
SRTensorTypeDouble, SRMemLayoutContiguous));
322-
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Train, 0, 0, 0, 0));
322+
PetscCall(PetscLogEventEnd(FLUIDS_SmartRedis_Train, 0, 0, 0, 0));
323323
PetscCall(VecRestoreArrayRead(TrainingData, &training_data));
324324
}
325325
PetscCall(SmartRedisVerifyPutTensor(smartsim->client, array_key, array_key_len));
@@ -330,7 +330,7 @@ PetscErrorCode TSMonitor_SGS_DD_Training(TS ts, PetscInt step_num, PetscReal sol
330330

331331
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
332332
PetscSmartRedisCall(put_tensor(smartsim->client, "step", 4, step_array, dim_2, 1, SRTensorTypeInt64, SRMemLayoutContiguous));
333-
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
333+
PetscCall(PetscLogEventEnd(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
334334
}
335335
}
336336

@@ -353,7 +353,7 @@ PetscErrorCode TSPostStep_SGS_DD_Training(TS ts) {
353353
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
354354
PetscSmartRedisCall(
355355
unpack_tensor(smartsim->client, check_run_key, check_run_key_size, check_run, check_run_dims, 1, SRTensorTypeDouble, SRMemLayoutContiguous));
356-
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
356+
PetscCall(PetscLogEventEnd(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
357357
if (check_run[0] == 0) {
358358
PetscCall(PetscPrintf(user->comm, "-- Simulation stopped by 'check-run' tensor in Redis database\n"));
359359
PetscCall(TSSetConvergedReason(ts, TS_CONVERGED_USER));

examples/fluids/src/smartsim/smartsim.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PetscErrorCode SmartRedisVerifyPutTensor(void *c_client, const char *name, const
1717
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
1818
PetscSmartRedisCall(tensor_exists(c_client, name, name_length, &does_exist));
1919
PetscCheck(does_exist, PETSC_COMM_SELF, -1, "Tensor of name '%s' was not written to the database successfully", name);
20-
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
20+
PetscCall(PetscLogEventEnd(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
2121
PetscFunctionReturn(PETSC_SUCCESS);
2222
}
2323

@@ -37,7 +37,7 @@ PetscErrorCode SmartSimTrainingSetup(User user) {
3737
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
3838
PetscSmartRedisCall(put_tensor(smartsim->client, "check-run", 9, checkrun, dim_2, 1, SRTensorTypeDouble, SRMemLayoutContiguous));
3939
PetscCall(SmartRedisVerifyPutTensor(smartsim->client, "check-run", 9));
40-
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
40+
PetscCall(PetscLogEventEnd(FLUIDS_SmartRedis_Meta, 0, 0, 0, 0));
4141
}
4242
PetscFunctionReturn(PETSC_SUCCESS);
4343
}
@@ -64,7 +64,7 @@ PetscErrorCode SmartSimSetup(User user) {
6464

6565
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Init, 0, 0, 0, 0));
6666
PetscSmartRedisCall(SmartRedisCClient(num_orchestrator_nodes != 1, smartsim->rank_id_name, rank_id_name_len, &smartsim->client));
67-
PetscCall(PetscLogEventBegin(FLUIDS_SmartRedis_Init, 0, 0, 0, 0));
67+
PetscCall(PetscLogEventEnd(FLUIDS_SmartRedis_Init, 0, 0, 0, 0));
6868

6969
PetscCall(SmartSimTrainingSetup(user));
7070
PetscFunctionReturn(PETSC_SUCCESS);

0 commit comments

Comments
 (0)