Paramotopy
parallel parameter homotopy through bertini
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
master_process Class Reference

master process for basic searches and brute-force runs. More...

#include <master.hpp>

Collaboration diagram for master_process:
[legend]

Public Member Functions

 master_process ()
 
void master_main (ProgSettings input_settings, runinfo input_p_info, timer &process_timer)
 

Private Member Functions

void MasterSetup ()
 
void SeedSwitch (timer &process_timer)
 
void SeedBasic (timer &process_timer)
 
void SeedSearch (timer &process_timer)
 
void LoopSwitch (timer &process_timer)
 
void LoopBasic (timer &process_timer)
 
void LoopSearch (timer &process_timer)
 
void CleanupSwitch (timer &process_timer)
 
void CleanupBasic (timer &process_timer)
 
void CleanupSearch (timer &process_timer)
 
void SendInput (timer &process_timer)
 
void SendStart (timer &process_timer)
 
void NextRandomValue (int pointcounter, double tempsends[])
 
void FormNextValues (int pointcounter, std::vector< std::vector< std::pair< double, double > > > Values, double tempsends[])
 
void FormNextValues_mc (int pointcounter, double tempsends[])
 
void GetTerminationInt ()
 
void OpenMC ()
 
void SetTmpFolder ()
 
void SetUpFolders ()
 
void TerminateInactiveWorker (int worker_id, timer &process_timer)
 
void TerminateActiveWorker (int worker_id, timer &process_timer)
 
void ReadyCheck ()
 

Private Attributes

runinfo paramotopy_info
 the parsed paramotopy input file. More...
 
ProgSettings paramotopy_settings
 the ProgSettings for this process More...
 
std::vector< int > lastnumsent
 progress tracker More...
 
int numprocs
 number of processors in the communicator More...
 
int myid
 my MPI id relative to communicator More...
 
int numparam
 number of parameters in problem More...
 
boost::filesystem::path filename
 filename for problem More...
 
int standardstep2
 switch for total degree vs. coeff. homotopy More...
 
int numfilesatatime
 current number of files passed out at each distribution More...
 
int numfilesatatime_orig
 given number of files passed out at each distribution More...
 
int terminationint
 maximum absolute_current_index value before loop breaks. More...
 
int current_absolute_index
 the current absolute index. More...
 
boost::filesystem::path lastoutfilename
 name of the progress file More...
 
boost::filesystem::path tmpfolder
 where the temp files at? More...
 
boost::filesystem::path called_dir
 where was I when I was instantiated? More...
 
boost::filesystem::path homedir
 where is /Users/ofloveandhate? More...
 
std::ofstream mc_out_stream
 parameter point out file More...
 
std::ifstream mc_in_stream
 parameter point in file More...
 
std::vector< int > index_conversion_vector
 
std::map< int, bool > active_workers
 map for tracking the active workers. More...
 
int num_active_workers
 parity checker More...
 

Detailed Description

master process for basic searches and brute-force runs.

process for distribution of parameter points and termination of workers.

Definition at line 41 of file master.hpp.

Constructor & Destructor Documentation

master_process::master_process ( )
inline

Definition at line 60 of file master.hpp.

References called_dir, homedir, myid, num_active_workers, numprocs, and stackoverflow_getcwd().

Here is the call graph for this function:

Member Function Documentation

void master_process::CleanupBasic ( timer process_timer)
private

basic mode cleanup function.

Parameters
process_timercurrent timer

Definition at line 849 of file master.cpp.

References active_workers, timer::add_time(), current_absolute_index, runinfo::location, mc_in_stream, mc_out_stream, num_active_workers, paramotopy_info, paramotopy_settings, timer::press_start(), ProgSettings::settings, TerminateActiveWorker(), and runinfo::userdefined.

Referenced by CleanupSearch(), and CleanupSwitch().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::CleanupSearch ( timer process_timer)
private

search mode cleanup function.

Parameters
process_timercurrent timer

Definition at line 933 of file master.cpp.

References CleanupBasic().

Referenced by CleanupSwitch().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::CleanupSwitch ( timer process_timer)
private

cleanup switch

Parameters
process_timercurrent timer

Definition at line 818 of file master.cpp.

References CleanupBasic(), CleanupSearch(), paramotopy_settings, ProgSettings::settings, and tmpfolder.

Referenced by master_main().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::FormNextValues ( int  pointcounter,
std::vector< std::vector< std::pair< double, double > > >  Values,
double  tempsends[] 
)
private

