xref: /libCEED/rust/libceed-sys/c-src/backends/magma/ceed-magma-det.c (revision cb23e90c4a80031b60f4dc0a9f17397895bd0f2f)
1*cb23e90cSJeremy L Thompson // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
2*cb23e90cSJeremy L Thompson // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
3*cb23e90cSJeremy L Thompson // All Rights reserved. See files LICENSE and NOTICE for details.
4*cb23e90cSJeremy L Thompson //
5*cb23e90cSJeremy L Thompson // This file is part of CEED, a collection of benchmarks, miniapps, software
6*cb23e90cSJeremy L Thompson // libraries and APIs for efficient high-order finite element and spectral
7*cb23e90cSJeremy L Thompson // element discretizations for exascale applications. For more information and
8*cb23e90cSJeremy L Thompson // source code availability see http://github.com/ceed.
9*cb23e90cSJeremy L Thompson //
10*cb23e90cSJeremy L Thompson // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11*cb23e90cSJeremy L Thompson // a collaborative effort of two U.S. Department of Energy organizations (Office
12*cb23e90cSJeremy L Thompson // of Science and the National Nuclear Security Administration) responsible for
13*cb23e90cSJeremy L Thompson // the planning and preparation of a capable exascale ecosystem, including
14*cb23e90cSJeremy L Thompson // software, applications, hardware, advanced system engineering and early
15*cb23e90cSJeremy L Thompson // testbed platforms, in support of the nation's exascale computing imperative.
16*cb23e90cSJeremy L Thompson 
17*cb23e90cSJeremy L Thompson #include "ceed-magma.h"
18*cb23e90cSJeremy L Thompson 
19*cb23e90cSJeremy L Thompson static int CeedInit_Magma_Det(const char *resource, Ceed ceed) {
20*cb23e90cSJeremy L Thompson   int ierr;
21*cb23e90cSJeremy L Thompson   if (strcmp(resource, "/gpu/magma/det"))
22*cb23e90cSJeremy L Thompson     // LCOV_EXCL_START
23*cb23e90cSJeremy L Thompson     return CeedError(ceed, 1, "Magma backend cannot use resource: %s", resource);
24*cb23e90cSJeremy L Thompson   // LCOV_EXCL_STOP
25*cb23e90cSJeremy L Thompson   ierr = CeedSetDeterministic(ceed, true); CeedChk(ierr);
26*cb23e90cSJeremy L Thompson 
27*cb23e90cSJeremy L Thompson   // Create reference CEED that implementation will be dispatched
28*cb23e90cSJeremy L Thompson   //   through unless overridden
29*cb23e90cSJeremy L Thompson   Ceed ceedref;
30*cb23e90cSJeremy L Thompson   CeedInit("/gpu/magma", &ceedref);
31*cb23e90cSJeremy L Thompson   ierr = CeedSetDelegate(ceed, ceedref); CeedChk(ierr);
32*cb23e90cSJeremy L Thompson 
33*cb23e90cSJeremy L Thompson   // Create reference CEED for restriction
34*cb23e90cSJeremy L Thompson   Ceed restrictionceedref;
35*cb23e90cSJeremy L Thompson   CeedInit("/gpu/cuda/reg", &restrictionceedref);
36*cb23e90cSJeremy L Thompson   ierr = CeedSetObjectDelegate(ceed, restrictionceedref, "ElemRestriction");
37*cb23e90cSJeremy L Thompson   CeedChk(ierr);
38*cb23e90cSJeremy L Thompson 
39*cb23e90cSJeremy L Thompson   return 0;
40*cb23e90cSJeremy L Thompson }
41*cb23e90cSJeremy L Thompson 
42*cb23e90cSJeremy L Thompson __attribute__((constructor))
43*cb23e90cSJeremy L Thompson static void Register(void) {
44*cb23e90cSJeremy L Thompson   CeedRegister("/gpu/magma/det", CeedInit_Magma_Det,25);
45*cb23e90cSJeremy L Thompson }
46