Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JobDistributorFactory.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/jd2/JobDistributorFactory
11 /// @brief JobDistributorFactory class, part of August 2008 job distributor as planned at RosettaCon08.
12 /// @author Andrew Leaver-Fay
13 /// @author Steven Lewis smlewi@gmail.com
14 
15 // Unit headers
17 
18 // Package heaaders
27 
29 
31 
33 
34 #include <basic/options/option.hh>
35 // option key includes
36 
37 #include <basic/options/keys/out.OptionKeys.gen.hh>
38 #include <basic/options/keys/in.OptionKeys.gen.hh>
39 #include <basic/options/keys/jd2.OptionKeys.gen.hh>
40 #include <basic/options/keys/run.OptionKeys.gen.hh>
41 #include <basic/options/keys/parser.OptionKeys.gen.hh>
42 #include <basic/options/keys/enzdes.OptionKeys.gen.hh>
43 
44 // Utility headers
45 #include <utility/exit.hh>
46 
47 //Auto Headers
48 #include <utility/vector1.hh>
49 
50 //Haiku is classy
51 #ifdef BOINC
52 #ifdef USEMPI
53 Compilation stops
54 MPI or BOINC: pick one
55 check your build settings
56 #endif
57 #endif
58 
59 
60 namespace protocols {
61 namespace jd2 {
62 
63 using namespace basic::options;
64 using namespace basic::options::OptionKeys;
65 /// @details All the convoluted logic combining compile-time decisions and
66 /// run-time decisions for which job distributor to use lives here.
67 /// As of right now, this logic isn't all that convoluted.
68 JobDistributor *
70 #ifdef USEMPI
71  int n_rank_;
72  MPI_Comm_size( MPI_COMM_WORLD, ( int* )( &n_rank_ ) );
73 
74  if ( n_rank_ > 3 && option[ OptionKeys::run::archive ] ) return new archive::MPIArchiveJobDistributor;
75  if ( n_rank_ > 2 && option[ OptionKeys::jd2::mpi_work_partition_job_distributor ].value() == true ) {
77  } else {
78  if ( n_rank_ > 2 && option[ OptionKeys::run::n_replica ]() > 1 ) {
79  return new MPIMultiCommJobDistributor( option[ OptionKeys::run::n_replica ]() );
80  }
81  ///NOTE: MPIFileBufJobDistributor has not been tested with PDB-Outputter. No idea if this works.
82  /// according to wishes of the community the check in the lines below is turned off.
83  /// if you see that MPI and PDB output is not working: you have a couple of options:
84  /// 1) change to silent-output it is better
85  /// 2) change to silent-output it is way better
86  /// 3) dude: change to silent-output
87  /// 4) debug PDBOutputter to make it work with MPIFileBufJobDistributor --- and remove this note
88  /// 5) uncomment the test for -out:file:silent below
89  /// OL 6/9/09
90 
91  ///NOTE: PDB output does not work with MPIFileBufJobDistributor as of 6/15/09 (SML)
92  ///Someone should debug MPIFileBufJobDistributor to follow the parent classes and work with all
93  ///JobInputters and JobOutputters. The silent check below can then be removed, since it's dangerous overloading
94  ///to hack around a bug...
95 
96  ///NOTE: the option jd2:mpi_filebuf_jobdistributor is now true by default, according to exchange on minirosetta list Nov 2010. (OL)
97  if ( n_rank_ > 2 && option[ out::file::silent ].user() &&
98  ( option[ OptionKeys::jd2::mpi_file_buf_job_distributor ].value() == true
99  || option[ OptionKeys::jd2::mpi_filebuf_jobdistributor ].value() == true ) ) {
100  return new MPIFileBufJobDistributor;
101  } else {
102  if ( n_rank_ > 1 ) return new MPIWorkPoolJobDistributor;
103  }
104  }
105 #endif
106 
107 #ifdef BOINC
108  return new BOINCJobDistributor;
109 #endif
110 
111  if ( option[ OptionKeys::run::shuffle ]() ){
113  }
114 
115  if ( option[ OptionKeys::run::proc_id ].user()
116  && option [ OptionKeys::run::nproc ]() > 1 ) {
118  }
119 
120 // #else
121 // if ( option[ n_worker_threads ].user() ) {
122 // return new MultiThreadedJobDistributor;
123 // } else {
124 // return new FileSystemJobDistributor;
125 // }
126  return new FileSystemJobDistributor; //SML override until we have other child classes
127 }
128 
129 
130 /// @details All the logic for determining job input type lives here. Logic for
131 /// other stuff doesn't have to go home, but it can't live here ...
135 }
136 
137 /// @details this function handles the runtime + compiletime determination of
138 /// which JobOutputter to use
142 }
143 
144 /// @details this function handles the runtime + compiletime determination of
145 /// which JobOutputter to use
149 }
150 
151 /// @details this function handles the determination of which Parser is required
152 /// (if any; returning NULL is valid if no parser is desired)
153 ParserOP
155 {
156  if ( option[ OptionKeys::jd2::dd_parser ].user() )
157  return new DockDesignParser;
158  return NULL;
159 }
160 
161 } // namespace jd2
162 } // namespace protocols