00001 /* #start# *********************************************************** 00002 00003 Scheduling Simulator 00004 Lehrstuhl f"ur Effiziente Algorithmen 00005 Technische Universit"at M"unchen 00006 00007 File : $Id: SMalleableJob.h,v 1.7 2003/03/21 15:47:05 taeubig Exp $ 00008 00009 Purpose : 00010 00011 RCS-Log: 00012 $Log: SMalleableJob.h,v $ 00013 Revision 1.7 2003/03/21 15:47:05 taeubig 00014 merge with source from Bertolt 00015 00016 Revision 1.6 2003/01/24 10:05:02 hall 00017 brdCast stuff 00018 00019 Revision 1.5 2003/01/08 18:57:13 meierb 00020 added randomized release times 00021 00022 Revision 1.2 2002/12/16 23:32:09 meierb 00023 *** empty log message *** 00024 00025 Revision 1.1.1.1 2002/12/02 22:26:19 meierb 00026 my_schedule 00027 00028 Revision 1.3 2002/11/10 18:19:42 taeubig 00029 Added std:: to cerr 00030 00031 Revision 1.2 2002/11/09 20:50:14 taeubig 00032 <iostream> inclusion, added std:: 00033 corrected relative path for header includes 00034 00035 Revision 1.1 2002/08/29 12:59:59 taeubig 00036 Added the sources 00037 00038 Revision 1.1 2000/05/29 19:51:25 taeubig 00039 Moved job type related files into subdirectory jobs 00040 00041 Revision 1.8 2000/05/09 13:33:11 taeubig 00042 Defined fitsInto() (replaces isSmaller()) 00043 00044 Revision 1.7 2000/04/18 00:17:30 taeubig 00045 Minor changes for setting the current topology and 00046 getting the processing time (have to discuss that later..) 00047 00048 Revision 1.6 2000/02/23 18:06:55 taeubig 00049 Changed reference into pointer in setCurrentTopology() 00050 00051 Revision 1.5 2000/01/30 03:06:19 taeubig 00052 Updated topologies. 00053 00054 Revision 1.4 2000/01/08 19:36:23 taeubig 00055 Cleaned SMalleableJob* files 00056 00057 Revision 1.3 1999/12/01 07:55:31 schickin 00058 temporary bug fixes (project didn't compile!) 00059 00060 Revision 1.2 1999/12/01 03:59:55 taeubig 00061 SParallelJob is now superclass of SMalleableJob. 00062 Minor changes for requested topology. 00063 00064 Revision 1.1 1999/11/10 03:06:00 taeubig 00065 Malleable jobs (parallelizable jobs), 00066 they may be scheduled on fewer machines than requested 00067 at the cost of increasing the processing time 00068 00069 00070 * #end# ************************************************************* */ 00071 00072 #ifndef SMALLEABLEJOB_H 00073 #define SMALLEABLEJOB_H 00074 00075 // system header files 00076 #include <iostream> 00077 00078 // project header files 00079 #include "SJob.h" 00080 #include "SMalleableJobMod.h" 00081 #include "SParallelJob.h" 00082 #include "../topos/STopology.h" 00083 00084 // ----------------------------------------------------------------------- 00085 class SMalleableJob : public virtual SParallelJob { 00086 TYPEINFO0(SMalleableJob, "malleable"); 00087 friend class SMalleableJobMod; 00088 public: 00089 SMalleableJob(SProbabilityDist* dist) : SParallelJob(dist), _mod(*this), _pMaxTop(NULL), _pMinTop(NULL) {}; 00090 SMalleableJob(double proctime) : SParallelJob(proctime), _mod(*this), _pMaxTop(NULL), _pMinTop(NULL) {}; 00091 virtual ~SMalleableJob() {}; 00092 00093 virtual const STopology* getMaxTop() const { return _pMaxTop; }; 00094 virtual const STopology* getMinTop() const { return _pMinTop; }; 00095 00096 virtual void process(SMachines& machines, double duration); 00097 00098 SJobMod& getModifier() { return _mod; }; 00099 00103 // Why don't we overwrite setTopology() ??? 00104 void setCurrentTopology(STopology* top) { 00105 assert(top != NULL); 00106 if ((_pMaxTop != NULL) && !top->fitsInto(_pMaxTop)) 00107 // errorMsg("Error", "Topology is too big"); 00108 std::cerr << "Error! Topology is too big" << std::endl; 00109 if ((_pMinTop != NULL) && !_pMinTop->fitsInto(top)) 00110 // errorMsg("Error", "Topology is too small"); 00111 std::cerr << "Error! Topology is too small" << std::endl; 00112 _mod.setTopology(top); 00113 } 00114 00115 virtual double getProcTime(); 00116 virtual double getProcTimeOnTopology(const STopology& rTopo); 00117 00118 private: 00119 SMalleableJobMod _mod; 00120 STopology *_pMaxTop; 00121 STopology *_pMinTop; 00122 }; 00123 // ----------------------------------------------------------------------- 00124 std::ostream& operator<<(std::ostream& out, SMalleableJob &job); 00125 // ----------------------------------------------------------------------- 00126 00127 #endif //SMALLEABLEJOB_H