15aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 29798701eSJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 39798701eSJeremy L Thompson // 49798701eSJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 59798701eSJeremy L Thompson // 69798701eSJeremy L Thompson // This file is part of CEED: http://github.com/ceed 79798701eSJeremy L Thompson 849aac155SJeremy L Thompson #include <ceed.h> 99798701eSJeremy L Thompson #include <ceed/backend.h> 109798701eSJeremy L Thompson #include <math.h> 1149aac155SJeremy L Thompson #include <stdbool.h> 129798701eSJeremy L Thompson #include <string.h> 139798701eSJeremy L Thompson #include <valgrind/memcheck.h> 149798701eSJeremy L Thompson 159798701eSJeremy L Thompson #include "ceed-memcheck.h" 169798701eSJeremy L Thompson 179798701eSJeremy L Thompson //------------------------------------------------------------------------------ 189798701eSJeremy L Thompson // Has Valid Array 199798701eSJeremy L Thompson //------------------------------------------------------------------------------ 209798701eSJeremy L Thompson static int CeedVectorHasValidArray_Memcheck(CeedVector vec, bool *has_valid_array) { 219798701eSJeremy L Thompson CeedVector_Memcheck *impl; 22ad70ee2cSJeremy L Thompson 239798701eSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 249937a20eSJeremy L Thompson *has_valid_array = !!impl->array_allocated; 259798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 269798701eSJeremy L Thompson } 279798701eSJeremy L Thompson 289798701eSJeremy L Thompson //------------------------------------------------------------------------------ 299798701eSJeremy L Thompson // Check if has borrowed array of given type 309798701eSJeremy L Thompson //------------------------------------------------------------------------------ 319798701eSJeremy L Thompson static inline int CeedVectorHasBorrowedArrayOfType_Memcheck(const CeedVector vec, CeedMemType mem_type, bool *has_borrowed_array_of_type) { 32ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 33ad70ee2cSJeremy L Thompson 346e536b99SJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, CeedVectorReturnCeed(vec), CEED_ERROR_BACKEND, "Can only set HOST memory for this backend"); 359937a20eSJeremy L Thompson 369937a20eSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 379937a20eSJeremy L Thompson *has_borrowed_array_of_type = !!impl->array_borrowed; 389798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 399798701eSJeremy L Thompson } 409798701eSJeremy L Thompson 419798701eSJeremy L Thompson //------------------------------------------------------------------------------ 429798701eSJeremy L Thompson // Vector Set Array 439798701eSJeremy L Thompson //------------------------------------------------------------------------------ 449798701eSJeremy L Thompson static int CeedVectorSetArray_Memcheck(CeedVector vec, CeedMemType mem_type, CeedCopyMode copy_mode, CeedScalar *array) { 45ad70ee2cSJeremy L Thompson CeedSize length; 46ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 47ad70ee2cSJeremy L Thompson 489937a20eSJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, CeedVectorReturnCeed(vec), CEED_ERROR_BACKEND, "Can only set HOST memory for this backend"); 499937a20eSJeremy L Thompson 50ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 51ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetLength(vec, &length)); 529798701eSJeremy L Thompson 539937a20eSJeremy L Thompson // Clear previous owned arrays 54d1931fc8SJeremy L Thompson if (impl->array_allocated) { 55d1931fc8SJeremy L Thompson for (CeedSize i = 0; i < length; i++) impl->array_allocated[i] = NAN; 56*0307dd02SJeremy L Thompson VALGRIND_DISCARD(impl->allocated_block_id); 57d1931fc8SJeremy L Thompson } 589798701eSJeremy L Thompson CeedCallBackend(CeedFree(&impl->array_allocated)); 59d1931fc8SJeremy L Thompson if (impl->array_owned) { 60d1931fc8SJeremy L Thompson for (CeedSize i = 0; i < length; i++) impl->array_owned[i] = NAN; 619937a20eSJeremy L Thompson VALGRIND_DISCARD(impl->owned_block_id); 62*0307dd02SJeremy L Thompson } 639798701eSJeremy L Thompson CeedCallBackend(CeedFree(&impl->array_owned)); 649937a20eSJeremy L Thompson 659937a20eSJeremy L Thompson // Clear borrowed block id, if present 669937a20eSJeremy L Thompson if (impl->array_borrowed) VALGRIND_DISCARD(impl->borrowed_block_id); 679937a20eSJeremy L Thompson 689937a20eSJeremy L Thompson // Set internal pointers to external arrays 699798701eSJeremy L Thompson switch (copy_mode) { 709798701eSJeremy L Thompson case CEED_COPY_VALUES: 719937a20eSJeremy L Thompson impl->array_owned = NULL; 729798701eSJeremy L Thompson impl->array_borrowed = NULL; 739798701eSJeremy L Thompson break; 749798701eSJeremy L Thompson case CEED_OWN_POINTER: 759798701eSJeremy L Thompson impl->array_owned = array; 769798701eSJeremy L Thompson impl->array_borrowed = NULL; 779937a20eSJeremy L Thompson impl->owned_block_id = VALGRIND_CREATE_BLOCK(impl->array_owned, length * sizeof(CeedScalar), "Owned external array buffer"); 789798701eSJeremy L Thompson break; 799798701eSJeremy L Thompson case CEED_USE_POINTER: 809937a20eSJeremy L Thompson impl->array_owned = NULL; 819798701eSJeremy L Thompson impl->array_borrowed = array; 829937a20eSJeremy L Thompson impl->borrowed_block_id = VALGRIND_CREATE_BLOCK(impl->array_borrowed, length * sizeof(CeedScalar), "Borrowed external array buffer"); 839937a20eSJeremy L Thompson break; 849798701eSJeremy L Thompson } 859937a20eSJeremy L Thompson 869937a20eSJeremy L Thompson // Create internal array data buffer 879798701eSJeremy L Thompson CeedCallBackend(CeedCalloc(length, &impl->array_allocated)); 889937a20eSJeremy L Thompson impl->allocated_block_id = VALGRIND_CREATE_BLOCK(impl->array_allocated, length * sizeof(CeedScalar), "Allocated internal array buffer"); 899937a20eSJeremy L Thompson if (array) { 909937a20eSJeremy L Thompson memcpy(impl->array_allocated, array, length * sizeof(CeedScalar)); 919937a20eSJeremy L Thompson } else { 929937a20eSJeremy L Thompson for (CeedInt i = 0; i < length; i++) impl->array_allocated[i] = NAN; 939937a20eSJeremy L Thompson } 949937a20eSJeremy L Thompson return CEED_ERROR_SUCCESS; 959937a20eSJeremy L Thompson } 969937a20eSJeremy L Thompson 979937a20eSJeremy L Thompson //------------------------------------------------------------------------------ 989937a20eSJeremy L Thompson // Sync arrays 999937a20eSJeremy L Thompson //------------------------------------------------------------------------------ 1009937a20eSJeremy L Thompson static int CeedVectorSyncArray_Memcheck(const CeedVector vec, CeedMemType mem_type) { 1019937a20eSJeremy L Thompson CeedSize length; 1029937a20eSJeremy L Thompson CeedVector_Memcheck *impl; 1039937a20eSJeremy L Thompson 1049937a20eSJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, CeedVectorReturnCeed(vec), CEED_ERROR_BACKEND, "Can only provide HOST memory for this backend"); 1059937a20eSJeremy L Thompson 1069937a20eSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 1079937a20eSJeremy L Thompson CeedCallBackend(CeedVectorGetLength(vec, &length)); 1089937a20eSJeremy L Thompson 1099937a20eSJeremy L Thompson // Copy internal buffer back to owned or borrowed array 1109937a20eSJeremy L Thompson if (impl->array_owned) { 1119937a20eSJeremy L Thompson memcpy(impl->array_owned, impl->array_allocated, length * sizeof(CeedScalar)); 1129937a20eSJeremy L Thompson } 1139937a20eSJeremy L Thompson if (impl->array_borrowed) { 1149937a20eSJeremy L Thompson memcpy(impl->array_borrowed, impl->array_allocated, length * sizeof(CeedScalar)); 1159937a20eSJeremy L Thompson } 1169798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 1179798701eSJeremy L Thompson } 1189798701eSJeremy L Thompson 1199798701eSJeremy L Thompson //------------------------------------------------------------------------------ 1209798701eSJeremy L Thompson // Vector Take Array 1219798701eSJeremy L Thompson //------------------------------------------------------------------------------ 1229798701eSJeremy L Thompson static int CeedVectorTakeArray_Memcheck(CeedVector vec, CeedMemType mem_type, CeedScalar **array) { 123d1931fc8SJeremy L Thompson CeedSize length; 124ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 125ad70ee2cSJeremy L Thompson 1269937a20eSJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, CeedVectorReturnCeed(vec), CEED_ERROR_BACKEND, "Can only provide HOST memory for this backend"); 1279937a20eSJeremy L Thompson 128ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 129d1931fc8SJeremy L Thompson CeedCallBackend(CeedVectorGetLength(vec, &length)); 1309798701eSJeremy L Thompson 1319937a20eSJeremy L Thompson // Synchronize memory 1329937a20eSJeremy L Thompson CeedCallBackend(CeedVectorSyncArray_Memcheck(vec, CEED_MEM_HOST)); 1339798701eSJeremy L Thompson 1349937a20eSJeremy L Thompson // Return borrowed array 1359798701eSJeremy L Thompson (*array) = impl->array_borrowed; 1369798701eSJeremy L Thompson impl->array_borrowed = NULL; 1379937a20eSJeremy L Thompson VALGRIND_DISCARD(impl->borrowed_block_id); 1389937a20eSJeremy L Thompson 1399937a20eSJeremy L Thompson // De-allocate internal memory 140d1931fc8SJeremy L Thompson if (impl->array_allocated) { 141d1931fc8SJeremy L Thompson for (CeedSize i = 0; i < length; i++) impl->array_allocated[i] = NAN; 142*0307dd02SJeremy L Thompson VALGRIND_DISCARD(impl->allocated_block_id); 143d1931fc8SJeremy L Thompson } 1449798701eSJeremy L Thompson CeedCallBackend(CeedFree(&impl->array_allocated)); 1459798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 1469798701eSJeremy L Thompson } 1479798701eSJeremy L Thompson 1489798701eSJeremy L Thompson //------------------------------------------------------------------------------ 1499798701eSJeremy L Thompson // Vector Get Array 1509798701eSJeremy L Thompson //------------------------------------------------------------------------------ 1519798701eSJeremy L Thompson static int CeedVectorGetArray_Memcheck(CeedVector vec, CeedMemType mem_type, CeedScalar **array) { 1521a3e18b3SJeremy L Thompson CeedSize length; 153ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 154ad70ee2cSJeremy L Thompson 1559937a20eSJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, CeedVectorReturnCeed(vec), CEED_ERROR_BACKEND, "Can only provide HOST memory for this backend"); 1569937a20eSJeremy L Thompson 157ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 1581a3e18b3SJeremy L Thompson CeedCallBackend(CeedVectorGetLength(vec, &length)); 1599798701eSJeremy L Thompson 1609937a20eSJeremy L Thompson // Create and return writable buffer 1611a3e18b3SJeremy L Thompson CeedCallBackend(CeedCalloc(length, &impl->array_writable_copy)); 1629937a20eSJeremy L Thompson impl->writable_block_id = VALGRIND_CREATE_BLOCK(impl->array_writable_copy, length * sizeof(CeedScalar), "Allocated writeable array buffer copy"); 1639937a20eSJeremy L Thompson memcpy(impl->array_writable_copy, impl->array_allocated, length * sizeof(CeedScalar)); 1641a3e18b3SJeremy L Thompson *array = impl->array_writable_copy; 1659798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 1669798701eSJeremy L Thompson } 1679798701eSJeremy L Thompson 1689798701eSJeremy L Thompson //------------------------------------------------------------------------------ 1699798701eSJeremy L Thompson // Vector Get Array Read 1709798701eSJeremy L Thompson //------------------------------------------------------------------------------ 1719798701eSJeremy L Thompson static int CeedVectorGetArrayRead_Memcheck(CeedVector vec, CeedMemType mem_type, const CeedScalar **array) { 172ad70ee2cSJeremy L Thompson CeedSize length; 173ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 174ad70ee2cSJeremy L Thompson 1759937a20eSJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, CeedVectorReturnCeed(vec), CEED_ERROR_BACKEND, "Can only provide HOST memory for this backend"); 1769937a20eSJeremy L Thompson 177ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 178ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetLength(vec, &length)); 1799798701eSJeremy L Thompson 1809937a20eSJeremy L Thompson // Create and return read-only buffer 1815b5dc0c8SJeremy L Thompson if (!impl->array_read_only_copy) { 1829798701eSJeremy L Thompson CeedCallBackend(CeedCalloc(length, &impl->array_read_only_copy)); 1839937a20eSJeremy L Thompson impl->writable_block_id = VALGRIND_CREATE_BLOCK(impl->array_read_only_copy, length * sizeof(CeedScalar), "Allocated read-only array buffer copy"); 1849937a20eSJeremy L Thompson memcpy(impl->array_read_only_copy, impl->array_allocated, length * sizeof(CeedScalar)); 1855b5dc0c8SJeremy L Thompson } 186d1931fc8SJeremy L Thompson *array = impl->array_read_only_copy; 1879798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 1889798701eSJeremy L Thompson } 1899798701eSJeremy L Thompson 1909798701eSJeremy L Thompson //------------------------------------------------------------------------------ 1919798701eSJeremy L Thompson // Vector Get Array Write 1929798701eSJeremy L Thompson //------------------------------------------------------------------------------ 1939798701eSJeremy L Thompson static int CeedVectorGetArrayWrite_Memcheck(CeedVector vec, CeedMemType mem_type, CeedScalar **array) { 194ad70ee2cSJeremy L Thompson CeedSize length; 195ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 196ad70ee2cSJeremy L Thompson 1979937a20eSJeremy L Thompson CeedCheck(mem_type == CEED_MEM_HOST, CeedVectorReturnCeed(vec), CEED_ERROR_BACKEND, "Can only provide HOST memory for this backend"); 1989937a20eSJeremy L Thompson 199ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 200ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetLength(vec, &length)); 2019798701eSJeremy L Thompson 2029937a20eSJeremy L Thompson // Allocate buffer if necessary 2039937a20eSJeremy L Thompson if (!impl->array_allocated) CeedCallBackend(CeedVectorSetArray_Memcheck(vec, mem_type, CEED_COPY_VALUES, NULL)); 2049937a20eSJeremy L Thompson 2059937a20eSJeremy L Thompson // Get writable buffer 2069798701eSJeremy L Thompson CeedCallBackend(CeedVectorGetArray_Memcheck(vec, mem_type, array)); 2079937a20eSJeremy L Thompson 2089937a20eSJeremy L Thompson // Invalidate array data to prevent accidental reads 209dd39767dSJeremy L Thompson for (CeedSize i = 0; i < length; i++) (*array)[i] = NAN; 210df852985SJeremy L Thompson impl->is_write_only_access = true; 2119798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 2129798701eSJeremy L Thompson } 2139798701eSJeremy L Thompson 2149798701eSJeremy L Thompson //------------------------------------------------------------------------------ 2159798701eSJeremy L Thompson // Vector Restore Array 2169798701eSJeremy L Thompson //------------------------------------------------------------------------------ 2179798701eSJeremy L Thompson static int CeedVectorRestoreArray_Memcheck(CeedVector vec) { 2189798701eSJeremy L Thompson Ceed ceed; 219ad70ee2cSJeremy L Thompson CeedSize length; 220ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 221ad70ee2cSJeremy L Thompson 2229937a20eSJeremy L Thompson CeedCallBackend(CeedVectorGetCeed(vec, &ceed)); 223ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 224ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetLength(vec, &length)); 2259798701eSJeremy L Thompson 2269937a20eSJeremy L Thompson // Check for unset entries after write-only access 227df852985SJeremy L Thompson if (impl->is_write_only_access) { 228dd39767dSJeremy L Thompson for (CeedSize i = 0; i < length; i++) { 2299937a20eSJeremy L Thompson if (isnan(impl->array_writable_copy[i])) 230249f8407SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_WARNING, "WARNING: Vec entry %" CeedSize_FMT " is NaN after restoring write-only access", i); 231df852985SJeremy L Thompson } 232df852985SJeremy L Thompson impl->is_write_only_access = false; 233df852985SJeremy L Thompson } 2349937a20eSJeremy L Thompson 2359937a20eSJeremy L Thompson // Copy back to internal buffer and sync 2369937a20eSJeremy L Thompson memcpy(impl->array_allocated, impl->array_writable_copy, length * sizeof(CeedScalar)); 2379937a20eSJeremy L Thompson CeedCallBackend(CeedVectorSyncArray_Memcheck(vec, CEED_MEM_HOST)); 2389937a20eSJeremy L Thompson 2399937a20eSJeremy L Thompson // Invalidate writable buffer 2409937a20eSJeremy L Thompson for (CeedSize i = 0; i < length; i++) impl->array_writable_copy[i] = NAN; 2419937a20eSJeremy L Thompson CeedCallBackend(CeedFree(&impl->array_writable_copy)); 2429937a20eSJeremy L Thompson VALGRIND_DISCARD(impl->writable_block_id); 2439798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 2449798701eSJeremy L Thompson } 2459798701eSJeremy L Thompson 2469798701eSJeremy L Thompson //------------------------------------------------------------------------------ 2479798701eSJeremy L Thompson // Vector Restore Array Read-Only 2489798701eSJeremy L Thompson //------------------------------------------------------------------------------ 2499798701eSJeremy L Thompson static int CeedVectorRestoreArrayRead_Memcheck(CeedVector vec) { 2509937a20eSJeremy L Thompson Ceed ceed; 251ad70ee2cSJeremy L Thompson CeedSize length; 252ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 253ad70ee2cSJeremy L Thompson 2549937a20eSJeremy L Thompson CeedCallBackend(CeedVectorGetCeed(vec, &ceed)); 255ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 256ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetLength(vec, &length)); 2579798701eSJeremy L Thompson 2589937a20eSJeremy L Thompson // Verify no changes made during read-only access 2599937a20eSJeremy L Thompson bool is_changed = memcmp(impl->array_allocated, impl->array_read_only_copy, length * sizeof(CeedScalar)); 2609798701eSJeremy L Thompson 2619937a20eSJeremy L Thompson CeedCheck(!is_changed, ceed, CEED_ERROR_BACKEND, "Array data changed while accessed in read-only mode"); 2629937a20eSJeremy L Thompson 2639937a20eSJeremy L Thompson // Invalidate read-only buffer 264d1931fc8SJeremy L Thompson for (CeedSize i = 0; i < length; i++) impl->array_read_only_copy[i] = NAN; 2659798701eSJeremy L Thompson CeedCallBackend(CeedFree(&impl->array_read_only_copy)); 2669937a20eSJeremy L Thompson VALGRIND_DISCARD(impl->read_only_block_id); 2679798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 2689798701eSJeremy L Thompson } 2699798701eSJeremy L Thompson 2709798701eSJeremy L Thompson //------------------------------------------------------------------------------ 2719798701eSJeremy L Thompson // Vector Destroy 2729798701eSJeremy L Thompson //------------------------------------------------------------------------------ 2739798701eSJeremy L Thompson static int CeedVectorDestroy_Memcheck(CeedVector vec) { 2749798701eSJeremy L Thompson CeedVector_Memcheck *impl; 2759798701eSJeremy L Thompson 2769937a20eSJeremy L Thompson // Free allocations and discard block ids 277ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetData(vec, &impl)); 2789937a20eSJeremy L Thompson if (impl->array_allocated) { 2799798701eSJeremy L Thompson CeedCallBackend(CeedFree(&impl->array_allocated)); 2809937a20eSJeremy L Thompson VALGRIND_DISCARD(impl->allocated_block_id); 2819937a20eSJeremy L Thompson } 2829937a20eSJeremy L Thompson if (impl->array_owned) { 2839798701eSJeremy L Thompson CeedCallBackend(CeedFree(&impl->array_owned)); 2849937a20eSJeremy L Thompson VALGRIND_DISCARD(impl->owned_block_id); 2859937a20eSJeremy L Thompson } 2869937a20eSJeremy L Thompson if (impl->array_borrowed) { 2879937a20eSJeremy L Thompson VALGRIND_DISCARD(impl->borrowed_block_id); 2889937a20eSJeremy L Thompson } 2899798701eSJeremy L Thompson CeedCallBackend(CeedFree(&impl)); 2909798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 2919798701eSJeremy L Thompson } 2929798701eSJeremy L Thompson 2939798701eSJeremy L Thompson //------------------------------------------------------------------------------ 2949798701eSJeremy L Thompson // Vector Create 2959798701eSJeremy L Thompson //------------------------------------------------------------------------------ 2969798701eSJeremy L Thompson int CeedVectorCreate_Memcheck(CeedSize n, CeedVector vec) { 2979798701eSJeremy L Thompson Ceed ceed; 298ad70ee2cSJeremy L Thompson CeedVector_Memcheck *impl; 2999798701eSJeremy L Thompson 3009e82028bSJeremy L Thompson CeedCallBackend(CeedCalloc(1, &impl)); 3019e82028bSJeremy L Thompson CeedCallBackend(CeedVectorSetData(vec, impl)); 3029e82028bSJeremy L Thompson 303ad70ee2cSJeremy L Thompson CeedCallBackend(CeedVectorGetCeed(vec, &ceed)); 3049798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "HasValidArray", CeedVectorHasValidArray_Memcheck)); 3059798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "HasBorrowedArrayOfType", CeedVectorHasBorrowedArrayOfType_Memcheck)); 3069798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "SetArray", CeedVectorSetArray_Memcheck)); 3079937a20eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "SyncArray", CeedVectorSyncArray_Memcheck)); 3089798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "TakeArray", CeedVectorTakeArray_Memcheck)); 3099798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "GetArray", CeedVectorGetArray_Memcheck)); 3109798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "GetArrayRead", CeedVectorGetArrayRead_Memcheck)); 3119798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "GetArrayWrite", CeedVectorGetArrayWrite_Memcheck)); 3129798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "RestoreArray", CeedVectorRestoreArray_Memcheck)); 3139798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "RestoreArrayRead", CeedVectorRestoreArrayRead_Memcheck)); 3149798701eSJeremy L Thompson CeedCallBackend(CeedSetBackendFunction(ceed, "Vector", vec, "Destroy", CeedVectorDestroy_Memcheck)); 3159798701eSJeremy L Thompson return CEED_ERROR_SUCCESS; 3169798701eSJeremy L Thompson } 3172a86cc9dSSebastian Grimberg 3189798701eSJeremy L Thompson //------------------------------------------------------------------------------ 319