[Simgrid-user] Re: Creating a simulator

Arnaud Legrand Arnaud.Legrand at imag.fr
Thu Jun 16 15:28:40 CEST 2005


please, next time you have a question. Consider emailing
simgrid-user at lists.gforge.inria.fr rather than directly me. This question
has already been asked and, as I was busy these days, it could have been
answered earlier by somebody else. :)

> I am Nguyen The Loc, a SimGrid user. I am a student of Japan Advance
> Institute of Science and Technology, Japan. I want to creat my simulator by
> using SimGrid and I have studied "msg_test.c". I meet an obstacle, so I have
> some questions:

MSG examples are very basic because complex codes do not help learning a
tool. But you're right I should write some other ones. It's been on my TODO
list since ages... :(

> 1. In my issue, the CPU speed and network bandwidth are not stable during
> execution time, but they are change from one round to next round, i.e. CPU
> speed of rounds are different. Therefore I think my simulator should not
> read CPU speed and network bandwidth from file, but from my program itself.
> That mean I want my program do not read information about CPU speed and
> network bandwidth from XML file, but my program will produce that
> information itself during its running time. Could you introduce me how to do
> that ?

Just make measurements. That is the easiest way to do that. For exemple if
you do a function like (assuming you did a power_dict = xbt_dict_new()
earlier and that you are including xbt/dict.h and msg/msg.h):

void task_execute(m_task_t job)
   double now = MSG_getClock();

   now = MSG_getClock()-now;
   store_in_dict(power_dict, MSG_host_get_name(MSG_host_self()),

If you want to have a good approximation of the bandwidth, just use a
function like:

static char tmp_name[512];
static char *LINK_NAME(const char *src, const char* dst) 
   sprintf(tmp_name,"%s -> %s",src,dst);
   return tmp_name;

void task_put(m_task_t task, m_host_t dest,
      	      m_channel_t channel)
   double now = MSG_getClock();

   MSG_task_put(task, dest, channel);
   now = MSG_getClock()-now;


> 2. In the case of the above way is not avaible, i.e. we must read
> information about CPU speed and network bandwidth from XML file, what should
> I do to get the many different CPU speeds and bandwidth during excution time
> of my program ?

The models used in simgrid are somehow complex and do not allow to easily
get bandwidth and latency values. Moreover, the aim of a simulation with
simgrid is to make it as realistic as possible. So making measurements seems
to me to be a good way to get those values.

Hope this helps.



More information about the Simgrid-user mailing list