xref: /honee/include/smartsim.h (revision 43e9749f49c7ec7925009a2b44ac9225ce901711)
1dc936754SJeremy L Thompson // Copyright (c) 2017-2024, 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
718fb7758SJeremy L Thompson #pragma once
87cd70835SJames Wright 
97cd70835SJames Wright #include <c_client.h>
107cd70835SJames Wright #include <petscsys.h>
117cd70835SJames Wright #include <sr_enums.h>
127cd70835SJames Wright 
137cd70835SJames Wright #if defined(__clang_analyzer__)
14*43e9749fSJames Wright void PetscCallSmartRedis(SRError);
157cd70835SJames Wright #else
16*43e9749fSJames Wright #define PetscCallSmartRedis(...)                                                                                                   \
177cd70835SJames Wright   do {                                                                                                                             \
187cd70835SJames Wright     SRError   ierr_smartredis_call_q_;                                                                                             \
197cd70835SJames Wright     PetscBool disable_calls = PETSC_FALSE;                                                                                         \
207cd70835SJames Wright     PetscStackUpdateLine;                                                                                                          \
217cd70835SJames Wright     PetscCall(PetscOptionsGetBool(NULL, NULL, "-smartsim_disable_calls", &disable_calls, NULL));                                   \
227cd70835SJames Wright     if (disable_calls == PETSC_TRUE) break;                                                                                        \
237cd70835SJames Wright     ierr_smartredis_call_q_ = __VA_ARGS__;                                                                                         \
247cd70835SJames Wright     if (PetscUnlikely(ierr_smartredis_call_q_ != SRNoError))                                                                       \
254fa1625aSJames Wright       SETERRQ(PETSC_COMM_SELF, (PetscErrorCode)ierr_smartredis_call_q_, "SmartRedis Error (Code %d): %s", ierr_smartredis_call_q_, \
264fa1625aSJames Wright               SRGetLastError());                                                                                                   \
277cd70835SJames Wright   } while (0)
287cd70835SJames Wright #endif
297cd70835SJames Wright 
307cd70835SJames Wright PetscErrorCode SmartRedisVerifyPutTensor(void *c_client, const char *name, const size_t name_length);
31