Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::ClfftInitializer Class Reference

#include <gromacs/gpu_utils/clfftinitializer.h>

Description

Handle clFFT library init and tear down in RAII style also with mutual exclusion.

Only one thread per process needs to attempt to set up and tear down the clFFT library, but this wrapper object ensures that it is safe to do so more than once, or from any thread. It is the responsibility of the caller to ensure that no use of the clFFT library is made before making an object of this type, or after the first such object is destroyed. If no more objects remain to be destroyed, then it is safe to create another and resume clFFT work.

Todo:
Consider making a composite object that also handles on-demand compilation, managing lifetime of PME FFT kernel programs to avoid exhausting resources and/or recompiling kernels previously used. See Redmine #2535.
Todo:
Consider implementing an appropriate flavor of the nifty counter idiom so that both static initialization and deinitialization can work in a fast, leak-free, and thread-safe way without imposing constraints on the calling code. See Redmine #2535.

Public Member Functions

 ClfftInitializer ()
 Constructor. More...
 
 ~ClfftInitializer ()
 Destructor.
 

Constructor & Destructor Documentation

gmx::ClfftInitializer::ClfftInitializer ( )

Constructor.

This initializers the clFFT library if there is a possibility of an FFT task on the device, and preserves it until destruction. Any time required for this initialization or tear down should not be accrued to per-MD-step counters.


The documentation for this class was generated from the following files: