Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
accelerator.cpp
1 // Copyright (c) Lawrence Livermore National Security, LLC and
2 // other Smith Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
8 
9 #include "mfem.hpp"
10 
11 #include <memory>
12 
14 
15 namespace smith {
16 
17 namespace accelerator {
18 
19 // Restrict global to this file only
20 namespace {
21 std::unique_ptr<mfem::Device> device;
22 } // namespace
23 
25 {
26  SLIC_ERROR_ROOT_IF(device, "smith::accelerator::initializeDevice cannot be called more than once");
27  device = std::make_unique<mfem::Device>();
28 #if defined(MFEM_USE_CUDA) && defined(SMITH_USE_CUDA_KERNEL_EVALUATION)
29  device->Configure("cuda");
30 #endif
31 }
32 
34 {
35  // Idempotent, no adverse affects if called multiple times
36  device.reset();
37 }
38 
39 } // namespace accelerator
40 
41 } // namespace smith
This file contains the interface used for initializing/terminating any hardware accelerator-related f...
This file contains the all the necessary functions and macros required for logging as well as a helpe...
void initializeDevice()
Initializes the device (GPU)
Definition: accelerator.cpp:24
void terminateDevice()
Cleans up the device, if applicable.
Definition: accelerator.cpp:33
Accelerator functionality.
Definition: smith.cpp:36