Open Qmin  0.8.0
GPU-accelerated Q-tensor-based liquid crystal simulations
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
energyMinimizerLoLBFGS Class Reference

Implement energy minimization via a laughable version of LBFGS. More...

#include <energyMinimizerLoLBFGS.h>

Inheritance diagram for energyMinimizerLoLBFGS:
Inheritance graph
[legend]
Collaboration diagram for energyMinimizerLoLBFGS:
Collaboration graph
[legend]

Public Member Functions

 energyMinimizerLoLBFGS ()
 The basic constructor. More...
 
 energyMinimizerLoLBFGS (shared_ptr< simpleModel > system)
 The basic constructor that feeds in a target system to minimize. More...
 
virtual void initializeParameters ()
 Sets a bunch of default parameters that do not depend on the number of degrees of freedom. More...
 
virtual void initializeFromModel ()
 by default, set Ndof More...
 
void minimize ()
 Minimize to either the force tolerance or the maximum number of iterations. More...
 
virtual void performUpdate ()
 The "intergate equatios of motion just calls minimize. More...
 
void setLoLBFGSParameters (int _m=5, scalar _dt=0.0001, scalar _c=1.00, scalar fc=1e-12, scalar _tau=10)
 
scalar getMaxForce ()
 Return the maximum force. More...
 
void setForceCutoff (scalar fc)
 Set the force cutoff. More...
 
virtual scalar getClassSize ()
 
virtual void integrateEquationOfMotion ()
 
virtual void integrateEOMGPU ()
 
virtual void integrateEOMCPU ()
 
virtual void Update (int timestep)
 The fundamental function that a controlling Simulation can call. More...
 
void setSimulation (shared_ptr< basicSimulation > _sim)
 set the simulation More...
 
virtual void setModel (shared_ptr< simpleModel > _model)
 virtual function to allow the model to be a derived class More...
 
void setPeriod (int _p)
 set the period More...
 
void setPhase (int _p)
 set the phase More...
 
virtual void spatialSorting ()
 allow for spatial sorting to be called if necessary... More...
 
virtual void setReproducible (bool rep)
 Allow for a reproducibility call to be made. More...
 
virtual void setGPU (bool _useGPU=true)
 Enforce GPU operation. More...
 
int getNdof ()
 Get the number of degrees of freedom of the equation of motion. More...
 
void setNdof (int _n)
 Set the number of degrees of freedom of the equation of motion. More...
 
virtual void setDeltaT (scalar dt)
 allow all updaters to potentially implement an internal time scale More...
 
virtual void setNThreads (int n)
 allow for setting multiple threads More...
 
void setMaximumIterations (int maxIt)
 Set the maximum number of iterations before terminating (or set to -1 to ignore) More...
 
int getCurrentIterations ()
 
int getMaxIterations ()
 
void setCurrentIterations (int newIterations)
 
int getNTotal ()
 communicate the number of non-object sites across ranks More...
 

Public Attributes

bool scheduledMomentum = false
 
GPUArray< dVec > displacement
 an array of displacements More...
 
shared_ptr< basicSimulationsim
 A pointer to the governing simulation. More...
 
shared_ptr< simpleModelmodel
 A pointer to a simpleModel that the updater acts on. More...
 
vector< scalarupdaterData
 
int iterations
 The number of iterations performed. More...
 

Protected Member Functions

void LoLBFGSStepCPU ()
 
void LoLBFGSStepGPU ()
 
void lineSearchCPU (GPUArray< dVec > &descentDirection)
 
void lineSearchGPU (GPUArray< dVec > &descentDirection)
 

Protected Attributes

int m =0
 the number of past gradients, etc., to save More...
 
scalar c
 a scalaing factor More...
 
scalar forceMax
 the maximum value of the force More...
 
scalar forceCutoff
 The cutoff value of the maximum force. More...
 
scalar eta
 gain parameter More...
 
scalar tau
 
int currentIterationInMLoop
 hmm... More...
 
GPUArray< scalaralpha
 vector of alpha values More...
 
GPUArray< scalarsDotY
 vector of s\cdot y terms More...
 
GPUArray< dVec > unscaledStep
 the unscaled version of the step size More...
 
