Celeritas  0.5.0-86+4a8eea4
Macros | Functions
Device.cc File Reference
#include "Device.hh"
#include <iostream>
#include <limits>
#include <mutex>
#include <utility>
#include "corecel/Config.hh"
#include "corecel/Macros.hh"
#include "corecel/DeviceRuntimeApi.hh"
#include "corecel/Assert.hh"
#include "corecel/io/Logger.hh"
#include "corecel/io/ScopedTimeLog.hh"
#include "Environment.hh"
#include "MpiCommunicator.hh"
#include "Stream.hh"
#include "detail/StreamStorage.hh"

Macros

#define CELER_DEVICE_SUPPORTS_MEMPOOL   0
 

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).