the function for determining the parameter values to send next.

Parameters
numparamthe number of parameters in the problem being solved.
pointcountercounts the number of loops. determines which index in tempsends gets set.
Valuesthe parameter discretization values.
countingupcounter.
tempsendsthe variable in which the parameter points get set, for distribution to the workers via MPI.

Definition at line 131 of file master.cpp.

References current_absolute_index, index_conversion_vector, and numparam.

Referenced by LoopBasic(), and SeedBasic().

Here is the caller graph for this function:

void master_process::FormNextValues_mc ( int  pointcounter,
double  tempsends[] 
)
private

the user-defined parameter set function for setting the parameter values to send next

Parameters
pointcountercounts the number of loops. determines which index in tempsends gets set.
tempsendsthe variable in which the parameter points get set, for distribution to the workers via MPI.

Definition at line 165 of file master.cpp.

References current_absolute_index, mc_in_stream, and numparam.

Referenced by LoopBasic(), and SeedBasic().

Here is the caller graph for this function:

void master_process::GetTerminationInt ( )
private

sets the value of this->terminationint

Definition at line 1097 of file master.cpp.

References GetMcNumLines(), index_conversion_vector, runinfo::location, runinfo::NumMeshPoints, runinfo::numparam, paramotopy_info, paramotopy_settings, ProgSettings::settings, terminationint, and runinfo::userdefined.

Referenced by master_main().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::LoopBasic ( timer process_timer)
private

basic mode run loop

Parameters
process_timercurrent timer

Definition at line 479 of file master.cpp.

References timer::add_time(), current_absolute_index, DATA_DOUBLE, FormNextValues(), FormNextValues_mc(), lastnumsent, lastoutfilename, mc_out_stream, NUM_PACKETS, numfilesatatime, runinfo::numparam, numprocs, paramotopy_info, paramotopy_settings, timer::press_start(), ReadyCheck(), ProgSettings::settings, terminationint, runinfo::userdefined, and runinfo::Values.

Referenced by LoopSwitch().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::LoopSearch ( timer process_timer)
private

search mode loop

Parameters
process_timercurrent timer

Definition at line 637 of file master.cpp.

References timer::add_time(), current_absolute_index, DATA_DOUBLE, lastnumsent, lastoutfilename, mc_out_stream, NextRandomValue(), NUM_PACKETS, numfilesatatime, numfilesatatime_orig, runinfo::numparam, numprocs, paramotopy_info, paramotopy_settings, timer::press_start(), ReadyCheck(), ProgSettings::settings, TerminateActiveWorker(), and terminationint.

Referenced by LoopSwitch().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::LoopSwitch ( timer process_timer)
private

main loop switch

Parameters
process_timercurrent timer

Definition at line 457 of file master.cpp.

References LoopBasic(), LoopSearch(), paramotopy_settings, and ProgSettings::settings.

Referenced by master_main().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::master_main ( ProgSettings  input_settings,
runinfo  input_p_info,
timer process_timer 
)

the main master process. to be used by which ever process gets myid==0. handles the distribution of the parameter points to the workers via MPI.

this is the only public method excepting the constructors.

Parameters
input_settingscurrent input settings.
input_p_infocurrent parser run info.
process_timerMUTABLE current timer, and returns to user for further use.

Definition at line 9 of file master.cpp.

References CleanupSwitch(), GetTerminationInt(), LoopSwitch(), MasterSetup(), OpenMC(), paramotopy_info, paramotopy_settings, SeedSwitch(), SendInput(), SendStart(), SetTmpFolder(), and SetUpFolders().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::MasterSetup ( )
private

the master setup function

uses the runinfo and ProgSettings in memory to setup the rest of the necessaries.

Definition at line 67 of file master.cpp.

References filename, runinfo::inputfilename, lastoutfilename, runinfo::location, numfilesatatime, numfilesatatime_orig, runinfo::numparam, numparam, paramotopy_info, paramotopy_settings, ProgSettings::settings, and standardstep2.

Referenced by master_main().

Here is the caller graph for this function:

void master_process::NextRandomValue ( int  pointcounter,
double  tempsends[] 
)
private

generates a random point in an interval, contained in the runinfo object.

Parameters
paramotopy_infoholds configuration info
numparamthe number of parameters in the problem being solved.
pointcountercounts the number of loops. determines which index in tempsends gets set.
tempsendsthe variable in which the parameter points get set, for distribution to the workers via MPI.