vector< GPUArray< dVec > > gradientDifference
 vector of GPUArray of gradient differences More...
 
vector< GPUArray< dVec > > secantEquation
 vector of GPUArray of steps in trajectory space More...
 
GPUArray< scalarsumReductionIntermediate
 Utility array for simple reductions. More...
 
GPUArray< scalarsumReductionIntermediate2
 
GPUArray< scalarreductions
 Utility array for simple (sum or dot product) reductions. More...
 
shared_ptr< kernelTunerdotProductTuner
 kernel tuner for performance More...
 
shared_ptr< kernelTunerminimizationTuner
 
int nThreads =1
 number of threads to use More...
 
int Period
 The period of the updater... the updater will work every Period timesteps. More...
 
int Phase
 The phase of the updater... the updater will work every Period timesteps offset by a phase. More...
 
bool useGPU
 whether the updater does its work on the GPU or not More...
 
bool neverGPU
 whether the updater never does work on the GPU More...
 
int Ndof
 some measure of the number of degrees of freedom the equations of motion might need to know about locally More...
 
int nTotal
 the total number of non-object sites across all ranks More...
 
bool reproducible
 whether the RNGs give reproducible results More...
 
scalar deltaT
 The internal time step size. More...
 
int maxIterations
 The maximum number of iterations allowed. More...
 

Detailed Description

Implement energy minimization via a laughable version of LBFGS.

the "online" formalism of LBFGS ("A Stochastic Quasi-Newton Method for Online Convex Optimization", Nicol N. Schraudolph, Jin Yu, Simon Gunter, 2007) so that there is no line search, but without the "online" part related to stochastic gradient estimates

Constructor & Destructor Documentation

◆ energyMinimizerLoLBFGS() [1/2]

energyMinimizerLoLBFGS::energyMinimizerLoLBFGS ( )
inline

The basic constructor.

References initializeParameters().

◆ energyMinimizerLoLBFGS() [2/2]

energyMinimizerLoLBFGS::energyMinimizerLoLBFGS ( shared_ptr< simpleModel system)

The basic constructor that feeds in a target system to minimize.

References initializeFromModel(), initializeParameters(), and updater::setModel().

Member Function Documentation

◆ initializeParameters()

void energyMinimizerLoLBFGS::initializeParameters ( )
virtual

Sets a bunch of default parameters that do not depend on the number of degrees of freedom.

Initialize the minimizer with some default parameters. that do not depend on Ndof

References currentIterationInMLoop, forceMax, updater::iterations, reductions, GPUArray< T >::resize(), scheduledMomentum, setForceCutoff(), updater::setGPU(), setLoLBFGSParameters(), and updater::setMaximumIterations().

Referenced by energyMinimizerLoLBFGS().

◆ initializeFromModel()

void energyMinimizerLoLBFGS::initializeFromModel ( )
virtual

◆ minimize()

void energyMinimizerLoLBFGS::minimize ( )

◆ performUpdate()

virtual void energyMinimizerLoLBFGS::performUpdate ( )
inlinevirtual

The "intergate equatios of motion just calls minimize.

Reimplemented from equationOfMotion.

References minimize().

◆ setLoLBFGSParameters()

void energyMinimizerLoLBFGS::setLoLBFGSParameters ( int  _m = 5,
scalar  _dt = 0.0001,
scalar  _c = 1.00,
scalar  fc = 1e-12,
scalar  _tau = 10 
)
inline

◆ getMaxForce()

scalar energyMinimizerLoLBFGS::getMaxForce ( )
inlinevirtual

Return the maximum force.

Reimplemented from updater.

References forceMax.

◆ setForceCutoff()

void energyMinimizerLoLBFGS::setForceCutoff ( scalar  fc)
inline

Set the force cutoff.

References forceCutoff.

Referenced by initializeParameters(), and setLoLBFGSParameters().

◆ getClassSize()

virtual scalar energyMinimizerLoLBFGS::getClassSize ( )
inlinevirtual

◆ LoLBFGSStepCPU()

void energyMinimizerLoLBFGS::LoLBFGSStepCPU ( )
protected

