File abstract_xpu_scatter_device.hpp
This file contains the interface definition for all scattering devices and implements an abstract scattering device from which all other devices are derived.
- Author
Daniel Vonk dan@danvonk.com
- Version
See VERSION in CMakeLists.txt
- Copyright
GNU General Public License
-
class AbstractXPUScatterDevice : public IScatterDevice
- #include <abstract_xpu_scatter_device.hpp>
Base class for scatter devices (currently for GPU based calculations)
Subclassed by AbstractVectorsXPUScatterDevice
Public Functions
-
AbstractXPUScatterDevice(boost::mpi::communicator allcomm, boost::mpi::communicator partitioncomm, Sample &sample, std::vector<CartesianCoor3D> vectors, size_t NAF, boost::asio::ip::tcp::endpoint fileservice_endpoint, boost::asio::ip::tcp::endpoint monitorservice_endpoint)
-
virtual ~AbstractXPUScatterDevice()
-
AbstractXPUScatterDevice(const AbstractXPUScatterDevice&) = delete
-
AbstractXPUScatterDevice &operator=(const AbstractXPUScatterDevice&) = delete
-
virtual void run() override
Starts the main computational workload for the device.
This function orchestrates the entire calculation process for the q-vectors assigned to this device’s partition. It follows a template method pattern, executing a fixed sequence of steps while delegating the specific implementation of key steps (like data staging and the core computation) to the concrete derived classes.
The typical sequence of operations is:
Perform a memory check to ensure sufficient resources.
Call the virtual
stage_data()method to load and distribute atom coordinates data.Call the
runner()method, which loops through all assigned q-vectors.Inside the loop, call the virtual
compute()method to perform the core calculation.After the loop, finalize services and clean up.
- Throws:
sassena::terminate_request – If a non-recoverable error (like insufficient memory) occurs.
Protected Functions
-
virtual void stage_data() = 0
-
virtual void compute() = 0
-
void next()
Compute next Q-vector.
-
void write()
-
virtual void runner() override
-
inline virtual void print_pre_stage_info()
-
inline virtual void print_post_stage_info()
-
inline virtual void print_pre_runner_info()
-
inline virtual void print_post_runner_info()
-
virtual bool ram_check()
-
virtual bool status() override
If there are still Q-vectors left to compute.
- Returns:
0 if there are still Q-vectors left to compute, else 1
-
virtual double progress() override
Protected Attributes
-
boost::mpi::communicator allcomm_
-
boost::mpi::communicator partitioncomm_
-
std::vector<CartesianCoor3D> vectors_
-
size_t current_vector_
-
std::unique_ptr<MonitorClient> p_monitor_
-
std::unique_ptr<HDF5WriterClient> p_hdf5writer_
-
size_t NN
-
size_t NF
-
size_t NA
-
fftw_complex *atfinal_ = nullptr
-
ScatterFactors scatterfactors
-
AbstractXPUScatterDevice(boost::mpi::communicator allcomm, boost::mpi::communicator partitioncomm, Sample &sample, std::vector<CartesianCoor3D> vectors, size_t NAF, boost::asio::ip::tcp::endpoint fileservice_endpoint, boost::asio::ip::tcp::endpoint monitorservice_endpoint)