Definition at line 102 of file master.cpp.

References runinfo::BoundsLeft, runinfo::BoundsRight, current_absolute_index, numparam, and paramotopy_info.

Referenced by LoopSearch(), and SeedSearch().

Here is the caller graph for this function:

void master_process::OpenMC ( )
private

opens the mc_in_stream and mc_out_stream files as necessary

Definition at line 1131 of file master.cpp.

References runinfo::location, mc_in_stream, mc_out_stream, paramotopy_info, paramotopy_settings, ProgSettings::settings, and runinfo::userdefined.

Referenced by master_main().

Here is the caller graph for this function:

void master_process::ReadyCheck ( )
private

just makin' sure we are ready to go before we do go.

Definition at line 1292 of file master.cpp.

References myid, numfilesatatime, terminationint, and tmpfolder.

Referenced by LoopBasic(), and LoopSearch().

Here is the caller graph for this function:

void master_process::SeedBasic ( timer process_timer)
private

basic seeding function

Parameters
process_timercurrent timer

Definition at line 233 of file master.cpp.

References active_workers, timer::add_time(), current_absolute_index, DATA_DOUBLE, FormNextValues(), FormNextValues_mc(), lastnumsent, mc_out_stream, num_active_workers, NUM_PACKETS, numfilesatatime, runinfo::numparam, numprocs, paramotopy_info, paramotopy_settings, timer::press_start(), ProgSettings::settings, TerminateInactiveWorker(), terminationint, runinfo::userdefined, and runinfo::Values.

Referenced by SeedSwitch().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::SeedSearch ( timer process_timer)
private

search mode seeding function

Parameters
process_timercurrent timer

Definition at line 336 of file master.cpp.

References active_workers, timer::add_time(), current_absolute_index, DATA_DOUBLE, lastnumsent, mc_out_stream, NextRandomValue(), num_active_workers, NUM_PACKETS, numfilesatatime, runinfo::numparam, numprocs, paramotopy_info, paramotopy_settings, timer::press_start(), ProgSettings::settings, TerminateInactiveWorker(), terminationint, and runinfo::userdefined.

Referenced by SeedSwitch().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::SeedSwitch ( timer process_timer)
private

switch for choosing seed process

Parameters
process_timercurrent timer

Definition at line 208 of file master.cpp.

References paramotopy_settings, SeedBasic(), SeedSearch(), and ProgSettings::settings.

Referenced by master_main().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::SendInput ( timer process_timer)
private

sends input file to all workers in the communicator via a for loop MPI_Send

Parameters
process_timercurrent timer

Definition at line 1013 of file master.cpp.

References timer::add_time(), runinfo::MakeRandomValues(), NUM_CHARACTERS, numprocs, paramotopy_info, paramotopy_settings, timer::press_start(), runinfo::steptwomode, TEXT_FILE, WriteFailStep2(), and WriteStep2().

Referenced by master_main().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::SendStart ( timer process_timer)
private

sends start file to all workers in communicator via a for loop MPI_Send

Parameters
process_timercurrent timer

Definition at line 950 of file master.cpp.

References timer::add_time(), GetStart(), runinfo::location, NUM_CHARACTERS, numprocs, paramotopy_info, paramotopy_settings, timer::press_start(), ProgSettings::settings, and TEXT_FILE.

Referenced by master_main().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::SetTmpFolder ( )
private

sets the value of this->tmpfolder

Definition at line 1173 of file master.cpp.

References called_dir, runinfo::inputfilename, paramotopy_info, paramotopy_settings, ProgSettings::settings, and tmpfolder.

Referenced by master_main().

Here is the caller graph for this function:

void master_process::SetUpFolders ( )
private

creates the folders for the workers, and writes the names of the folders to a file in bfiles_filename/run#/folders

Definition at line 1197 of file master.cpp.

References runinfo::location, numprocs, and paramotopy_info.

Referenced by master_main().

Here is the caller graph for this function:

void master_process::TerminateActiveWorker ( int  worker_id,
timer process_timer 
)
private

sends the TERMINATE tag to an ACTIVE worker, and removes it from the list, decrementing the num_active_workers counter.

Definition at line 1261 of file master.cpp.

References active_workers, timer::add_time(), num_active_workers, timer::press_start(), and TERMINATE.

Referenced by CleanupBasic(), and LoopSearch().

Here is the call graph for this function:

