Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
accelerator.hpp File Reference

This file contains the interface used for initializing/terminating any hardware accelerator-related functionality. More...

#include <memory>
#include <cstring>
#include <tuple>
#include "axom/core.hpp"
#include "smith/infrastructure/logger.hpp"
#include "smith/infrastructure/memory.hpp"
#include "smith/infrastructure/profiling.hpp"
#include "smith/smith_config.hpp"
Include dependency graph for accelerator.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  smith::detail::execution_to_memory< space >
 Trait for "translating" between smith::ExecutionSpace and axom::MemorySpace. More...
 

Namespaces

 smith
 Accelerator functionality.
 
 smith::accelerator
 Namespace for methods involving accelerator-enabled builds.
 

Macros

#define SMITH_HOST_DEVICE
 Macro that evaluates to __host__ __device__ when compiling with nvcc and does nothing on a host compiler.
 
#define SMITH_HOST
 Macro that evaluates to __host__ when compiling with nvcc and does nothing on a host compiler.
 
#define SMITH_DEVICE
 Macro that evaluates to __device__ when compiling with nvcc and does nothing on a host compiler.
 
#define SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING
 Macro to turn off specific nvcc warnings.
 

Typedefs

template<typename T , int dim, ExecutionSpace space>
using smith::ExecArray = axom::Array< T, dim, detail::execution_to_memory_v< space > >
 Alias for an Array corresponding to a particular ExecutionSpace.
 
template<typename T , int dim = 1>
using smith::CPUArray = ExecArray< T, dim, ExecutionSpace::CPU >
 Alias for an array on the CPU.
 
template<typename T , int dim = 1>
using smith::GPUArray = ExecArray< T, dim, ExecutionSpace::CPU >
 Alias for an array on the GPU.
 
template<typename T , int dim = 1>
using smith::UnifiedArray = ExecArray< T, dim, ExecutionSpace::CPU >
 Alias for an array in unified memory.
 
template<typename T , int dim, ExecutionSpace space>
using smith::ExecArrayView = axom::ArrayView< T, dim, detail::execution_to_memory_v< space > >
 Alias for an ArrayView corresponding to a particular ExecutionSpace.
 
template<typename T , int dim = 1>
using smith::CPUArrayView = ExecArrayView< T, dim, ExecutionSpace::CPU >
 Alias for an array view on the CPU.
 

Enumerations

enum class  smith::ExecutionSpace { CPU , GPU , Dynamic }
 enum used for signalling whether or not to perform certain calculations on the CPU or GPU
 

Functions

template<typename T , int dim, axom::MemorySpace space>
void smith::detail::zero_out (axom::Array< T, dim, space > &arr)
 set the contents of an array to zero, byte-wise
 
template<typename T , int dim>
void smith::detail::zero_out (axom::ArrayView< T, dim, detail::host_memory_space > &arr)
 set the contents of an array to zero, byte-wise
 
template<typename T , int dim, axom::MemorySpace space>
auto smith::view (axom::Array< T, dim, space > &arr)
 convenience function for creating a view of an axom::Array type
 
void smith::accelerator::initializeDevice ()
 Initializes the device (GPU) More...
 
void smith::accelerator::terminateDevice ()
 Cleans up the device, if applicable.
 
template<ExecutionSpace exec, typename T >
std::shared_ptr< T[]> smith::accelerator::make_shared_array (std::size_t n)
 create shared_ptr to an array of n values of type T, either on the host or device More...
 
template<ExecutionSpace exec, typename... T>
auto smith::accelerator::make_shared_arrays (std::size_t n)
 create shared_ptr to an array of n values of type T, either on the host or device More...
 

Variables

constexpr ExecutionSpace smith::default_execution_space = ExecutionSpace::CPU
 The default execution space for Smith builds.
 
template<ExecutionSpace space>
constexpr axom::MemorySpace smith::detail::execution_to_memory_v = execution_to_memory<space>::value
 Helper template for execution_to_memory trait.
 

Detailed Description

This file contains the interface used for initializing/terminating any hardware accelerator-related functionality.

Definition in file accelerator.hpp.