Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
typo
[simgrid.git] / doc / FAQ.doc
index c18f236..35b2063 100644 (file)
@@ -1,6 +1,6 @@
 /*! \page faq Frequently Asked Questions
 
-\htmlinclude FAQ.toc
+\htmlinclude .FAQ.doc.toc
 
 \section faq_installation Installing the SimGrid library
 
@@ -14,10 +14,10 @@ instructions and still have some troubles, drop an e-mail to
 \subsection faq_compiling Compiling SimGrid
 
 Suppose you have uncompressed SimGrid in some temporary location of
-your home directory (say <tt>/home/joe/tmp/simgrid-2.18.2 </tt>). The
+your home directory (say <tt>/home/joe/tmp/simgrid-3.0.1 </tt>). The
 simplest way to use SimGrid is to install it in your home
 directory. Change your directory to
-<tt>/home/joe/tmp/simgrid-2.18.2</tt> and type
+<tt>/home/joe/tmp/simgrid-3.0.1</tt> and type
 
 \verbatim./configure --prefix=$HOME
 make
@@ -41,7 +41,7 @@ SimGrid is not a binary, it is a library. Both a static and a dynamic
 version are available. Here is what you can find if you try a <tt>ls
 /home/joe/lib</tt>:
 
-\verbatim libsimgrid.a  libsimgrid.la  libsimgrid.so  libsimgrid.so.0 libsimgrid.so.0.0.1
+\verbatim libsimgrid.a libsimgrid.la libsimgrid.so libsimgrid.so.0 libsimgrid.so.0.0.1
 \endverbatim
 
 Thus, there is two ways to link your program with SimGrid:
@@ -194,6 +194,27 @@ thought about adding a global structure where you directly compute the
 informations that are really important rather than writing everything
 down and then processing huge files ?
 
+\subsection faq_C Argh! Do I really have to code in C ?
+
+Up until now, there is no binding for other languages. If you use C++,
+you should be able to use the SimGrid library as a standard C library
+and everything should work fine (simply <i>link</i> against this
+library; recompiling SimGrid with a C++ compiler won't work and it
+wouldn't help if you could).
+
+In fact, the bindings needed to allow one to use SimGrid from Perl,
+Python, Java, etc. are double-layered.  The first layer would allow
+you to call for example the MSG_task_get_name(task) function while
+what you really want is a proper object wrapping allowing you to call
+task->name(). That's the purpose of the second layer.  The first one
+is granted with C++ but can be done with tools like 
+<a href="www.swig.org/">swig</a> for other languages like Perl, Ruby,
+Python, CAML. None of us really need the second one (which is a bit
+more demanding and cannot be automatically generated) yet and there is
+no real point in doing the first one without the second. :)
+
+As usual, you're welcome to participate.
+
 \section faq_questions How to ....? Is there a function in the API to simply ....?
 
 Here is the deal. The whole SimGrid project (MSG, SURF, GRAS, ...) is
@@ -281,6 +302,52 @@ MSG_process_suspend() and MSG_process_resume(). You can even do some
 synchronization with fake communications (using MSG_task_get(),
 MSG_task_put() and MSG_task_Iprobe()).
 
+\subsection faq_examples_MIA_host_load Where is the get_host_load function hidden in MSG?
+
+There is no such thing because its semantic wouldn't be really
+clear. Of course, it is something about the amount of host throughput,
+but there is as many definition of "host load" as people asking for
+this function. First, you have to remember that resource availability
+may vary over time, which make any load notion harder to define.
+
+It may be instantaneous value or an average one. Moreover it may be only the
+power of the computer, or may take the background load into account, or may
+even take the currently running tasks into account. In some SURF models,
+communications have an influence on computational power. Should it be taken
+into account too?
+
+So, we decided not to include such a function into MSG and let people do it
+thereselves so that they get the value matching exactly what they mean. One
+possibility is to run active measurement as in next code snippet. It is very
+close from what you would have to do out of the simulator, and thus gives
+you information that you could also get in real settings to not hinder the
+realism of your simulation. 
+
+\verbatim
+double get_host_load() {
+   m_task_t task = MSG_task_create("test", 0.001, 0, NULL);
+   double date = MSG_get_clock();
+
+   MSG_task_execute(task);
+   date = MSG_get_clock() - date;
+   MSG_task_destroy(task);
+   return (0.001/date);
+}
+\endverbatim
+
+Of course, it may not match your personal definition of "host load". In this
+case, please detail what you mean on the mailing list, and we will extend
+this FAQ section to fit your taste if possible.
+
+\subsection faq_examples_MIA_batch_scheduler Is there a native support for batch schedulers in SimGrid ?
+
+No, there is no native support for batch schedulers and none is
+planned because this is a very specific need (and doing it in a
+generic way is thus very hard). However some people have implemented
+their own batch schedulers. Vincent Garonne wrote one during his PhD
+and put his code in the contrib directory of our CVS so that other can
+keep working on it. You may find inspinring ideas in it.
+
 \section faq_SG Where has SG disappeared?!?
 
 OK, it's time to explain what's happening to the SimGrid project. Let's
@@ -388,15 +455,35 @@ parallel task model, and ... Anyway, we finally have migrated our CVS
 to gforge so people that are interested by helping on this part will
 have the possibility to do it.
 
-\subsection faq_SG_DAG But I wanted to implement a distributed dynamic scheduler of DAGs... How can I do that if SG is not available anymore in the next versions?
+\subsection faq_SG_DAG How to implement a distributed dynamic scheduler of DAGs.
 
 Distributed is somehow "contagious". If you start making distributed
 decisions, there is no way to handle DAGs directly anymore (unless I am
 missing something). You have to encode your DAGs in term of communicating
 process to make the whole scheduling process distributed. Believe me, it is
 worth the effort since you'll then be able to try your algorithms in a very
-wide variety of conditions.
+wide variety of conditions. Here is an example of how you could do that.
+Assume T1 has to be done before T2.
 
+\verbatim
+ int your_agent(int argc, char *argv[] {
+   ...
+   T1 = MSG_task_create(...);
+   T2 = MSG_task_create(...);
+   ...
+   while(1) {
+     ...
+     if(cond) MSG_task_execute(T1);
+     ...
+     if((MSG_task_get_remaining_computation(T1)=0.0) && (you_re_in_a_good_mood))
+        MSG_task_execute(T2)
+     else {
+        /* do something else */
+     }
+   }
+ }
+\endverbatim
 If you decide that the distributed part is not that much important and that
 DAG is really the level of abstraction you want to work with (but it
 prevents you from having "realistic" platform modeling), then you should