Here is the caller graph for this function:

void master_process::TerminateInactiveWorker ( int  worker_id,
timer process_timer 
)
private

sends the TERMINATE tag to an INACTIVE worker, but does not remove them from the list of active workers (cuz this worker shouldn't be on it).

Definition at line 1233 of file master.cpp.

References active_workers, timer::add_time(), timer::press_start(), and TERMINATE.

Referenced by SeedBasic(), and SeedSearch().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::map< int, bool> master_process::active_workers
private

map for tracking the active workers.

Definition at line 129 of file master.hpp.

Referenced by CleanupBasic(), SeedBasic(), SeedSearch(), TerminateActiveWorker(), and TerminateInactiveWorker().

boost::filesystem::path master_process::called_dir
private

where was I when I was instantiated?

Definition at line 120 of file master.hpp.

Referenced by master_process(), and SetTmpFolder().

int master_process::current_absolute_index
private

the current absolute index.

Definition at line 115 of file master.hpp.

Referenced by CleanupBasic(), FormNextValues(), FormNextValues_mc(), LoopBasic(), LoopSearch(), NextRandomValue(), SeedBasic(), and SeedSearch().

boost::filesystem::path master_process::filename
private

filename for problem

Definition at line 107 of file master.hpp.

Referenced by MasterSetup().

boost::filesystem::path master_process::homedir
private

where is /Users/ofloveandhate?

Definition at line 121 of file master.hpp.

Referenced by master_process().

std::vector< int > master_process::index_conversion_vector
private

Definition at line 126 of file master.hpp.

Referenced by FormNextValues(), and GetTerminationInt().

std::vector< int > master_process::lastnumsent
private

progress tracker

Definition at line 99 of file master.hpp.

Referenced by LoopBasic(), LoopSearch(), SeedBasic(), and SeedSearch().

boost::filesystem::path master_process::lastoutfilename
private

name of the progress file

Definition at line 118 of file master.hpp.

Referenced by LoopBasic(), LoopSearch(), and MasterSetup().

std::ifstream master_process::mc_in_stream
private

parameter point in file

Definition at line 124 of file master.hpp.

Referenced by CleanupBasic(), FormNextValues_mc(), and OpenMC().

std::ofstream master_process::mc_out_stream
private

parameter point out file

Definition at line 123 of file master.hpp.

Referenced by CleanupBasic(), LoopBasic(), LoopSearch(), OpenMC(), SeedBasic(), and SeedSearch().

int master_process::myid
private

my MPI id relative to communicator

Definition at line 103 of file master.hpp.

Referenced by master_process(), and ReadyCheck().

int master_process::num_active_workers
private

parity checker

Definition at line 130 of file master.hpp.

Referenced by CleanupBasic(), master_process(), SeedBasic(), SeedSearch(), and TerminateActiveWorker().

int master_process::numfilesatatime
private

current number of files passed out at each distribution

Definition at line 111 of file master.hpp.

Referenced by LoopBasic(), LoopSearch(), MasterSetup(), ReadyCheck(), SeedBasic(), and SeedSearch().

int master_process::numfilesatatime_orig
private

given number of files passed out at each distribution

Definition at line 112 of file master.hpp.

Referenced by LoopSearch(), and MasterSetup().

int master_process::numparam
private

number of parameters in problem

Definition at line 105 of file master.hpp.

Referenced by FormNextValues(), FormNextValues_mc(), MasterSetup(), and NextRandomValue().

int master_process::numprocs
private

number of processors in the communicator

Definition at line 101 of file master.hpp.

Referenced by LoopBasic(), LoopSearch(), master_process(), SeedBasic(), SeedSearch(), SendInput(), SendStart(), and SetUpFolders().

runinfo master_process::paramotopy_info
private
ProgSettings master_process::paramotopy_settings
private
int master_process::standardstep2
private

switch for total degree vs. coeff. homotopy

Definition at line 109 of file master.hpp.

Referenced by MasterSetup().

int master_process::terminationint
private

maximum absolute_current_index value before loop breaks.

Definition at line 114 of file master.hpp.

Referenced by GetTerminationInt(), LoopBasic(), LoopSearch(), ReadyCheck(), SeedBasic(), and SeedSearch().

boost::filesystem::path master_process::tmpfolder
private

where the temp files at?

Definition at line 119 of file master.hpp.

Referenced by CleanupSwitch(), ReadyCheck(), and SetTmpFolder().


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