1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors. 2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause 3 #pragma once 4 5 #include <c_client.h> 6 #include <honee.h> 7 #include <petscsys.h> 8 #include <smartsim.h> 9 #include <sr_enums.h> 10 11 #if defined(__clang_analyzer__) 12 void PetscCallSmartRedis(SRError); 13 #else 14 #define PetscCallSmartRedis(...) \ 15 do { \ 16 SRError ierr_smartredis_call_q_; \ 17 PetscBool disable_calls = PETSC_FALSE; \ 18 PetscStackUpdateLine; \ 19 PetscCall(PetscOptionsGetBool(NULL, NULL, "-smartsim_disable_calls", &disable_calls, NULL)); \ 20 if (disable_calls == PETSC_TRUE) break; \ 21 ierr_smartredis_call_q_ = __VA_ARGS__; \ 22 if (PetscUnlikely(ierr_smartredis_call_q_ != SRNoError)) \ 23 SETERRQ(PETSC_COMM_SELF, (PetscErrorCode)ierr_smartredis_call_q_, "SmartRedis Error (Code %d): %s", ierr_smartredis_call_q_, \ 24 SRGetLastError()); \ 25 } while (0) 26 #endif 27 28 typedef struct { 29 void *client; 30 char rank_id_name[16]; 31 PetscInt collocated_database_num_ranks; 32 } *SmartSimData; 33 34 PetscErrorCode HoneeGetSmartSimData(Honee honee, SmartSimData *smartsim); 35 36 PetscErrorCode SmartRedisVerifyPutTensor(void *c_client, const char *name, const size_t name_length); 37