# Architecture 

![architecture](../assets/architecture.png)


## DeviceDriver

The manager of all the GPU resources, responsible for allocating and destroying resources (e.g.: pointers, streams, events). It also provides primitives for interacting with these GPU resources. However, it has no domain knowledge about the MASS APIs.

Each GPU participating in the simulation is assigned with one `DeviceDriver`.

## DeviceDispatcher

The component containing all the kernel implementations and host-side logic for invoking these kernels. Each `DeviceDispatcher` manages one instance of `DeviceDriver` and is responsible for one GPU. 

It is not responsible for the actual data transfer between GPUs, so it has no knowledge about the other GPUs and the other `DeviceDispatcher` instances. However, it does have information about the existance of its neighbors at certain directions. 


## RootDispatcher

One instance for each host and maintains all the `DeviceDispatcher` instances for the GPUs on that host. It is responsible for dispatching the MASS CUDA APIs requests to all the `DeviceDispatcher` instances and handling all the actual data transfers between GPUs. 


## MASS APIs

The component containing all the functions, types and interfaces for interacting with the library. 