18 timer & process_timer)
168 std::string target_file;
172 int* receive_buffer =
new int[1];
180 MPI_Recv(&receive_buffer[0], 1, MPI_INT, 0, MPI_ANY_TAG,
181 MPI_COMM_WORLD, &status);
185 int numtodo = receive_buffer[0];
190 std::cout <<
"worker" <<
myid <<
" received kill tag" << std::endl;
213 MPI_COMM_WORLD, &status);
221 for (
int kk = 0; kk < numtodo; ++kk){
225 double* current_params =
new double[(2*
numparam+1)];
226 for (
int mm =0; mm< 2*
numparam+1; mm++){
227 current_params[mm] = datareceived[kk*(2*numparam+1)+mm];
240 std::cout <<
"worker" <<
myid <<
" solving point " <<
linenumber << std::endl;
311 std::string target_file;
315 double* current_params =
new double[(2*
numparam+1)];
316 int* receive_buffer =
new int[1];
326 MPI_Recv(&receive_buffer[0], 1, MPI_INT, 0, MPI_ANY_TAG,
327 MPI_COMM_WORLD, &status);
331 int numtodo = receive_buffer[0];
336 std::cout <<
"worker" <<
myid <<
" received kill tag" << std::endl;
353 int num_solns_this_iteration = 0;
354 int num_points_with_solns_this_iteration = 0;
364 MPI_COMM_WORLD, &status);
372 for (
int kk = 0; kk < numtodo; ++kk){
376 for (
int mm =0; mm< 2*
numparam+1; mm++){
377 current_params[mm] = datareceived[kk*(2*numparam+1)+mm];
392 std::cout <<
"worker" <<
myid <<
" solving point " <<
linenumber << std::endl;
412 if (num_solns_this_solve>0) {
413 num_points_with_solns_this_iteration ++;
414 num_solns_this_iteration += num_solns_this_solve;
424 sendme = num_solns_this_iteration;
428 sendme = num_points_with_solns_this_iteration;
446 delete[] receive_buffer;
447 delete[] current_params;
470 int arbitraryinteger = 1;
471 MPI_Bcast(&arbitraryinteger, 1, MPI_INT, 0, MPI_COMM_WORLD);
518 MPI_Recv(&input_length, 1, MPI_INT, 0,
NUM_CHARACTERS, MPI_COMM_WORLD, &status);
557 MPI_Recv(&start_length, 1, MPI_INT, 0,
NUM_CHARACTERS, MPI_COMM_WORLD, &status);
587 std::cerr <<
"slave" <<
myid <<
" did not have start file when attempting to write it." << std::endl;
588 MPI_Abort(MPI_COMM_WORLD,919);
592 std::cerr <<
"slave" <<
myid <<
" was not in working folder before writing start." << std::endl;
593 MPI_Abort(MPI_COMM_WORLD,920);
599 if (!fout.is_open()) {
600 std::cerr <<
"failed to properly open " <<
"start" <<
" to open start file, worker " <<
myid << std::endl;
604 fout.close(); fout.clear();
613 std::cerr <<
"slave" <<
myid <<
" did not have input before attempting to write input" << std::endl;
614 MPI_Abort(MPI_COMM_WORLD,919);
618 std::cerr <<
"slave" <<
myid <<
" was not in working folder before writing input" << std::endl;
619 MPI_Abort(MPI_COMM_WORLD,920);
625 if (!fout.is_open()) {
626 std::cerr <<
"failed to properly open " <<
"input" <<
" to open input file, worker " <<
myid << std::endl;
630 fout.close(); fout.clear();
680 fin.open(
"names.out");
701 fin.open(
"func_input");
710 fin.open(
"preproc_data");
731 fout.open(
"arr.out");
732 for (
int ii = 0; ii< int(
arrdotout.size())-1; ii++) {
737 fout.open(
"deg.out");
738 for (
int ii = 0; ii< int(
degdotout.size())-1; ii++) {
742 fout.open(
"names.out");
743 for (
int ii = 0; ii< int(
namesdotout.size())-1; ii++) {
749 for (
int ii = 0; ii< int(
config.size())-1; ii++) {
750 fout <<
config[ii] <<
"\n";
754 fout.open(
"func_input");
755 for (
int ii = 0; ii< int(
funcinput.size())-1; ii++) {
760 fout.open(
"preproc_data");
762 for (
int ii = 0; ii < int(
preproc_data.size())-1; ++ii){
777 char *numer = NULL, *denom = NULL;
781 std::string convertmetochar;
782 std::stringstream ss, writess;
785 fout.open(
"num.out");
787 if (!fout.is_open()) {
788 std::cerr <<
"failed to open num.out" << std::endl;
800 for (
int ii=0; ii<2*
numparam; ++ii) {
801 writess << numdotout[ii+2] <<
"\n";
806 for (
int ii = 0; ii<
numparam; ++ii) {
807 if (current_params[2*ii]==0) {
808 writess <<
"0/1 ;\n";
811 ss << current_params[2*ii];
812 ss >> convertmetochar;
819 writess << numer <<
"/" << denom <<
" ;\n";
823 if (current_params[2*ii+1]==0) {
824 writess <<
"0/1 ;\n";
827 ss << current_params[2*ii+1];
828 ss >> convertmetochar;
833 writess << numer <<
"/" << denom <<
" ;\n";
839 for (
int ii = (2+4*numparam); ii< int(numdotout.size())-1; ++ii) {
840 writess << numdotout[ii] <<
"\n";
849 for (
int ii=0; ii <
numparam; ++ii){
850 if (current_params[2*ii] == 0){
851 writess <<
"0/1 ; \n";
854 ss << current_params[2*ii];
855 ss >> convertmetochar;
862 writess << numer <<
"/" << denom <<
" ;\n";
866 if (current_params[2*ii+1]==0) {
867 writess <<
"0/1 ;\n";
870 ss << current_params[2*ii+1];
871 ss >> convertmetochar;
876 writess << numer <<
"/" << denom <<
" ;\n";
881 for (
int ii = (2+2*numparam); ii< int(numdotout.size())-1; ++ii) {
882 writess << numdotout[ii] <<
"\n";
888 fout << writess.str();
905 boost::filesystem::path tmppath;
914 tmppath /=
"bfiles_";
916 tmppath /=
"tmpstep2";
921 std::stringstream converter;
923 tmppath += converter.str();
957 bool its_all_good =
true;
958 std::vector< std::string > reported_errors;
961 its_all_good =
false;
962 reported_errors.push_back(
"num.out");
966 its_all_good =
false;
967 reported_errors.push_back(
"no input");
971 its_all_good =
false;
972 reported_errors.push_back(
"no start");
977 its_all_good =
false;
978 reported_errors.push_back(
"not in working folder");
982 reported_errors.push_back(
"no filename");
983 its_all_good =
false;
987 reported_errors.push_back(
"no tmpfolder");
988 its_all_good =
false;
992 reported_errors.push_back(
"unset numfilesatatime");
993 its_all_good =
false;
997 reported_errors.push_back(
"unset numparam");
998 its_all_good =
false;
1002 reported_errors.push_back(
"unset standardstep2");
1003 its_all_good =
false;
1008 std::cerr <<
"slave " <<
myid <<
" reported its not all good, with bad flags:\n";
1010 for (
int ii=0; ii<int(reported_errors.size()); ii++) {
1011 std::cerr <<
"slave " << myid <<
" flag" << ii <<
" " << reported_errors[ii] << std::endl;
1013 std::cerr <<
"\n\nABORTING slave " << myid << std::endl;
1014 MPI_Abort(MPI_COMM_WORLD, 652);
int numfilesatatime_orig
the expected number of files per send
char * input_file
the input file in a c-friendly format
std::vector< std::string > numdotout
num.out file.
unsigned int currentSeed
the current seed for random number generator.
void LoopBasic(timer &process_timer)
std::vector< std::string > config
config file.
void PurgeWorkingFolder()
void CleanupSwitch(timer &process_timer)
std::vector< std::string > funcinput
func_input file.
void SeedSwitch(timer &process_timer)
void MoveToWorkingFolder()
void slave_main(ProgSettings input_settings, runinfo input_p_info, timer &process_timer)
boost::filesystem::path called_dir
where was I instantiated?
bool have_dotout
flag indicating whether we have read the .out files into memory.
void LoopSearch(timer &process_timer)
std::vector< std::string > degdotout
degout file.
void ReceiveInput(timer &process_timer)
void CleanupBasic(timer &process_timer)
char * start_file
the start file in a c-friendly format
boost::filesystem::path workingfolder
where should I go to perform work?
void CleanupSearch(timer &process_timer)
runinfo paramotopy_info
the parsed paramotopy input file.
void SeedSearch(timer &process_timer)
void parse_input_file_bertini(unsigned int ¤tSeed, int &MPType)
void LoopSwitch(timer &process_timer)
bool SlaveCollectAndWriteData(double *current_params, ProgSettings ¶motopy_settings, timer &process_timer)
bool in_working_folder
boolean indicating whether i think i am in the correct location to perform work.
std::vector< std::string > preproc_data
preproc_data file.
void SlaveSetup(ProgSettings ¶motopy_settings, runinfo ¶motopy_info, int myid, boost::filesystem::path called_dir)
int linenumber
what line is currently being run
void ReceiveStart(timer &process_timer)
std::vector< std::string > namesdotout
names.out file.
boost::filesystem::path inputfilename
boost::filesystem::path filename
the filename for the problem
int numparam
the number of parameters in the problem.
void add_time(const std::string timer_name)
int myid
my id withing my MPI communicator
std::vector< std::string > arrdotout
arr.out file.
boost::filesystem::path tmpfolder
the basis for workingfolder
A class that stores the general program settings of Paramotopy.
ProgSettings paramotopy_settings
the ProgSettings for this process
void run_zero_dim_main(int MPType, unsigned int currentSeed)
void safe_chdir(std::string desired_directory)
int MPType
MPType for current run.
datagatherer slavegatherer
data member from datagatherer, which will gather bertini output files.
A class for the input file parser.
void WriteNumDotOut(double current_params[])
bool have_input
flag indicating whether we have received the INPUT file from master.
int standardstep2
flag for total degree or coefficient parameter homotopy.
int numfilesatatime
the expected number of files per send
void SeedBasic(timer &process_timer)
bool have_start
flag indicating whether we have received the START file from master.
void press_start(const std::string timer_name)
Capable of timing arbitrary categories of processes, using a map of timer_data's. ...