◆ LoLBFGSStepGPU()

void energyMinimizerLoLBFGS::LoLBFGSStepGPU ( )
protected

◆ lineSearchCPU()

void energyMinimizerLoLBFGS::lineSearchCPU ( GPUArray< dVec > &  descentDirection)
protected

◆ lineSearchGPU()

void energyMinimizerLoLBFGS::lineSearchGPU ( GPUArray< dVec > &  descentDirection)
protected

◆ integrateEquationOfMotion()

virtual void equationOfMotion::integrateEquationOfMotion ( )
inlinevirtualinherited

◆ integrateEOMGPU()

virtual void equationOfMotion::integrateEOMGPU ( )
inlinevirtualinherited

◆ integrateEOMCPU()

virtual void equationOfMotion::integrateEOMCPU ( )
inlinevirtualinherited

◆ Update()

virtual void updater::Update ( int  timestep)
inlinevirtualinherited

The fundamental function that a controlling Simulation can call.

References updater::performUpdate(), updater::Period, and updater::Phase.

◆ setSimulation()

void updater::setSimulation ( shared_ptr< basicSimulation _sim)
inlineinherited

set the simulation

References updater::sim.

◆ setModel()

virtual void updater::setModel ( shared_ptr< simpleModel _model)
inlinevirtualinherited

◆ setPeriod()

void updater::setPeriod ( int  _p)
inlineinherited

set the period

References updater::Period.

◆ setPhase()

void updater::setPhase ( int  _p)
inlineinherited

set the phase

References updater::Phase.

◆ spatialSorting()

virtual void updater::spatialSorting ( )
inlinevirtualinherited

allow for spatial sorting to be called if necessary...

◆ setReproducible()

virtual void updater::setReproducible ( bool  rep)
inlinevirtualinherited

Allow for a reproducibility call to be made.

References updater::reproducible.

◆ setGPU()

virtual void updater::setGPU ( bool  _useGPU = true)
inlinevirtualinherited

◆ getNdof()

int updater::getNdof ( )
inlineinherited

Get the number of degrees of freedom of the equation of motion.

References updater::Ndof.

◆ setNdof()

void updater::setNdof ( int  _n)
inlineinherited

Set the number of degrees of freedom of the equation of motion.

References updater::Ndof.

◆ setDeltaT()

virtual void updater::setDeltaT ( scalar  dt)
inlinevirtualinherited

allow all updaters to potentially implement an internal time scale

Reimplemented in energyMinimizerFIRE.

References updater::deltaT.

Referenced by energyMinimizerGradientDescent::initializeParameters(), and energyMinimizerGradientDescent::setGradientDescentParameters().

◆ setNThreads()

virtual void updater::setNThreads ( int  n)
inlinevirtualinherited

allow for setting multiple threads

References n, and updater::nThreads.

◆ setMaximumIterations()

void updater::setMaximumIterations ( int  maxIt)
inlineinherited

◆ getCurrentIterations()

int updater::getCurrentIterations ( )
inlineinherited

References updater::iterations.

◆ getMaxIterations()

int updater::getMaxIterations ( )
inlineinherited

◆ setCurrentIterations()

void updater::setCurrentIterations ( int  newIterations)
inlineinherited

References updater::iterations.

◆ getNTotal()

int updater::getNTotal ( )
inherited

communicate the number of non-object sites across ranks

References access_location::host, updater::model, updater::Ndof, updater::nTotal, access_mode::read, updater::sim, and updater::updaterData.

Member Data Documentation

◆ scheduledMomentum

bool energyMinimizerLoLBFGS::scheduledMomentum = false

Referenced by initializeParameters(), and minimize().

◆ m

int energyMinimizerLoLBFGS::m =0
protected

the number of past gradients, etc., to save

Referenced by initializeFromModel(), LoLBFGSStepCPU(), LoLBFGSStepGPU(), minimize(), and setLoLBFGSParameters().

◆ c

scalar energyMinimizerLoLBFGS::c
protected

a scalaing factor

Referenced by lineSearchCPU(), and setLoLBFGSParameters().

◆ forceMax

scalar energyMinimizerLoLBFGS::forceMax
protected

the maximum value of the force