@@ -404,6 +491,52 @@ keep using the 2.18.5 versions until somebody has ported SG on top of SURF.
 Note however that SURF will be slower than the old SG to handle traces with
 a lots of variations (there is no trace integration anymore).
 
+\subsection faq_SG_future Will SG come back in the maintained branch one day?
+
+Sure. In fact, we already have thought about a new and cleaner API:
+\verbatim
+void*       SG_link_get_data(SG_link_t link);
+void        SG_link_set_data(SG_link_t link, void *data);
+const char* SG_link_get_name(SG_link_t link);
+double      SG_link_get_capacity(SG_link_t link);
+double      SG_link_get_current_bandwidth(SG_link_t link);
+double      SG_link_get_current_latency(SG_link_t link);
+
+SG_workstation_t  SG_workstation_get_by_name(const char *name);
+SG_workstation_t* SG_workstation_get_list(void);
+int               SG_workstation_get_number(void);
+void              SG_workstation_set_data(SG_workstation_t workstation, void *data);
+void *            SG_workstation_get_data(SG_workstation_t workstation);
+const char*       SG_workstation_get_name(SG_workstation_t workstation);
+SG_link_t*        SG_workstation_route_get_list(SG_workstation_t src, SG_workstation_t dst);
+int               SG_workstation_route_get_size(SG_workstation_t src, SG_workstation_t dst);
+double            SG_workstation_get_power(SG_workstation_t workstation);
+double            SG_workstation_get_available_power(SG_workstation_t workstation);
+
+SG_task_t         SG_task_create(const char *name, void *data, double amount);
+int               SG_task_schedule(SG_task_t task, int workstation_nb,
+                                    SG_workstation_t **workstation_list, double *computation_amount,
+                                    double *communication_amount, double rate);
+
+void*             SG_task_get_data(SG_task_t task);
+void              SG_task_set_data(SG_task_t task, void *data);
+const char*       SG_task_get_name(SG_task_t task);
+double            SG_task_get_amount(SG_task_t task);
+double            SG_task_get_remaining_amount(SG_task_t task);
+void              SG_task_dependency_add(const char *name, void *data, SG_task_t src, SG_task_t dst);
+void              SG_task_dependency_remove(SG_task_t src, SG_task_t dst); 
+e_SG_task_state_t SG_task_state_get(SG_task_t task); /* e_SG_task_state_t can be either SG_SCHEDULED, SG_RUNNING, SG_DONE, or SG_FAILED */
+void              SG_task_watch(SG_task_t task, e_SG_task_state_t state); /* SG_simulate will stop as soon as the state of this task is the one given in argument. 
+                                                                             Watch-point is then automatically removed */
+void              SG_task_unwatch(SG_task_t task, e_SG_task_state_t state);
+
+void              SG_task_unschedule(SG_task_t task); /* change state and rerun.. */
+
+SG_task_t        *SG_simulate(double how_long); /* returns a NULL-terminated array of SG_task_t whose state has changed */
+\endverbatim
+
+We're just looking for somebody to implement it... :)
+
 \section faq_dynamic Dynamic resources and platform building
 
 \subsection faq_platform Building a realistic platform
