| ceed-memcheck-qfunction.c (ce18bed930e8f3bfebcf709a18844aba97fe4630) | ceed-memcheck-qfunction.c (edc819a10d47c4f248d00a144b44345fa45bfe5b) |
|---|---|
| 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include <ceed/ceed.h> 9#include <ceed/backend.h> | 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include <ceed/ceed.h> 9#include <ceed/backend.h> |
| 10#include <string.h> |
|
| 10#include <valgrind/memcheck.h> 11#include "ceed-memcheck.h" 12 13//------------------------------------------------------------------------------ 14// QFunction Apply 15//------------------------------------------------------------------------------ 16static int CeedQFunctionApply_Memcheck(CeedQFunction qf, CeedInt Q, 17 CeedVector *U, CeedVector *V) { --- 10 unchanged lines hidden (view full) --- 28 } 29 30 CeedQFunctionUser f = NULL; 31 ierr = CeedQFunctionGetUserFunction(qf, &f); CeedChkBackend(ierr); 32 33 CeedInt num_in, num_out; 34 ierr = CeedQFunctionGetNumArgs(qf, &num_in, &num_out); CeedChkBackend(ierr); 35 | 11#include <valgrind/memcheck.h> 12#include "ceed-memcheck.h" 13 14//------------------------------------------------------------------------------ 15// QFunction Apply 16//------------------------------------------------------------------------------ 17static int CeedQFunctionApply_Memcheck(CeedQFunction qf, CeedInt Q, 18 CeedVector *U, CeedVector *V) { --- 10 unchanged lines hidden (view full) --- 29 } 30 31 CeedQFunctionUser f = NULL; 32 ierr = CeedQFunctionGetUserFunction(qf, &f); CeedChkBackend(ierr); 33 34 CeedInt num_in, num_out; 35 ierr = CeedQFunctionGetNumArgs(qf, &num_in, &num_out); CeedChkBackend(ierr); 36 |
| 36 for (int i = 0; i<num_in; i++) { | 37 for (CeedInt i = 0; i<num_in; i++) { |
| 37 ierr = CeedVectorGetArrayRead(U[i], CEED_MEM_HOST, &impl->inputs[i]); 38 CeedChkBackend(ierr); 39 } | 38 ierr = CeedVectorGetArrayRead(U[i], CEED_MEM_HOST, &impl->inputs[i]); 39 CeedChkBackend(ierr); 40 } |
| 40 for (int i = 0; i<num_out; i++) { | 41 int mem_block_ids[num_out]; 42 for (CeedInt i = 0; i<num_out; i++) { 43 CeedSize len; 44 char name[30] = ""; 45 |
| 41 ierr = CeedVectorGetArrayWrite(V[i], CEED_MEM_HOST, &impl->outputs[i]); 42 CeedChkBackend(ierr); | 46 ierr = CeedVectorGetArrayWrite(V[i], CEED_MEM_HOST, &impl->outputs[i]); 47 CeedChkBackend(ierr); |
| 43 CeedSize len; | 48 |
| 44 ierr = CeedVectorGetLength(V[i], &len); CeedChkBackend(ierr); 45 VALGRIND_MAKE_MEM_UNDEFINED(impl->outputs[i], len); | 49 ierr = CeedVectorGetLength(V[i], &len); CeedChkBackend(ierr); 50 VALGRIND_MAKE_MEM_UNDEFINED(impl->outputs[i], len); |
| 51 52 snprintf(name, 30, "'QFunction output %d'", i); 53 mem_block_ids[i] = VALGRIND_CREATE_BLOCK(impl->outputs[i], len, name); |
|
| 46 } 47 48 ierr = f(ctxData, Q, impl->inputs, impl->outputs); CeedChkBackend(ierr); 49 | 54 } 55 56 ierr = f(ctxData, Q, impl->inputs, impl->outputs); CeedChkBackend(ierr); 57 |
| 50 for (int i = 0; i<num_in; i++) { | 58 for (CeedInt i = 0; i<num_in; i++) { |
| 51 ierr = CeedVectorRestoreArrayRead(U[i], &impl->inputs[i]); CeedChkBackend(ierr); 52 } | 59 ierr = CeedVectorRestoreArrayRead(U[i], &impl->inputs[i]); CeedChkBackend(ierr); 60 } |
| 53 for (int i = 0; i<num_out; i++) { | 61 for (CeedInt i = 0; i<num_out; i++) { |
| 54 ierr = CeedVectorRestoreArray(V[i], &impl->outputs[i]); CeedChkBackend(ierr); | 62 ierr = CeedVectorRestoreArray(V[i], &impl->outputs[i]); CeedChkBackend(ierr); |
| 63 VALGRIND_DISCARD(mem_block_ids[i]); |
|
| 55 } 56 if (ctx) { 57 ierr = CeedQFunctionContextRestoreData(ctx, &ctxData); CeedChkBackend(ierr); 58 } 59 60 return CEED_ERROR_SUCCESS; 61} 62 --- 37 unchanged lines hidden --- | 64 } 65 if (ctx) { 66 ierr = CeedQFunctionContextRestoreData(ctx, &ctxData); CeedChkBackend(ierr); 67 } 68 69 return CEED_ERROR_SUCCESS; 70} 71 --- 37 unchanged lines hidden --- |