GCC Code Coverage Report


Directory: ./
File: src/sys/magma/slepcmagma.c
Date: 2026-09-08 03:59:54
Exec Total Coverage
Lines: 19 19 100.0%
Functions: 4 4 100.0%
Branches: 7 16 43.8%

Line Branch Exec Source
1 /*
2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3 SLEPc - Scalable Library for Eigenvalue Problem Computations
4 Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain
5
6 This file is part of SLEPc.
7 SLEPc is distributed under a 2-clause BSD license (see LICENSE).
8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9 */
10
11 #include <slepc/private/slepcimpl.h>
12 #include <slepcmagma.h>
13
14 static PetscBool SlepcBeganMagma = PETSC_FALSE;
15
16 40 static void slepc_magma_finalize(void PETSC_UNUSED *unused, magma_int_t *ierr)
17 {
18 40 (void)unused;
19 40 *ierr = magma_finalize();
20 40 return;
21 }
22
23 40 static PetscErrorCode SlepcMagmaFinalize(void)
24 {
25 40 PetscFunctionBegin;
26 40 SlepcBeganMagma = PETSC_FALSE;
27
2/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
40 PetscCallMAGMA(slepc_magma_finalize, NULL);
28 40 PetscFunctionReturn(PETSC_SUCCESS);
29 }
30
31 40 static void slepc_magma_init(void PETSC_UNUSED *unused, magma_int_t *ierr)
32 {
33 40 (void)unused;
34 40 *ierr = magma_init();
35 40 return;
36 }
37
38 /*@
39 SlepcMagmaInit - A helper function to cleanly initialize MAGMA from within SLEPc
40 when needed.
41
42 Logically Collective
43
44 Level: developer
45
46 .seealso: `SlepcInitialize()`
47 @*/
48 216 PetscErrorCode SlepcMagmaInit(void)
49 {
50 216 PetscFunctionBegin;
51
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
216 if (!SlepcBeganMagma) {
52
2/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
40 PetscCallMAGMA(slepc_magma_init, NULL);
53 40 SlepcBeganMagma = PETSC_TRUE;
54
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
40 PetscCall(PetscRegisterFinalize(SlepcMagmaFinalize));
55 }
56 PetscFunctionReturn(PETSC_SUCCESS);
57 }
58