@@ -471,42 +604,7 @@ latency_file and state_file. The only difference with CPUs is that
 bandwidth_file and latency_file do not express fraction of available
 power but are expressed directly in Mb/s and seconds.
 
-\subsection faq_host_load Where is the get_host_load function hidden in MSG?
-
-There is no such thing because its semantic wouldn't be really clear. Of
-course, it is something about the amount of host throughput, but there is as
-many definition of "host load" as people asking for this function.
-
-It may be instantaneous value or an average one. Moreover it may be only the
-power of the computer, or may take the background load into account, or may
-even take the currently running tasks into account. In some SURF models,
-communications have an influence on computational power. Should it be taken
-into account too?
-
-So, we decided not to include such a function into MSG and let people do it
-thereselves so that they get the value matching exactly what they mean. One
-possibility is to run active measurement as in next code snippet. It is very
-close from what you would have to do out of the simulator, and thus gives
-you information that you could also get in real settings to not hinder the
-realism of your simulation. 
-
-\verbatim
-double get_host_load() {
-   m_task_t task = MSG_task_create("test", 0.001, 0, NULL);
-   double date = MSG_get_clock();
-
-   MSG_task_execute(task);
-   date = MSG_get_clock() - date;
-   MSG_task_destroy(task);
-   return (0.001/date);
-}
-\endverbatim
-
-Of course, it may not match your personal definition of "host load". In this
-case, please detail what you mean on the mailing list, and we will extend
-this FAQ section to fit your taste if possible.
-
-\subsection faq_flexml_bypassing How could I have some C functions do what the platform and deployment files do?
+\subsection faq_flexml_bypassing How can I have some C functions do what the platform file does?
 
 So you want to bypass the XML files parser, uh? Maybe doin some parameter
 sweep experiments on your simulations or so? This is possible, but it's not