Referenced by getMaxForce(), initializeParameters(), LoLBFGSStepCPU(), LoLBFGSStepGPU(), and minimize().

◆ forceCutoff

scalar energyMinimizerLoLBFGS::forceCutoff
protected

The cutoff value of the maximum force.

Referenced by minimize(), and setForceCutoff().

◆ eta

scalar energyMinimizerLoLBFGS::eta
protected

◆ tau

scalar energyMinimizerLoLBFGS::tau
protected

Referenced by minimize(), and setLoLBFGSParameters().

◆ currentIterationInMLoop

int energyMinimizerLoLBFGS::currentIterationInMLoop
protected

◆ alpha

GPUArray<scalar> energyMinimizerLoLBFGS::alpha
protected

vector of alpha values

Referenced by getClassSize(), LoLBFGSStepCPU(), LoLBFGSStepGPU(), and setLoLBFGSParameters().

◆ sDotY

GPUArray<scalar> energyMinimizerLoLBFGS::sDotY
protected

vector of s\cdot y terms

Referenced by getClassSize(), LoLBFGSStepCPU(), LoLBFGSStepGPU(), and setLoLBFGSParameters().

◆ unscaledStep

GPUArray<dVec> energyMinimizerLoLBFGS::unscaledStep
protected

the unscaled version of the step size

Referenced by getClassSize(), initializeFromModel(), LoLBFGSStepCPU(), and LoLBFGSStepGPU().

◆ gradientDifference

vector<GPUArray<dVec> > energyMinimizerLoLBFGS::gradientDifference
protected

◆ secantEquation

vector<GPUArray<dVec> > energyMinimizerLoLBFGS::secantEquation
protected

vector of GPUArray of steps in trajectory space

Referenced by getClassSize(), initializeFromModel(), LoLBFGSStepCPU(), LoLBFGSStepGPU(), and setLoLBFGSParameters().

◆ sumReductionIntermediate

GPUArray<scalar> energyMinimizerLoLBFGS::sumReductionIntermediate
protected

Utility array for simple reductions.

Referenced by getClassSize(), initializeFromModel(), and LoLBFGSStepGPU().

◆ sumReductionIntermediate2

GPUArray<scalar> energyMinimizerLoLBFGS::sumReductionIntermediate2
protected

◆ reductions

GPUArray<scalar> energyMinimizerLoLBFGS::reductions
protected

Utility array for simple (sum or dot product) reductions.

Referenced by getClassSize(), and initializeParameters().

◆ dotProductTuner

shared_ptr<kernelTuner> energyMinimizerLoLBFGS::dotProductTuner
protected

kernel tuner for performance

◆ minimizationTuner

shared_ptr<kernelTuner> energyMinimizerLoLBFGS::minimizationTuner
protected

◆ displacement

GPUArray<dVec> equationOfMotion::displacement
inherited

◆ sim

shared_ptr<basicSimulation> updater::sim
inherited

◆ model

shared_ptr<simpleModel> updater::model
inherited

◆ updaterData

vector<scalar> updater::updaterData
inherited

◆ iterations

int updater::iterations
inherited

◆ nThreads

int updater::nThreads =1
protectedinherited

number of threads to use

Referenced by updater::setNThreads().

◆ Period

int updater::Period
protectedinherited

The period of the updater... the updater will work every Period timesteps.

Referenced by updater::setPeriod(), updater::Update(), and updater::updater().

◆ Phase

int updater::Phase
protectedinherited

The phase of the updater... the updater will work every Period timesteps offset by a phase.

Referenced by updater::setPhase(), updater::Update(), and updater::updater().

◆ useGPU

bool updater::useGPU
protectedinherited

◆ neverGPU

bool updater::neverGPU
protectedinherited

◆ Ndof

int updater::Ndof
protectedinherited

◆ nTotal

int updater::nTotal
protectedinherited

◆ reproducible

bool updater::reproducible
protectedinherited

whether the RNGs give reproducible results

Referenced by updater::setReproducible(), and updater::updater().

◆ deltaT

scalar updater::deltaT
protectedinherited

◆ maxIterations

int updater::maxIterations
protectedinherited

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