Runtime environment#

These APIs manage execution contexts and work distribution for XC integration. The GauXC::RuntimeEnvironment encapsulates MPI communication and provides process-local information, while GauXC::DeviceRuntimeEnvironment extends it with GPU memory management for device-accelerated computations.

class RuntimeEnvironment#

Runtime environment for GauXC computations.

Encapsulates communication context (MPI) and provides process-local information such as rank and size. Serves as the base class for device-specific runtime environments.

Subclassed by GauXC::DeviceRuntimeEnvironment

Public Functions

explicit RuntimeEnvironment (GAUXC_MPI_CODE(MPI_Comm comm))#

Construct a runtime environment.

Parameters:

comm – MPI communicator (if MPI is enabled).

virtual ~RuntimeEnvironment() noexcept#

Destructor.

RuntimeEnvironment(const RuntimeEnvironment&)#

Copy constructor.

RuntimeEnvironment(RuntimeEnvironment&&) noexcept#

Move constructor.

int comm_rank() const#

Get the MPI communicator (if MPI is enabled).

Get the rank of this process in the communicator.

int comm_size() const#

Get the total number of processes in the communicator.

int shared_usage_count() const#

Get the shared usage count of the implementation.

class DeviceRuntimeEnvironment : public GauXC::RuntimeEnvironment#

Device-enabled runtime environment for GPU computations.

Extends RuntimeEnvironment with device memory management and backend access for GPU-accelerated XC integration.

Public Functions

DeviceRuntimeEnvironment (GAUXC_MPI_CODE(MPI_Comm comm,) void *mem, size_t mem_sz)

Construct with explicit device memory buffer.

Parameters:
  • comm – MPI communicator (if MPI is enabled).

  • mem – Pointer to device memory buffer.

  • mem_sz – Size of device memory buffer in bytes.

DeviceRuntimeEnvironment (GAUXC_MPI_CODE(MPI_Comm,) double fill_fraction)

Construct with automatic device memory allocation.

Parameters:
  • comm – MPI communicator (if MPI is enabled).

  • fill_fraction – Fraction of available device memory to allocate.

~DeviceRuntimeEnvironment() noexcept#

Destructor.

DeviceRuntimeEnvironment(const DeviceRuntimeEnvironment&)#

Copy constructor.

DeviceRuntimeEnvironment(DeviceRuntimeEnvironment&&) noexcept#

Move constructor.

void *device_memory() const#

Get pointer to device memory buffer.

size_t device_memory_size() const#

Get size of device memory buffer in bytes.

bool owns_memory() const#

Check if this environment owns the device memory.

DeviceBackend *device_backend() const#

Get the device backend instance.

void release_buffer()#

Release the device memory buffer.

void set_buffer(void *m, size_t sz)#

Set an external device memory buffer.

Parameters:
  • m – Pointer to device memory.

  • sz – Size of device memory buffer in bytes.