@@ -578,6 +676,42 @@ An example of this trick is distributed in the file examples/msg/msg_test_surfxm
 
 \section faq_troubleshooting Troubleshooting
 
+\subsection faq_distcheck_fails Dude! "make check" fails on my machine!
+
+Don't assume we never run this target, because we do. Really. Promise!
+
+There is several reasons which may cause the make check to fail on your
+machine:
+
+ - <b>You are using a borken compiler</b>.\n
+   The symptom may be that the "make check" fails within testsuite/gras
+   directory.\n
+   For example, the breezy release of Ubuntu comes with a prerelease of the
+   4.0 gcc compiler. This version happens to be completely unusable, and you
+   should install a gcc-3.4 compiler and change the /usr/bin/gcc link to let
+   it point on /usr/bin/gcc-3.4.
+ - <b>You are using a borken libc (probably concerning the contextes)</b>.\n
+   The symptom is that the "make check" fails within the examples/msg directory.\n
+   By default, SimGrid uses something called ucontexts. This is part of the
+   libc, but it's quite undertested. For example, some (old) versions of the
+   glibc on alpha do not implement these functions, but provide the stubs
+   (which return ENOSYS: not implemented). It fools our detection mecanism
+   and leads to segfaults.\n
+   On some x86_64, the pointer to function is stored into a integer, but int
+   are 32bits only on this arch while pointers are 64bits. Our detection
+   mecanism also fails to detect the problem, which leads to segfaults.\n
+   In both cases, there is not much we can do to fix the bug. We are working
+   on a workaround for x86_64 machines, but in the meanwhile, you can
+   compile with --with-context=pthread to avoid ucontext completely. You'll
+   be a bit more limitated in the number of simulated processes you can start
+   concurently, but 5000 processes is still enough for most purposes, isn't
+   it?\n
+   This limitation is the reason why we insist on using this piece of ...
+   software even if it's so troublesome.
+ - <b>There is a bug in SimGrid we aren't aware of</b>.\n
+   If none of the above apply, please drop us a mail on the mailing list so
+   that we can check it out.
+
 \subsection faq_context_1000 I want thousands of simulated processes
 
 SimGrid can use either pthreads library or the UNIX98 contextes. On most
@@ -595,10 +729,11 @@ implementation. On Windows boxes, the provided value is discarded and an
 adapted version is picked up.
 
 We experienced some issues with contextes on some rare systems (solaris 8
-and lower comes to mind). The main problem is that the configure script
-detect the contextes as being functional when it's not true. If you happen
-to use such a system, switch manually to the pthread version, and provide us
-with a good patch for the configure script so that it is done automatically ;)
+and lower or old alpha linuxes comes to mind). The main problem is that the
+configure script detect the contextes as being functional when it's not
+true. If you happen to use such a system, switch manually to the pthread
+version, and provide us with a good patch for the configure script so that
+it is done automatically ;)
 
 \subsection faq_context_10000 I want hundred thousands of simulated processes
 
@@ -666,7 +801,21 @@ These are changes to FleXML itself, not SimGrid. But since we kinda hijacked
 the development of FleXML, I can grant you that any patches would be really
 welcome and quickly integrated.
 
-\author Arnaud Legrand (arnaud.legran::imag.fr)
+\subsection faq_deadlock There is a deadlock !!!
+
+Unfortunately, we cannot debug every code written in SimGrid.  We
+furthermore believe that the framework provides ways enough
+information to debug such informations yourself. If the textual output
+is not enough, Make sure to check the \ref faq_visualization FAQ entry to see
+how to get a graphical one.
+
+Now, if you come up with a really simple example that deadlocks and
+you're absolutely convinced that it should not, you can ask on the
+list. Just be aware that you'll be severely punished if the mistake is
+on your side... We have plenty of FAQ entries to redact and new
+features to implement for the impenitents! ;)
+
+\author Arnaud Legrand (arnaud.legrand::imag.fr)
 \author Martin Quinson (martin.quinson::loria.fr)