1*7f5b9731SStan Tomov // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC. 2*7f5b9731SStan Tomov // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707. 3*7f5b9731SStan Tomov // All Rights reserved. See files LICENSE and NOTICE for details. 482b77998SStan Tomov // 582b77998SStan Tomov // This file is part of CEED, a collection of benchmarks, miniapps, software 682b77998SStan Tomov // libraries and APIs for efficient high-order finite element and spectral 782b77998SStan Tomov // element discretizations for exascale applications. For more information and 882b77998SStan Tomov // source code availability see http://github.com/ceed. 982b77998SStan Tomov // 1082b77998SStan Tomov // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 1182b77998SStan Tomov // a collaborative effort of two U.S. Department of Energy organizations (Office 1282b77998SStan Tomov // of Science and the National Nuclear Security Administration) responsible for 1382b77998SStan Tomov // the planning and preparation of a capable exascale ecosystem, including 1482b77998SStan Tomov // software, applications, hardware, advanced system engineering and early 1582b77998SStan Tomov // testbed platforms, in support of the nation's exascale computing imperative. 1682b77998SStan Tomov 1738612b08SStan Tomov #include "ceed-magma.h" 1852d6035fSJeremy L Thompson 1982b77998SStan Tomov static int CeedInit_Magma(const char *resource, Ceed ceed) { 201dc2661bSVeselin Dobrev int ierr; 212a847359SStan Tomov if (strcmp(resource, "/gpu/magma")) 22*7f5b9731SStan Tomov // LCOV_EXCL_START 23*7f5b9731SStan Tomov return CeedError(ceed, 1, "Magma backend cannot use resource: %s", resource); 24*7f5b9731SStan Tomov // LCOV_EXCL_STOP 25*7f5b9731SStan Tomov 26*7f5b9731SStan Tomov 27*7f5b9731SStan Tomov // Create refrence CEED that implementation will be dispatched 28*7f5b9731SStan Tomov // through unless overridden 29*7f5b9731SStan Tomov Ceed ceedref; 30*7f5b9731SStan Tomov CeedInit("/gpu/cuda/ref", &ceedref); 31*7f5b9731SStan Tomov ierr = CeedSetDelegate(ceed, ceedref); CeedChk(ierr); 3293fbe329SStan Tomov 331dc2661bSVeselin Dobrev ierr = magma_init(); 34*7f5b9731SStan Tomov if (ierr) 35*7f5b9731SStan Tomov // LCOV_EXCL_START 36*7f5b9731SStan Tomov return CeedError(ceed, 1, "error in magma_init(): %d\n", ierr); 37*7f5b9731SStan Tomov // LCOV_EXCL_STOP 3893fbe329SStan Tomov 39*7f5b9731SStan Tomov ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateTensorH1", 40*7f5b9731SStan Tomov CeedBasisCreateTensorH1_Magma); CeedChk(ierr); 41*7f5b9731SStan Tomov ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateH1", 42*7f5b9731SStan Tomov CeedBasisCreateH1_Magma); CeedChk(ierr); 4382b77998SStan Tomov return 0; 4482b77998SStan Tomov } 4582b77998SStan Tomov 4682b77998SStan Tomov __attribute__((constructor)) 4782b77998SStan Tomov static void Register(void) { 4844951fc6Sjeremylt CeedRegister("/gpu/magma", CeedInit_Magma,20); 4982b77998SStan Tomov } 50*7f5b9731SStan Tomov 51