Celeritas  0.5.0-56+6b053cd
Classes | Functions
Device.hh File Reference
#include <cstddef>
#include <iosfwd>
#include <map>
#include <memory>
#include <string>
#include "corecel/Assert.hh"
#include "ThreadId.hh"
This graph shows which files directly or indirectly include this file:

Classes

class  celeritas::Device
 Manage attributes of the GPU. More...
 

Functions

Device const & celeritas::device ()
 Get the shared default device.
 
void celeritas::activate_device (Device &&device)
 Activate the global celeritas device. More...
 
void celeritas::activate_device ()
 Initialize the first device if available, when not using MPI.
 
void celeritas::activate_device (MpiCommunicator const &comm)
 Initialize device in a round-robin fashion from a communicator.
 
void celeritas::activate_device_local ()
 Call cudaSetDevice using the existing device, for thread-local safety. More...
 
std::ostream & celeritas::operator<< (std::ostream &os, Device const &d)
 Print device info.
 
void celeritas::set_cuda_stack_size (int limit)
 Increase CUDA stack size to enable complex geometries with VecGeom. More...
 
void celeritas::set_cuda_heap_size (int limit)
 Increase CUDA heap size to enable complex geometries with VecGeom. More...
 

Function Documentation

◆ activate_device()

void celeritas::activate_device ( Device &&  device)

Activate the global celeritas device.

The given device must be set (true result) unless no device has yet been enabled – this allows make_device to create "null" devices when CUDA is disabled.

This function may be called once only, because the global device propagates into local states (e.g. where memory is allocated) all over Celeritas.

◆ activate_device_local()

void celeritas::activate_device_local ( )

Call cudaSetDevice using the existing device, for thread-local safety.

See https://developer.nvidia.com/blog/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs

Precondition
activate_device was called or no device is intended to be used

◆ set_cuda_heap_size()

void celeritas::set_cuda_heap_size ( int  limit)

Increase CUDA heap size to enable complex geometries with VecGeom.

For the cms-hllhc.gdml detector geometry, the 8MB default heap size is too small, and a new size as high as 33554432 (=32MB) has run successfully. This should be increased as necessary, but avoid setting it too high.

◆ set_cuda_stack_size()

void celeritas::set_cuda_stack_size ( int  limit)

Increase CUDA stack size to enable complex geometries with VecGeom.

For the cms2018.gdml detector geometry, the default stack size is too small, and a limit of 8K is recommended with debugging disabled (and up to 32K if debugging is enabled).