xref: /honee/include/smartsim.h (revision ff6b888aa80d05dd5e7d594928ee5f29b1102157)
17cd70835SJames Wright // Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and other CEED contributors.
27cd70835SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
37cd70835SJames Wright //
47cd70835SJames Wright // SPDX-License-Identifier: BSD-2-Clause
57cd70835SJames Wright //
67cd70835SJames Wright // This file is part of CEED:  http://github.com/ceed
77cd70835SJames Wright 
87cd70835SJames Wright #include <c_client.h>
97cd70835SJames Wright #include <petscsys.h>
107cd70835SJames Wright #include <sr_enums.h>
117cd70835SJames Wright 
127cd70835SJames Wright #if defined(__clang_analyzer__)
13*ff6b888aSJames Wright void PetscSmartRedisCall(SRError);
147cd70835SJames Wright #else
15*ff6b888aSJames Wright #define PetscSmartRedisCall(...)                                                                                                      \
167cd70835SJames Wright   do {                                                                                                                                \
177cd70835SJames Wright     SRError   ierr_smartredis_call_q_;                                                                                                \
187cd70835SJames Wright     PetscBool disable_calls = PETSC_FALSE;                                                                                            \
197cd70835SJames Wright     PetscStackUpdateLine;                                                                                                             \
207cd70835SJames Wright     PetscCall(PetscOptionsGetBool(NULL, NULL, "-smartsim_disable_calls", &disable_calls, NULL));                                      \
217cd70835SJames Wright     if (disable_calls == PETSC_TRUE) break;                                                                                           \
227cd70835SJames Wright     ierr_smartredis_call_q_ = __VA_ARGS__;                                                                                            \
237cd70835SJames Wright     if (PetscUnlikely(ierr_smartredis_call_q_ != SRNoError))                                                                          \
247cd70835SJames Wright       SETERRQ(PETSC_COMM_SELF, ierr_smartredis_call_q_, "SmartRedis Error (Code %d): %s", ierr_smartredis_call_q_, SRGetLastError()); \
257cd70835SJames Wright   } while (0)
267cd70835SJames Wright #endif
277cd70835SJames Wright 
287cd70835SJames Wright PetscErrorCode SmartRedisVerifyPutTensor(void *c_client, const char *name, const size_t name_length);
29