Date: 2024-10-28T09:14:59+00:00

Actual source code: slepcmagma.c
slepc-3.22.1 2024-10-28
Report Typos and Errors

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain

      6:    This file is part of SLEPc.
      7:    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
      8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      9: */

     11: #include <slepc/private/slepcimpl.h>
     12: #include <slepcmagma.h>

     14: static PetscBool SlepcBeganMagma = PETSC_FALSE;

     16: static void slepc_magma_finalize(void PETSC_UNUSED *unused, magma_int_t *ierr)
     17: {
     18:   (void)unused;
     19:   *ierr = magma_finalize();
     20:   return;
     21: }

     23: static PetscErrorCode SlepcMagmaFinalize(void)
     24: {
     25:   PetscFunctionBegin;
     26:   SlepcBeganMagma = PETSC_FALSE;
     27:   PetscCallMAGMA(slepc_magma_finalize, NULL);
     28:   PetscFunctionReturn(PETSC_SUCCESS);
     29: }

     31: static void slepc_magma_init(void PETSC_UNUSED *unused, magma_int_t *ierr)
     32: {
     33:   (void)unused;
     34:   *ierr = magma_init();
     35:   return;
     36: }

     38: PetscErrorCode SlepcMagmaInit(void)
     39: {
     40:   PetscFunctionBegin;
     41:   if (!SlepcBeganMagma) {
     42:     PetscCallMAGMA(slepc_magma_init, NULL);
     43:     SlepcBeganMagma = PETSC_TRUE;
     44:     PetscCall(PetscRegisterFinalize(SlepcMagmaFinalize));
     45:   }
     46:   PetscFunctionReturn(PETSC_SUCCESS);
     47: }