-/* Copyright (c) 2010-2012, 2014-2015. The SimGrid Team.
+/* Copyright (c) 2010-2012, 2014-2016. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
-/* Copyright (c) 2010-2012, 2014-2015. The SimGrid Team.
+/* Copyright (c) 2010-2012, 2014-2016. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
-/* Copyright (c) 2010-2012, 2014-2015. The SimGrid Team.
+/* Copyright (c) 2010-2012, 2014-2016. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#if HAVE_JEDULE
SG_BEGIN_DECL()
XBT_PUBLIC(void) jedule_log_sd_event(SD_task_t task);
-XBT_PUBLIC(void) jedule_setup_platform(void);
XBT_PUBLIC(void) jedule_sd_init(void);
-XBT_PUBLIC(void) jedule_sd_cleanup(void);
XBT_PUBLIC(void) jedule_sd_exit(void);
XBT_PUBLIC(void) jedule_sd_dump(const char* filename);
SG_END_DECL()
-/* Copyright (c) 2010-2014. The SimGrid Team.
+/* Copyright (c) 2010-2016. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "simgrid/host.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "xbt/asserts.h"
#include "simgrid/jedule/jedule.hpp"
this->meta_info.insert({key, value});
}
-void Jedule::cleanupOutput() {
- for (auto evt: this->event_set)
- delete evt;
- this->event_set.clear();
-}
void Jedule::writeOutput(FILE *file) {
if (!this->event_set.empty()){
-
fprintf(file, "<jedule>\n");
if (!this->meta_info.empty()){
-/* Copyright (c) 2010-2014. The SimGrid Team.
+/* Copyright (c) 2010-2016. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#include "simgrid/jedule/jedule_events.hpp"
#include "simgrid/jedule/jedule.hpp"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
#include "xbt/asserts.h"
-/* Copyright (c) 2010-2015. The SimGrid Team.
+/* Copyright (c) 2010-2016. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#include "simgrid/jedule/jedule.hpp"
#include "simgrid/jedule/jedule_platform.hpp"
#include "simgrid/s4u/As.hpp"
-#include "simgrid/host.h"
#include "xbt/asserts.h"
#include "xbt/dynar.h"
-#include "xbt/str.h"
-#include <string>
-
-#include <stdlib.h>
-#include <stdio.h>
#if HAVE_JEDULE
}
Container::~Container(){
- if(!this->children.empty()) {
- for (auto child: this->children){
+ if(!this->children.empty())
+ for (auto child: this->children)
delete child;
- }
- }
}
void Container::addChild(jed_container_t child){
xbt_dynar_push(subset_list, &subset);
}
-static void add_subsets_to(xbt_dynar_t subset_list, xbt_dynar_t hostgroup, jed_container_t parent) {
- unsigned int iter;
- char *host_name;
+static void add_subsets_to(xbt_dynar_t subset_list, std::vector<const char*> hostgroup, jed_container_t parent) {
int id;
// get ids for each host
// create subset for each id group
xbt_assert( subset_list != nullptr );
- xbt_assert( hostgroup != nullptr );
xbt_assert( parent != nullptr );
xbt_dynar_t id_list = xbt_dynar_new(sizeof(int), nullptr);
- xbt_dynar_foreach(hostgroup, iter, host_name) {
- jed_container_t parent;
+ for (auto host_name : hostgroup) {
xbt_assert( host_name != nullptr );
- parent = (jed_container_t)host2_simgrid_parent_container.at(host_name);
+ jed_container_t parent = host2_simgrid_parent_container.at(host_name);
id = parent->name2id.at(host_name);
xbt_dynar_push(id_list, &id);
}
}
void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, std::vector<sg_host_t> *host_list) {
- std::unordered_map<const char*, xbt_dynar_t> parent2hostgroup; // group hosts by parent
-
xbt_assert( host_list != nullptr );
-
// for each host name
// find parent container
// group by parent container
-
+ std::unordered_map<const char*, std::vector<const char*>> parent2hostgroup;
for (auto host: *host_list) {
const char *host_name = sg_host_get_name(host);
- jed_container_t parent = (jed_container_t)host2_simgrid_parent_container.at(host_name);
+ jed_container_t parent = host2_simgrid_parent_container.at(host_name);
xbt_assert( parent != nullptr );
auto host_group = parent2hostgroup.find(parent->name.c_str());
- if (host_group == parent2hostgroup.end()){
- xbt_dynar_t group = xbt_dynar_new(sizeof(char*), nullptr);
- xbt_dynar_push(group, &host_name);
- parent2hostgroup.insert({parent->name.c_str(), group});
- } else {
- xbt_dynar_push(host_group->second, &host_name);
- }
+ if (host_group == parent2hostgroup.end())
+ parent2hostgroup.insert({parent->name.c_str(), std::vector<const char*>(1,host_name)});
+ else
+ host_group->second.push_back(host_name);
}
for (auto elm: parent2hostgroup) {
- jed_container_t parent = (jed_container_t)container_name2container.at(elm.first);
+ jed_container_t parent = container_name2container.at(elm.first);
add_subsets_to(subset_list, elm.second, parent);
- xbt_dynar_free_container(&elm.second);
}
}
-
#endif
-/* Copyright (c) 2010-2015. The SimGrid Team.
+/* Copyright (c) 2010-2016. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "xbt/asserts.h"
-
-#include "src/surf/surf_private.h"
-#include "surf/surf.h"
-
#include "simgrid/jedule/jedule_sd_binding.h"
-#include "simgrid/simdag.h"
-#include "simgrid/s4u/As.hpp"
-#include "simgrid/s4u/engine.hpp"
-
-#include <stdio.h>
#include "simgrid/forward.h"
+#include "simgrid/s4u/As.hpp"
+#include "simgrid/s4u/engine.hpp"
#include "simgrid/jedule/jedule.hpp"
-#include "simgrid/jedule/jedule_events.hpp"
-#include "simgrid/jedule/jedule_platform.hpp"
#include "../../simdag/simdag_private.hpp"
#if HAVE_JEDULE
{
xbt_assert(task != nullptr);
- jed_event_t event =
- new simgrid::jedule::Event(std::string(SD_task_get_name(task)), task->start_time, task->finish_time,"SD");
+ jed_event_t event = new simgrid::jedule::Event(std::string(SD_task_get_name(task)),
+ SD_task_get_start_time(task), SD_task_get_finish_time(task), "SD");
event->addResources(task->allocation);
my_jedule->event_set.push_back(event);
}
-void jedule_setup_platform()
+void jedule_sd_init()
{
AS_t root_comp = simgrid::s4u::Engine::instance()->rootAs();
XBT_DEBUG("root name %s\n", root_comp->name());
my_jedule->root_container = root_container;
}
-void jedule_sd_cleanup()
-{
- my_jedule->cleanupOutput();
-}
-
-void jedule_sd_init()
-{
-}
-
void jedule_sd_exit(void)
{
delete my_jedule;
xbt_cfg_setdefault_string("host/model", "ptask_L07");
-#if HAVE_JEDULE
- jedule_sd_init();
-#endif
-
if (_sg_cfg_exit_asap) {
SD_exit();
exit(0);
XBT_DEBUG("Host number: %zu, link number: %d", sg_host_count(), sg_link_count());
#if HAVE_JEDULE
- jedule_setup_platform();
+ jedule_sd_init();
#endif
XBT_VERB("Starting simulation...");
surf_presolve(); /* Takes traces into account */
void SD_exit()
{
#if HAVE_JEDULE
- jedule_sd_cleanup();
jedule_sd_exit();
#endif
delete sd_global;